Quellcode durchsuchen

装箱单新增

jbb vor 2 Jahren
Ursprung
Commit
c3a7583887

+ 9 - 2
src/api/document/packing-list/packinglist-clothes.js

@@ -1,5 +1,5 @@
 /** 单证 -- 装箱单-成衣 **/
-import { getAction,deleteAction} from '@/api/manage'
+import { getAction,deleteAction,postAction} from '@/api/manage'
 //分页查询
 const spltList = params => getAction('/splt/syPackingListTailoring/list', params)
 
@@ -15,5 +15,12 @@ const batchDelete = params => deleteAction('/splt/syPackingListTailoring/deleteB
 //根据预装箱单id获取数据
 const orderSpltListId = params => getAction('/splt/syPackingListTailoring/querySpaplId', params)
 
-export {spltList,orderSpltList,deleteSpltList,batchDelete,orderSpltListId}
+//编辑
+const editSpltList = params => postAction('/splt/syPackingListTailoring/edit', params)
+
+//新增
+const addSpltList = params => postAction('/splt/syPackingListTailoring/add', params)
+
+
+export {spltList,orderSpltList,deleteSpltList,batchDelete,orderSpltListId,editSpltList,addSpltList}
 

+ 17 - 3
src/views/packing-list/clothes-list.vue

@@ -150,7 +150,7 @@
 
     <!-- 抽屉 -->
     <div>
-      <clothesAdd-drawer ref="clothesAddDrawer" :father="aa" @ok="modalFormOk"></clothesAdd-drawer>
+      <clothesAdd-drawer ref="clothesAddDrawer" :fatherList="getSpltList" @ok="modalFormOk"></clothesAdd-drawer>
       <detailsClothes-drawer ref="detailsClothesDrawer" :father="bb" @ok="modalFormOk"></detailsClothes-drawer>
       <editClothes-drawer ref="editClothesDrawer" :father="cc" @ok="modalFormOk"></editClothes-drawer>
     </div>
@@ -163,7 +163,7 @@ import JEllipsis from '@/components/jeecg/JEllipsis'
 import clothesAddDrawer from '@views/packing-list/packinglist-clothes/clothesAddDrawer.vue'
 import detailsClothesDrawer from '@views/packing-list/packinglist-clothes/detailsClothesDrawer.vue'
 import editClothesDrawer from '@views/packing-list/packinglist-clothes/editClothesDrawer.vue'
-import { spltList} from '@api/document/packing-list/packinglist-clothes'
+import { spltList,deleteSpltList} from '@api/document/packing-list/packinglist-clothes'
 
 
 export default {
@@ -460,7 +460,21 @@ export default {
       this.$refs.editClothesDrawer.visible = true
     },
     // 操作 删除
-    handleDelete() {},
+    handleDelete(record) {
+       console.log('点击删除项id:', record)
+       this.$nextTick(() => {
+        deleteSpltList({ id: record }).then(res => {
+          if (res.success) {
+            console.log('res:', res)
+            this.getSpltList()
+            this.$message.success('删除成功')
+          } else {
+            this.$message.error('删除成功')
+          }
+       
+        })
+      })
+    },
     // --------------------------------------
     // ??
     modalFormOk() {},

+ 156 - 16
src/views/packing-list/packinglist-clothes/clothesAddDrawer.vue

@@ -11,7 +11,7 @@
       <!-- 主表信息 填写-->
       <a-card :bordered="true">
         <div class="table-page-search-wrapper">
-          <a-form-model layout="inline" ref="form" :model="clothesAdd" :rules="validatorRules">
+          <a-form-model layout="inline" ref="formModel" :model="clothesAdd" :rules="validatorRules">
             <a-row :gutter="24">
               <a-col :md="6" :sm="8">
                 <a-form-model-item label="订单号" prop="orderNum">
@@ -250,7 +250,7 @@ import { JeecgListMixin } from '@/mixins/JeecgListMixin'
 import { JVXETypes } from '@/components/jeecg/JVxeTable'
 import JEllipsis from '@/components/jeecg/JEllipsis'
 import ReferencePrePacklist from '@views/packing-list/packinglist-clothes/referencePrePacklist'
-import { orderSpltListId } from '@api/document/packing-list/packinglist-clothes.js'
+import { orderSpltListId,addSpltList } from '@api/document/packing-list/packinglist-clothes.js'
 
 
 export default {
@@ -262,6 +262,11 @@ export default {
     let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
 
     return {
+
+      toolbarConfig: {
+          // add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
+          btn: []
+        },
       // 表头
       clothesAddColumns: [
         {
@@ -378,13 +383,13 @@ export default {
           title: '件数/箱',
           key: 'piecesBox',
           width: 120,
-          type: JVXETypes.inputNumber 
+          type: JVXETypes.normal 
         },
         {
           title: '箱数',
           key: 'boxNumber',
           width: 120,
-          type: JVXETypes.inputNumber 
+          type: JVXETypes.normal 
         },
 
         {
@@ -486,6 +491,7 @@ export default {
         // pageSize: 0
       },
       visible: false,
+      sizeFields:[], // 尺码字段
       confirmLoading: false,
       validatorRules: {
         orderNum: [{ required: true, message: '订单号不能为空', trigger: 'blur' }],
@@ -495,12 +501,21 @@ export default {
       }
       // dateFormat: 'YYYY-MM-DD'
     }
+  },
+   // 接收父组件查询方法
+  props: {
+    fatherList: {
+      type: Function,
+      default: null
+    }
   },
   created() {},
   mounted() {},
   methods: {
     // 参照回调
     referCallback(idArr){
+     this.clothesAdd = {}
+     this.clothesAddData = []
      var preId = idArr[0]
      orderSpltListId({id:preId}).then(res => {
           var data = res.result
@@ -529,16 +544,16 @@ export default {
 
     dynamicColumns(sizeTables){
        var newColumns = this.clothesAddColumns
-       var i = 0
-       for(;i < newColumns.length ; i++){
+        if (sizeTables != null){
+          var i = 0
+        for(;i < newColumns.length ; i++){
          if(newColumns[i].insertAfter){
            break;
          }
        }
-       console.log(sizeTables)
-       debugger
         // 插入数据
         for (var j=0;j<sizeTables.length;j++){
+          this.sizeFields.push('size-'+sizeTables[j].size);
           var field = {
               title: sizeTables[j].size,
               key: 'size-'+sizeTables[j].size,
@@ -547,7 +562,7 @@ export default {
               isSize:true,
           };
           newColumns.splice(i+1+j,0,field);
-          debugger
+        }
         }
         this.clothesAddColumns = newColumns
     },
@@ -606,6 +621,34 @@ export default {
     handleDelete(id) {
       console.log('id:', id)
     },
+
+     handleValueChange(event) {
+       var dataRow = event.row
+       console.log(dataRow)
+       if (dataRow.startingBoxNumber != undefined && dataRow.startingBoxNumber != "" &&
+        dataRow.endCaseNumber != undefined && dataRow.endCaseNumber != ""){
+          dataRow.boxNumber = dataRow.endCaseNumber*1-dataRow.startingBoxNumber*1+1;
+      }
+      var allSizeSum = this.getAllSizeSum(dataRow);
+      dataRow.piecesBox = allSizeSum
+      dataRow.total = dataRow.piecesBox*dataRow.boxNumber
+      if (dataRow.netWeight != "" && dataRow.netWeight != undefined){
+        dataRow.totalNetWeight = dataRow.netWeight * dataRow.boxNumber;
+      }
+      if (dataRow.grossWeight != "" && dataRow.grossWeight != undefined){
+        dataRow.totalGrossWeight = dataRow.grossWeight * dataRow.boxNumber;
+      }
+      if (dataRow.outerBoxLength != "" && dataRow.outerBoxLength != undefined &&
+      dataRow.outerBoxWidth != "" && dataRow.outerBoxWidth != undefined &&
+      dataRow.outerBoxHeight != "" && dataRow.outerBoxHeight != undefined){
+        dataRow.totalVolume = dataRow.outerBoxLength * dataRow.outerBoxWidth * dataRow.outerBoxHeight * dataRow.boxNumber
+       console.log(dataRow)
+      }
+      if (dataRow.unitPrice != undefined && dataRow.unitPrice != ""){
+        dataRow.totalPrice = dataRow.unitPrice*dataRow.total
+      }
+     },
+
     // 操作按钮 复制
     copy(record) {},
     // -------------------------------------
@@ -617,23 +660,120 @@ export default {
     },
     // 抽屉 提交
     submitAdd() {
-      console.log('保存新增、刷新发运明细列表')
-      const that = this
+      const that = this;
       // 触发表单验证
-      this.$refs.form.validate(valid => {
+      that.$refs.formModel.validate(valid => {
         if (valid) {
-          that.confirmLoading = true
+          if (this.sizeFields.length == 0){
+          this.$message.error('当前记录没有尺码字段,无法保存');
+          return;
+          }
+          // that.confirmLoading = true
+          var newObj = {}
+          newObj.itemNumber = this.clothesAdd.styleNum
+          newObj.orderNumber = this.clothesAdd.orderNum
+          newObj.productName = this.clothesAdd.name
+          newObj.sizeRange = this.clothesAdd.sizeRange
+          newObj.customer = this.clothesAdd.customer
+          newObj.containerCode = this.clothesAdd.containerCode
+          newObj.containerNumber = this.clothesAdd.containerNo
+          newObj.memo = this.clothesAdd.note
+          newObj.garmentFactory = this.clothesAdd.clothesFactory
+          newObj.exportInvoiceNo = this.clothesAdd.exportInvoiceNo
+          newObj.shippingOrderNumber = this.clothesAdd.bookNum
+          newObj.syPackingListTailoringItemList = this.clothesAddData
+          var sort = 0;
+          for (var i=0; i<newObj.syPackingListTailoringItemList.length;i++){
+             var tableRow = newObj.syPackingListTailoringItemList[i];
+             var allSizeSum = this.getAllSizeSum(tableRow);
+             if (allSizeSum == 0){
+               this.$message.error('第'+(i+1)+'行所有尺码数量为0,无法保存');
+               return;
+             }
+            if(tableRow.startingBoxNumber > tableRow.endCaseNumber) {
+              this.$message.error('第'+(i+1)+'行起始箱号大于结束箱号,无法保存');
+              return;
+            }
+            if (tableRow.startingBoxNumber == ""){
+              this.$message.error('第'+(i+1)+'行起始箱号未填,无法保存');
+              return;
+           }
+           if (tableRow.endCaseNumber == ""){
+               this.$message.error('第'+(i+1)+'行结束箱号未填,无法保存');
+                return;
+            }
+           if (tableRow.boxNumber == "" || tableRow.boxNumber == 0){
+              this.$message.error('第'+(i+1)+'行箱数,无法保存');
+              return;
+           }
+           if (tableRow.netWeight == null || tableRow.netWeight == "" || tableRow.netWeight == undefined){
+             this.$message.error('第'+(i+1)+'行净重/箱未填,无法保存');
+             return;
+           }
+           if (tableRow.piecesBox == null || tableRow.piecesBox == "" || tableRow.piecesBox == undefined){
+             this.$message.error('第'+(i+1)+'行件数/箱未填,无法保存');
+             return;
+           }
+          if (tableRow.grossWeight == null || tableRow.grossWeight == "" || tableRow.grossWeight == undefined){
+            this.$message.error('第'+(i+1)+'行毛重/箱未填,无法保存');
+             return;
+            } 
+          if (tableRow.outerBoxLength == null || tableRow.outerBoxLength == "" || tableRow.outerBoxLength == undefined){
+             this.$message.error('第'+(i+1)+'行外箱长度未填,无法保存');
+             return;
+           }
+          if (tableRow.outerBoxWidth == null || tableRow.outerBoxWidth == "" || tableRow.outerBoxWidth == undefined){
+            this.$message.error('第'+(i+1)+'行外箱宽度未填,无法保存');
+            return;
+          }
+          if (tableRow.outerBoxHeight == null || tableRow.outerBoxHeight == "" || tableRow.outerBoxHeight == undefined){
+            this.$message.error('第'+(i+1)+'行外箱高度未填,无法保存');
+            return;
+           }
+          if (tableRow.netWeightToo == null || tableRow.netWeightToo == "" || tableRow.netWeightToo == undefined){
+             this.$message.error('第'+(i+1)+'行净净重未填,无法保存');
+            return;
+          }
+          for (var j=0; j<tableRow.sizeTables.length; j++){
+           var sizeTable = tableRow.sizeTables[j];
+            var field = 'size-'+sizeTable.size;
+            tableRow.sizeTables[j].proportion = tableRow[field];
+         }
+         tableRow.sort = ++sort;
+      } 
+           addSpltList(newObj).then(res => {
+           if (res.success) {
+           this.$message.success('新增成功')
+           this.close()
+           //清空信息
+           newObj = {};
+           that.fatherList() // 调用父组件 查询方法
+        }else{
+          this.$message.error(res.message)
         }
       })
-      this.close()
-      // this.getShipmentList() // 刷新 装箱单-成衣列表
+        }
+      })
+    },
+
+    // 获取不同尺码数量之和
+    getAllSizeSum(record){
+      var ret = 0;
+      for (var i=0; i<this.sizeFields.length; i++){
+        if (record[this.sizeFields[i]] != undefined && record[this.sizeFields[i]] != ""){
+          ret += record[this.sizeFields[i]]*1;
+        }
+      }
+      return ret;
     },
 
     // -------------------------------------
     close() {
       this.$emit('close')
       this.visible = false
-      this.$refs.form.resetFields()
+      this.clothesAdd = {}
+      this.clothesAddData = []
+      // this.$refs.form.resetFields()
     },
     // - father------------------------------------
     aa() {},

+ 2 - 0
src/views/packing-list/packinglist-clothes/referencePrePacklist.vue

@@ -315,6 +315,8 @@ export default {
       } else if(this.selectedRowKeys.length == 1){
         this.$emit('callback', this.selectedRowKeys);
         this.referencePrePacklist = false;
+        var msg = "选中记录后,会清除编辑的内容。";
+        this.$message.info(msg);        
         this.selectedRowKeys = [];
       }else {
         this.$message.error('只能选择一行数据!');