Ver código fonte

【调拨订单】:
1.增加“产品批号”参照,根据物料编码筛选,若物料编码为空则禁用;
2.增加子表不能为空判断;
3.子表调出/入货位根据仓库id筛选
4.监听子表数量变化,子表数量总和=主表总数量
5.根据调出/入组织改变清空对应调出/入仓库与部门;
6.根据调出/入仓库改变,清空对应调出/入货位

002390 1 ano atrás
pai
commit
8a2d775b12

+ 7 - 0
src/components/popover-select/components/PATCHCODE_ZT.js

@@ -0,0 +1,7 @@
+// 产品批号
+export default [
+  {
+    item: { key: "code", title: "编码", width: "auto" },
+    attr: {},
+  },
+];

+ 15 - 12
src/views/purchase/transferOrder/add/columns.js

@@ -69,6 +69,7 @@ export default function useColumns() {
         referName: "ORG_PARAM",
         dataMapping: {
           deliveryInventoryOrg: "id",
+          deliveryInventoryOrgCode: "code",
         },
         clearable: true,
       }
@@ -81,6 +82,7 @@ export default function useColumns() {
         referName: "WAREHOUSE_PARAM",
         dataMapping: {
           deliveryWarehouse: "id",
+          deliveryWarehouseCode: "code",
           dwCsFlag: "csFlag",
         },
         queryParams: (params) => ({
@@ -97,6 +99,7 @@ export default function useColumns() {
         referName: "DEPT_PARAM",
         dataMapping: {
           deliveryDept: "id",
+          deliveryDeptCode: "code",
         },
         queryParams: (params) => ({
           // parame
@@ -126,6 +129,7 @@ export default function useColumns() {
         referName: "ORG_PARAM",
         dataMapping: {
           storageInventoryOrg: "id",
+          storageInventoryOrgCode: "code",
         },
         clearable: true,
       }
@@ -138,6 +142,7 @@ export default function useColumns() {
         referName: "WAREHOUSE_PARAM",
         dataMapping: {
           storageWarehouse: "id",
+          storageWarehouseCode: "code",
           swCsFlag: "csFlag",
         },
         queryParams: (params) => ({
@@ -256,11 +261,6 @@ export default function useColumns() {
               manufacturer: "manufacturerIdName",
               originPlace: "originPlace",
               originPlaceName: "originPlaceName",
-              // unit: "unitId",
-              // mainUnit: "unitId",
-              // mainUnitName: "unitIdName",
-              // marketingApprovalPersonal: "registrant",
-              // production: "productionPermit",
             },
             clearable: true,
           }
@@ -305,6 +305,7 @@ export default function useColumns() {
             referName: "DEPT_PARAM",
             dataMapping: {
               storageDept: "id",
+              storageDeptCode: "code",
             },
             clearable: true,
           }
@@ -312,13 +313,13 @@ export default function useColumns() {
         {
           item: { key: "producBatch", title: "产品批号", },
           attr: {
-            // is: "el-popover-select-v2",
-            // valueKey: "name",
-            // referName: "ALLOCATION_PARAM",
-            // dataMapping: {
-            //   storageAllocation: "id",
-            // },
-            // clearable: true,
+            is: "el-popover-select-v2",
+            valueKey: "code",
+            referName: "PATCHCODE_ZT",
+            clearable: true,
+            queryParams: (params) => ({
+              code: params.materialCode,
+            })
           }
         },
         {
@@ -329,6 +330,7 @@ export default function useColumns() {
             referName: "ALLOCATION_PARAM",
             dataMapping: {
               deliveryAllocation: "id",
+              deliveryAllocationCode: "code",
             },
             clearable: true,
           }
@@ -341,6 +343,7 @@ export default function useColumns() {
             referName: "ALLOCATION_PARAM",
             dataMapping: {
               storageAllocation: "id",
+              storageAllocationCode: "code",
             },
             clearable: true,
           }

+ 115 - 3
src/views/purchase/transferOrder/add/index.vue

@@ -56,6 +56,7 @@ export default {
       count: 0,
       loading: false,
       visible: false,
+      control: false,
     };
   },
   computed: {
@@ -98,7 +99,76 @@ export default {
       set() {},
     },
   },
-  watch: {},
+  watch: {
+    // 调出库存组织
+    "params.deliveryInventoryOrgName": {
+      handler: function (nVal, oVal) {
+        this.control &&
+          (this.params = {
+            ...this.params,
+            deliveryWarehouse: null,
+            deliveryWarehouseCode: null,
+            deliveryWarehouseName: null,
+            deliveryDept: null,
+            deliveryDeptCode: null,
+            deliveryDeptName: null,
+          });
+      },
+    },
+    // 调入库存组织
+    "params.storageInventoryOrgName": {
+      handler: function (nVal, oVal) {
+        this.control &&
+          (this.params = {
+            ...this.params,
+            storageWarehouse: null,
+            storageWarehouseName: null,
+            stAllotMaterialList: this.params["stAllotMaterialList"].map(
+              (item) => ({
+                ...item,
+                storageDept: null,
+                storageDeptCode: null,
+                storageDeptName: null,
+              })
+            ),
+          });
+      },
+    },
+    // 调出仓库
+    "params.deliveryWarehouseName": {
+      handler: function (nVal, oVal) {
+        this.control &&
+          (this.params = {
+            ...this.params,
+            stAllotMaterialList: this.params["stAllotMaterialList"].map(
+              (item) => ({
+                ...item,
+                deliveryAllocation: null,
+                deliveryAllocationCode: null,
+                deliveryAllocationName: null,
+              })
+            ),
+          });
+      },
+    },
+    // 调入仓库
+    "params.storageWarehouseName": {
+      handler: function (nVal, oVal) {
+        this.control &&
+          (this.params = {
+            ...this.params,
+            stAllotMaterialList: this.params["stAllotMaterialList"].map(
+              (item) => ({
+                ...item,
+                storageAllocation: null,
+                storageAllocationCode: null,
+                storageAllocationName: null,
+              })
+            ),
+          });
+      },
+    },
+  },
   methods: {
     setVisible(prop) {
       this.visible = prop;
@@ -119,6 +189,7 @@ export default {
         dwCsFlag: null,
         swCsFlag: null,
       };
+      this.control = false;
       this.tabName = tabName;
       this.TabColumn = TabColumns;
       this.$refs["superForm"].clearValidate();
@@ -139,6 +210,8 @@ export default {
           billDate: new Date().Format("yyyy-MM-dd"),
           createTime: new Date().Format("yyyy-MM-dd HH:mm:ss"),
         };
+        this.control = true;
+        this.useRowAdd(this.tabName);
       } else {
         await this.fetchItem(data);
         this.$nextTick(async () => {
@@ -180,6 +253,7 @@ export default {
               ),
             };
           }
+          this.control = true;
           // 调入/出货位禁用——根据调入/出仓库
           const { deliveryWarehouse, storageWarehouse } = this.params;
           this.params.dwCsFlag = await this.fetchWarehouse(deliveryWarehouse);
@@ -237,7 +311,10 @@ export default {
     },
     // 删行
     useRowRemove(prop, { row }) {
-      console.log(row, "row");
+      if (this.tabInfo[prop].length < 2) {
+        this.$notify.warning("明细至少保留一行数据");
+        return;
+      }
       this.params[prop].forEach((item, index) => {
         if (item["rowno"] && item["rowno"] == row["rowno"]) {
           item.id
@@ -245,6 +322,7 @@ export default {
             : this.params[prop].splice(index, 1);
         }
       });
+      this.changeQty();
     },
     // 保存
     useSave(prop) {
@@ -324,6 +402,18 @@ export default {
         this.$modal.closeLoading();
       }
     },
+    // 子表数量改变
+    changeQty(tabName) {
+      this.params.qty = this.params["stAllotMaterialList"].reduce(
+        (sum, item) => {
+          if (item.delFlag !== "2") {
+            sum += item.qty;
+          }
+          return sum;
+        },
+        0
+      );
+    },
   },
   created() {},
 };
@@ -369,7 +459,7 @@ export default {
             type="primary"
             :size="size"
             @click="sendToNC"
-            v-show="params.status == '2'"
+            v-show="params.status == '2' && !params.ncCode"
             >重传NC</el-button
           >
           <el-button
@@ -471,6 +561,7 @@ export default {
                 :size="$attrs.size"
                 :source.sync="scope.row"
                 :disabled="addType === 'see'"
+                @change="changeQty(tabName)"
               >
               </component>
             </template>
@@ -490,6 +581,17 @@ export default {
               >
               </component>
             </template>
+            <!-- 产品批号 -->
+            <template slot="producBatch" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="addType === 'see' || !scope.row['materialCode']"
+              >
+              </component>
+            </template>
             <!-- 调出货位 -->
             <template slot="deliveryAllocationName" slot-scope="scope">
               <component
@@ -502,6 +604,11 @@ export default {
                   !params.dwCsFlag ||
                   params.dwCsFlag === 'N'
                 "
+                :queryParams="
+                  () => ({
+                    stordocId: params.deliveryWarehouse,
+                  })
+                "
               >
               </component>
             </template>
@@ -517,6 +624,11 @@ export default {
                   !params.swCsFlag ||
                   params.swCsFlag === 'N'
                 "
+                :queryParams="
+                  () => ({
+                    stordocId: params.storageWarehouse,
+                  })
+                "
               >
               </component>
             </template>

+ 0 - 32
src/views/purchase/transferOrder/columns.js

@@ -33,14 +33,6 @@ export default function useColumns() {
       item: { key: "allotType", title: "调拨方式", width: 100 },
       attr: { is: "el-dict-tag", dictName: "sys_to_type", },
     },
-    // {
-    //   item: { key: "deliveryCode", title: "调拨出库单号", },
-    //   attr: {},
-    // },
-    // {
-    //   item: { key: "storageCode", title: "调拨入库单号", },
-    //   attr: {},
-    // },
     {
       item: { key: "storageInventoryOrgName", title: "调拨入库组织", },
       attr: {},
@@ -53,26 +45,10 @@ export default function useColumns() {
       item: { key: "deliveryDeptName", title: "调出部门", width: 100 },
       attr: {},
     },
-    // {
-    //   item: { key: "currencyName", title: "币种", width: 100 },
-    //   attr: {},
-    // },
-    // {
-    //   item: { key: "rate", title: "折本汇率", width: 80 },
-    //   attr: {},
-    // },
-    // {
-    //   item: { key: "onRouteAffilliation", title: "在途归属", },
-    //   attr: {},
-    // },
     {
       item: { key: "qty", title: "总数量", width: 100 },
       attr: { isSummary: true, },
     },
-    // {
-    //   item: { key: "accountPath", title: "结算路径", },
-    //   attr: {},
-    // },
     {
       item: { key: "customerName", title: "客户", },
       attr: {},
@@ -85,14 +61,6 @@ export default function useColumns() {
       item: { key: "storageWarehouseName", title: "调入仓库", },
       attr: {},
     },
-    // {
-    //   item: { key: "materialProject", title: "物流项目组", },
-    //   attr: {},
-    // },
-    // {
-    //   item: { key: "liacenterName", title: "利润中心", },
-    //   attr: {},
-    // },
     {
       item: { key: "remark", title: "备注", },
       attr: {},

+ 29 - 31
src/views/purchase/transferOrder/index.vue

@@ -48,7 +48,7 @@
       :height="400"
       convenitentOperation
       storage-key="TransferOrderSuperTable"
-      @row-click="select"
+      @row-click="getlistStAllotItem"
       @row-dblclick="useSee"
       @select="useSelectChange"
       @pagination="getList(params, page)"
@@ -90,7 +90,11 @@
       </ux-table-column>
     </el-super-ux-table>
 
-    <el-tabs v-model="tabName" style="width: 100%; padding: 0px 10px">
+    <el-tabs
+      v-model="tabName"
+      v-loading="itemLoading"
+      style="width: 100%; padding: 0px 10px"
+    >
       <el-tab-pane
         v-for="({ item, TableColumns: columns }, index) in TabColumns"
         :key="index"
@@ -98,8 +102,7 @@
         :name="item.key"
       >
         <el-super-ux-table
-          v-model="tabParams[item.key]"
-          v-loading="itemLoading"
+          v-model="params[item.key]"
           index
           :ref="tabName"
           :height="tabHeight"
@@ -145,7 +148,7 @@ export default {
   data() {
     const { TableColumns, TabColumns, SearchColumns } = useColumns();
     const page = this.$init.page();
-    const params = this.$init.params(SearchColumns);
+    const params = this.$init.params([...SearchColumns, ...TabColumns]);
     return {
       params: {
         ...params,
@@ -163,13 +166,6 @@ export default {
       // 页面状态
       pageStu: "",
       tableList: [],
-      // total: 0,
-      tabParams: {
-        materialInfo: [],
-        receiveInfo: [],
-        priceList: [],
-        resultList: [],
-      },
       rowDetail: {},
       disable: false,
       ids: [],
@@ -178,7 +174,7 @@ export default {
   computed: {
     tabHeight: {
       get() {
-        let { materialInfo } = this.tabParams;
+        let { materialInfo } = this.params;
         return `${
           materialInfo.length
             ? materialInfo.length > 8
@@ -196,9 +192,9 @@ export default {
   methods: {
     resetList() {
       this.page = this.$init.page();
-      const { SearchColumns } = useColumns();
+      const { SearchColumns, TabColumns } = useColumns();
       this.params = {
-        ...this.$init.params(SearchColumns),
+        ...this.$init.params([...SearchColumns, ...TabColumns]),
         code: this.$route.query.billCode,
       };
       this.getList(this.params, this.page);
@@ -221,12 +217,18 @@ export default {
         this.loading = false;
       }
     },
-    getlistStAllotItem(pid) {
-      this.itemLoading = true;
-      listStAllotItem(pid).then((response) => {
-        this.tabParams.materialInfo = response.rows;
+    async getlistStAllotItem(row) {
+      try {
+        const { id } = row;
+        this.itemLoading = true;
+        let { code, rows } = await listStAllotItem(id);
+        if (code == 200) {
+          this.params.materialInfo = rows;
+        }
+      } catch (error) {
+      } finally {
         this.itemLoading = false;
-      });
+      }
     },
     useSelectChange(selection, row) {
       this.selectData = selection;
@@ -270,22 +272,18 @@ export default {
         })
         .catch(() => {});
     },
-    // 选中某行
-    select(row) {
-      this.getlistStAllotItem(row.id);
-    },
     // 行内删除
     deleteids(row) {
-      console.log("row", row);
       this.$modal
-        .confirm("确认信息")
-        .then(() => {
-          delOrder(row.id).then((res) => {
-            if (res.code === 200) {
-              this.$modal.notifySuccess("删除成功");
+        .confirm("是否确认删除")
+        .then(async () => {
+          try {
+            let { code, msg } = await delOrder(row.id);
+            if (code === 200) {
+              this.$notify.success(msg);
               this.getList(this.params, this.page);
             }
-          });
+          } catch (error) {}
         })
         .catch(() => {});
     },