From b0d73f4dfdc187141649e7edf04cba95337eab08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Fri, 15 Nov 2024 14:38:26 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E7=94=9F=E4=BA=A7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=87=87=E8=B4=AD=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E6=8C=89=E9=92=AE=E5=8F=8A=E5=85=B6=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=8E=BB=E9=99=A4=E5=A7=94=E5=86=85?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E6=8C=89=E9=92=AE,=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E6=A0=8F=E6=8C=89=E9=92=AE=EF=BC=9B=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=EF=BC=8C=E5=8E=BB=E9=99=A4=E5=88=97?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=EF=BC=8C=E5=90=88=E5=B9=B6=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=A0=8F=E6=8C=89=E9=92=AE=EF=BC=9B=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=85=A5=E5=BA=93=E5=8D=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=92=8C=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E9=99=A4=E5=A7=94=E5=86=85=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E8=A1=A8=E6=A0=BC=E6=9D=A5=E6=BA=90?= =?UTF-8?q?=E5=8F=8A=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0=EF=BC=8C=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=88=97=E5=B1=85=E4=B8=AD=E6=A0=B7=E5=BC=8F=EF=BC=9B?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E5=B7=A5=E7=A8=8B=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=B7=BB=E5=8A=A0=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E7=94=9F=E4=BA=A7bom=E6=8C=89=E9=92=AE=E5=8F=8A=E5=85=B6?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E3=80=81=E5=A4=84=E7=90=86=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8sessionStorage=E6=9A=82=E5=AD=98?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=8F=90=E4=BA=A4=E5=87=BD=E6=95=B0=EF=BC=9B?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=BB=B4=E6=8A=A4=E8=AE=BE=E5=A4=87=E5=B1=A5?= =?UTF-8?q?=E5=8E=86=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=BF=AE=E6=94=B9=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E6=9D=A5=E6=BA=90=E5=8F=8A=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=EF=BC=9B=20=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=B1=A5=E5=8E=86=E6=8C=89=E9=92=AE=E5=8F=8A?= =?UTF-8?q?=E5=85=B6=E5=9B=9E=E8=B0=83=E5=87=BD=E6=95=B0=EF=BC=8C=E5=A4=84?= =?UTF-8?q?=E7=90=86=E5=9B=9E=E6=98=BE=EF=BC=8C=E4=BD=BF=E7=94=A8sessionSt?= =?UTF-8?q?orage=E6=9A=82=E5=AD=98=E9=A1=B5=E9=9D=A2=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E5=87=BD=E6=95=B0=EF=BC=8C=E5=A4=84=E7=90=86=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE=E6=B7=BB=E5=8A=A0=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E5=B1=A5=E5=8E=86=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=A1=A8=E6=A0=BC=E5=AD=97=E6=AE=B5=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=B7=B2=E5=AE=8C=E6=88=90=E6=95=B0=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E8=A1=A8=E6=A0=BC=E5=86=85=E5=86=85?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98=E8=AE=B0=E5=BD=95=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E5=8F=8A=E5=AE=9E=E7=8E=B0=E6=96=B9=E6=B3=95=EF=BC=9B?= =?UTF-8?q?=20=E4=BF=AE=E6=94=B9=E7=94=9F=E4=BA=A7=E9=A2=86=E6=96=99?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E4=BD=BF=E7=94=A8sessionstorage?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=AD=90=E8=A1=A8=E9=A2=86=E6=96=99=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E6=A0=B9=E6=8D=AE=E9=A2=86=E6=96=99=E8=A7=84=E5=88=99?= =?UTF-8?q?=E9=99=90=E5=88=B6=E9=A2=86=E6=96=99=E6=95=B0=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=85=EF=BC=9B=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=9B=E5=BB=BA=E5=A7=94=E5=A4=96=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=AF=B9?= =?UTF-8?q?=E7=89=A9=E6=96=99=E5=8A=A0=E5=B7=A5=E6=96=B9=E5=BC=8F=E4=B8=BA?= =?UTF-8?q?=E5=A7=94=E5=A4=96=E6=88=96=E9=87=87=E8=B4=AD=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A7=94=E5=A4=96=E7=9A=84=E5=A4=84=E7=90=86?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/inboundOrder/inboundOrder.html | 27 +- .../erp/inboundOrder/inboundOrderDetail.html | 10 +- .../system/makeorder/addEquipmentResume.html | 337 ++++++++++++- .../system/makeorder/addOutsourcePlan.html | 89 +++- .../system/makeorder/addProduceInbound.html | 193 +++++-- .../templates/system/makeorder/addpick.html | 179 ++++++- .../templates/system/makeorder/detail.html | 54 +- .../templates/system/makeorder/gcsh.html | 471 +++++++++++------- .../templates/system/makeorder/makeorder.html | 29 +- .../system/makeorderpick/detail.html | 188 ++----- .../system/makeorderpick/makeorderpick.html | 6 +- 11 files changed, 1113 insertions(+), 470 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html index 0124655d..b6ece4df 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html +++ b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrder.html @@ -125,18 +125,19 @@ return $.table.selectDictLabel(qualityStorageStatusDatas, value); } }, - { - title: '委内加工费总价', - field: 'makeInTotalPrice', - footerFormatter: function (value) { - const total = value.reduce((accumulator, currentValue) => { - // 直接访问makeInTotalPrice,如果它是null或undefined,则使用0 - const makeInTotalPrice = currentValue.makeInTotalPrice || 0; - return accumulator + parseFloat(makeInTotalPrice); - }, 0); - return total; - } - }, + // { + // title: '委内加工费总价', + // field: 'makeInTotalPrice', + // visible: false, + // footerFormatter: function (value) { + // const total = value.reduce((accumulator, currentValue) => { + // // 直接访问makeInTotalPrice,如果它是null或undefined,则使用0 + // const makeInTotalPrice = currentValue.makeInTotalPrice || 0; + // return accumulator + parseFloat(makeInTotalPrice); + // }, 0); + // return total; + // } + // }, // { @@ -207,7 +208,7 @@ //详情 function inboundOrderDetail(qualityOrderId){ var url = prefix +'/inboundOrderDetail/' + qualityOrderId; - $.modal.open("委内入库单详情",url) + $.modal.open("生产入库单详情",url) } diff --git a/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrderDetail.html b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrderDetail.html index f26a257f..65e2f6dc 100644 --- a/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrderDetail.html +++ b/ruoyi-admin/src/main/resources/templates/erp/inboundOrder/inboundOrderDetail.html @@ -1,7 +1,7 @@ - + @@ -168,10 +168,10 @@ title: '物料加工方式', field: 'materialProcessMethod', }, - { - title: '委内已完成数', - field: 'makeInNum', - }, + // { + // title: '委内已完成数', + // field: 'makeInNum', + // }, { title: '品质已合格数', field: 'qualityHasqualifiedNum', diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html index b00778cf..7767d645 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addEquipmentResume.html @@ -2,12 +2,15 @@ + + +
- +
@@ -39,7 +42,7 @@
- +
@@ -126,16 +129,29 @@
+ +
+

已完成数

+
+ +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addOutsourcePlan.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addOutsourcePlan.html index 5d9cf8b2..fe0cc1a4 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addOutsourcePlan.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addOutsourcePlan.html @@ -35,8 +35,8 @@ -
-
+
+
@@ -62,8 +62,9 @@ // var subTableFormArray = []; $(function(){ + sessionStorage.clear(); var options = { - url: ctx + "system/orderChild/list", + url: ctx + "system/makeorderbom/list", id: 'bootstrap-sub-table-1', showSearch: false, showRefresh: false, @@ -94,7 +95,7 @@ visible: false }, { - field: 'materialCode', + field: 'materialNo', align: 'center', title: '料号' }, @@ -143,7 +144,7 @@ title: '客户期望交付时间' }, { - field: 'materialNum', + field: 'orderNum', align: 'center', title: '订单数量' }, @@ -176,7 +177,7 @@ queryParams : { makeNo: $("#makeNo").val(), salesOrderCode: $("#saleNo").val(), - salesOrderMaterialNo: parentRow.materialCode + salesOrderMaterialNo: parentRow.materialNo }, columns: [{ field: 'id', @@ -186,6 +187,7 @@ { field: 'level', title: '阶层', + align: 'center', formatter: function(value, row, index) { return $.table.selectDictLabel(levelDatas, value); } @@ -193,6 +195,7 @@ { field: 'bomNo', title: 'BOM号', + align: 'center', formatter:function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -203,6 +206,7 @@ }, { field: 'materialNo', + align: 'center', title: '料号', formatter: function (value,row,index){ var curIndex = row.sortNo-1; @@ -211,6 +215,7 @@ }, { field: 'photoUrl', + align: 'center', title: '图片', formatter: function(value, row, index) { return $.table.imageView(value); @@ -218,6 +223,7 @@ }, { field: 'materialName', + align: 'center', title: '物料名称', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -229,13 +235,20 @@ }, { field: 'materialType', + align: 'center', title: '物料类型', formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + align: 'center', + title: '型号', + }, { field: 'describe', + align: 'center', title: '描述', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -247,6 +260,7 @@ }, { field: 'brand', + align: 'center', title: '品牌', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -258,6 +272,7 @@ }, { field: 'unit', + align: 'center', title: '单位', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -273,7 +288,7 @@ align: 'center', formatter: function(value, row, index) { var label = $.table.selectDictLabel(processMethodDatas, value); - if (value === '2') { + if (value === '2'||value === '4') { var button = '委外工序(' + row.processNum + ')'; return label + ' ' + button; } else { @@ -283,6 +298,7 @@ }, { field: 'useNum', + align: 'center', title: '用量', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -294,6 +310,7 @@ }, { field: 'lossRate', + align: 'center', title: '损耗率', }, { @@ -302,24 +319,28 @@ visible: false, }, { - field: 'materialNum', + field: 'orderNum', + align: 'center', title: '订单用量', formatter: function (value,row,index){ - return parentRow.materialNum * row.useNum; + return parentRow.orderNum * row.useNum; } }, { field: 'hasOutNum', + align: 'center', title: '已委外数量', }, { field: 'outsourceNum', + align: 'center', title: '本次委外数量', formatter: function (value,row,index){ var processMethod = row.processMethod; - if(processMethod === "2"){ + //加工方式为2委外加工或4委外加工或采购 + if(processMethod === "2"||processMethod === "4"){ var curIndex = row.sortNo-1; - return ''; + return ''; } return " "; } @@ -346,22 +367,26 @@ }], // 当所有数据被加载时触发 onLoadSuccess: function(data) { - + var childRows = data.rows; + childRows.forEach(function (materialData){ + var materialNo = materialData.materialNo; + var key = childTableId + '_' + materialNo + '_outNum'; + var outNum = sessionStorage.getItem(key); + if (outNum) { + $("#outsourceNum_"+childTableId+'_'+materialNo).val(outNum); + } + }) }, }); }; function queryParams(params) { var curParams = { - // 传递参数查询参数 - // pageSize: params.limit, - // pageNum: params.offset / params.limit + 1, - // searchValue: params.search, - // orderByColumn: params.sort, - // isAsc: params.order + }; // 额外传参 - curParams.quoteId = $("#saleNo").val(); + curParams.makeNo = $("#makeNo").val(); + curParams.level = 0; return curParams; } @@ -369,6 +394,24 @@ focusCleanup: true }); + function saveOutNum(materialNo,childid,event){ + var outNum = event.target.value; + if (isNaN(outNum)) { + $.modal.msgError('请输入有效的数字'); + return; + } + if (outNum < 0) { + $.modal.msgError('委外数必须大于0'); + return; + } + if (outNum % 1 !== 0) { + $.modal.msgError('委外数不能为小数'); + return; + } + var key = childid + '_' + materialNo + '_outNum'; + sessionStorage.setItem(key,outNum); + } + function submitHandler() { var makeNo = $("#makeNo").val(); var sales = $("input[name='Salesman']").val(); @@ -380,9 +423,11 @@ var hasValue = false; childTableIdList.forEach(function (tableId,index){ var processDatas = $("#" + tableId).bootstrapTable('getData'); - processDatas.forEach(function (data,i){ - if(data.processNum != 0 && data.processMethod === "2"){ - var outNum = $('#' + tableId ).find('input[name="outsourceNum_'+i+'"]').val(); + processDatas.forEach(function (data){ + if(data.processNum != 0 && (data.processMethod == "2"||data.processMethod == "4")){ + var key = tableId + '_' + data.materialNo + '_outNum'; + var outNum = sessionStorage.getItem(key); + if(outNum === null||outNum === ""){ return; } diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html index c6c12058..57775430 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addProduceInbound.html @@ -59,12 +59,13 @@ var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; var levelDatas = [[${@dict.getType('bomLevel')}]]; var processMethodDatas = [[${@dict.getType('processMethod')}]]; + var equipmentResumeList = {} // var subTableFormArray = []; $(function(){ var options = { - url: ctx + "system/orderChild/list", + url: ctx + "system/makeorderbom/list", id: 'bootstrap-sub-table-1', showSearch: false, showRefresh: false, @@ -101,7 +102,7 @@ visible: false }, { - field: 'materialCode', + field: 'materialNo', align: 'center', title: '料号', // formatter: function (value,row,index){ @@ -122,6 +123,11 @@ return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + align: 'center', + title: '型号', + }, { field: 'unit', align: 'center', @@ -154,20 +160,34 @@ title: '客户期望交付时间' }, { - field: 'materialNum', + field: 'orderNum', align: 'center', title: '订单数量' }, { - field: 'completedNum', + field: 'finishNum', align: 'center', - title: '已完成数' + title: '已完成数', + formatter: function(value, row, index) { + if(!value){ + return 0; + }else{ + return value; + } + } + }, + { + field: 'currentNum', + align: 'center', + title: '本次完成数', + formatter: function(value, row, index) { + if (row.materialType != 'chcpsb') { + return ''; + } else { + return value?value:0; + } + } }, - { - field: 'currentNum', - title: '本次完成数', - editable:true - }, { title: '操作', align: 'center', @@ -175,9 +195,8 @@ var actions = []; // 物料类型是成品,添加设备履历表 if(row.materialType == 'chcpsb'){ - actions.push('添加设备履历 '); + actions.push('添加设备履历 '); } - return actions.join(''); } } @@ -202,7 +221,7 @@ queryParams : { makeNo: $("#makeNo").val(), salesOrderCode: $("#saleNo").val(), - salesOrderMaterialNo: parentRow.materialCode + salesOrderMaterialNo: parentRow.materialNo }, columns: [{ field: 'id', @@ -211,6 +230,7 @@ }, { field: 'level', + align: 'center', title: '阶层', formatter: function(value, row, index) { return $.table.selectDictLabel(levelDatas, value); @@ -218,21 +238,24 @@ }, { field: 'bomNo', + align: 'center', title: 'BOM号', formatter:function (value,row,index){ if (value == null || value == ''){ return '/'; }else{ - return value + return value; } } }, { field: 'materialNo', + align: 'center', title: '料号' }, { field: 'photoUrl', + align: 'center', title: '图片', formatter: function(value, row, index) { return $.table.imageView(value); @@ -240,6 +263,7 @@ }, { field: 'materialName', + align: 'center', title: '物料名称', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -251,13 +275,20 @@ }, { field: 'materialType', + align: 'center', title: '物料类型', formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + align: 'center', + title: '型号', + }, { field: 'describe', + align: 'center', title: '描述', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -269,6 +300,7 @@ }, { field: 'brand', + align: 'center', title: '品牌', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -280,6 +312,7 @@ }, { field: 'unit', + align: 'center', title: '单位', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -292,13 +325,15 @@ { field: 'processMethod', - title: '半成品类型', + align: 'center', + title: '加工方式', formatter: function(value, row, index) { return $.table.selectDictLabel(processMethodDatas, value); } }, { field: 'useNum', + align: 'center', title: '用量', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -310,13 +345,15 @@ }, { field: 'lossRate', + align: 'center', title: '损耗率', }, { field: 'materialNum', + align: 'center', title: '订单用量', formatter: function (value,row,index){ - return parentRow.materialNum * row.useNum; + return parentRow.orderNum * row.useNum; } }, { @@ -348,21 +385,93 @@ function queryParams(params) { var curParams = { - // 传递参数查询参数 - // pageSize: params.limit, - // pageNum: params.offset / params.limit + 1, - // searchValue: params.search, - // orderByColumn: params.sort, - // isAsc: params.order + }; // 额外传参 - curParams.quoteId = $("#saleNo").val(); + curParams.makeNo = $("#makeNo").val(); + curParams.level = 0; return curParams; } - function addEquipmentResume(curIndex,materialCode){ - var url = prefix + "/addEquipmentResume?makeNo="+$("#makeNo").val()+"&saleNo="+$("#saleNo").val()+"&materialNo="+materialCode+"&curIndex="+curIndex; - $.modal.open("设备履历表",url); + function addEquipmentResume(curIndex,materialNo){ + var url = prefix + "/addEquipmentResume?makeNo="+$("#makeNo").val()+"&saleNo="+$("#saleNo").val()+"&materialNo="+materialNo+"&curIndex="+curIndex; + var options = { + title: '添加设备履历', + url: url, + callBack: doSubmit + }; + $.modal.openOptions(options); + } + + function doSubmit(index, layero){ + var iframeWin = window[layero.find('iframe')[0]['name']]; + // 获取表单数据 + const equipMaterialData = iframeWin.$("#form-equipMaterial-add").serializeArray().reduce((obj, item) => { + obj[item.name] = item.value; + return obj; + }, {}); + var curIndex = iframeWin.$("#curIndex").val(); + const selectedRows = iframeWin.$("#form-equipMaterialDetail-add").bootstrapTable('getSelections'); + if (selectedRows.length===0){ + $.modal.alertWarning("请至少选择一条数据后再保存!"); + return; + } + var equipDetailDataList = selectedRows.map(function(item) { + return { + "equipmentId": item.equipmentId, + "equipmentModel": item.equipmentModel, + "serialNo": item.serialNo, + "producePic": item.producePic, + "startMakeTime": item.startMakeTime, + "endMakeTime": item.endMakeTime, + "addProcessIssueRecordFlag": item.addProcessIssueRecordFlag, + // ...其他字段 + }; + }); + + // 合并表单数据和表格数据 + const combinedData = Object.assign({}, equipMaterialData, { sysEquipDetailDtos: equipDetailDataList }); + const jsonData = JSON.stringify(combinedData); + saveEquipment(curIndex,jsonData); + layer.close(index); + } + + + // 保存设备履历信息 刷新表格 + function saveEquipment(curIndex,data) { + var config = { + url: prefix + "/addEquipmentResumeSave", + type: "post", + dataType: "json", + contentType: "application/json;charset=utf-8", + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍后..."); + $.modal.disable(); + }, + success: function(result) { + $.modal.closeLoading(); + $.modal.enable(); + console.log(result); + groupByMaterialNo(curIndex,result.data); + } + }; + $.ajax(config) + }; + + function groupByMaterialNo(curIndex,data) { + var materialNo = data[0].materialNo; + equipmentResumeList[materialNo] = []; + data.forEach(item => { + equipmentResumeList[materialNo].push(item); + }); + var newRowData = { + currentNum: data.length, + } + $("#bootstrap-sub-table-1").bootstrapTable('updateRow', { + index: curIndex, + row: newRowData + }); } $("#form-makeorder-edit").validate({ @@ -388,12 +497,31 @@ }, {}); // 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 var table = $('#bootstrap-sub-table-1').bootstrapTable('getData'); - //获取选中复选框行的数据 + var hasValue = false; + var tableData = []; + table.forEach(function(row, index) { + if (row.materialType != 'chcpsb') { + var currentInput = $('#'+row.materialNo).val(); + if(currentInput!=''&¤tInput!=undefined&¤tInput!=null&¤tInput!=0){ + row.currentNum = currentInput; + tableData.push(row); + hasValue = true; + } + }else if(row.currentNum!=0){ + tableData.push(row); + hasValue = true; + } + }); + console.log(tableData); + if(!hasValue){ + $.model.msgError("至少添加一条有效入库物料!"); + return; + } // 将表数据转换成与complaintNoticeData格式一致的数组 - var materialDataList = table.map(function(item) { + var materialDataList = tableData.map(function(item) { // 根据实际字段名调整 return { - "materialNo":item.materialCode, + "materialNo":item.materialNo, "materialName": item.materialName, "unit": item.unit, "brand": item.brand, @@ -402,23 +530,20 @@ "deliveryTime":item.deliveryTime, "materialNum":item.materialNum, "currentNum": item.currentNum, - "completedNum": item.completedNum, - + "completedNum": item.finishNum, + "salesShippingDeviceList": equipmentResumeList[item.materialNo], // ...其他字段 }; }); - // 合并表单数据和表格数据 const combinedData = Object.assign({}, makeorderData, { inboundDetails: materialDataList }); - console.log(combinedData) // 使用 JSON.stringify() 序列化数据 const jsonData = JSON.stringify(combinedData); // 发送 AJAX 请求到后端接口 $.operate.saveJson(prefix + "/addProduceInboundSave", jsonData); } - \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html index 7040af1d..ce6c3bb8 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/addpick.html @@ -68,8 +68,9 @@ // var subTableFormArray = []; $(function(){ + sessionStorage.clear(); var options = { - url: ctx + "system/orderChild/list", + url: ctx + "system/makeorderbom/list", id: 'bootstrap-sub-table-1', showSearch: false, showRefresh: false, @@ -106,7 +107,7 @@ visible: false }, { - field: 'materialCode', + field: 'materialNo', align: 'center', title: '料号' }, @@ -123,6 +124,10 @@ return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + title: '型号', + }, { field: 'unit', align: 'center', @@ -155,7 +160,7 @@ title: '客户期望交付时间' }, { - field: 'materialNum', + field: 'orderNum', align: 'center', title: '订单数量' }, @@ -186,7 +191,7 @@ queryParams : { makeNo: $("#makeNo").val(), salesOrderCode: $("#saleNo").val(), - salesOrderMaterialNo: parentRow.materialCode + salesOrderMaterialNo: parentRow.materialNo }, columns: [{ field: 'id', @@ -196,6 +201,7 @@ { field: 'level', title: '阶层', + align: 'center', formatter: function(value, row, index) { return $.table.selectDictLabel(levelDatas, value); } @@ -203,6 +209,8 @@ { field: 'bomNo', title: 'BOM号', + align: 'center', + visible: false, formatter:function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -214,14 +222,17 @@ { field: 'materialNo', title: '料号', - formatter: function (value,row,index){ - var curIndex = row.sortNo-1; - return ''; - } + align: 'center', + // formatter: function (value,row,index){ + // var curIndex = row.sortNo-1; + // return '' + value + '' + + // ''; + // } }, { field: 'photoUrl', title: '图片', + align: 'center', formatter: function(value, row, index) { return $.table.imageView(value); } @@ -229,6 +240,7 @@ { field: 'materialName', title: '物料名称', + align: 'center', formatter: function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -240,13 +252,20 @@ { field: 'materialType', title: '物料类型', + align: 'center', formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + title: '型号', + align: 'center', + }, { field: 'describe', title: '描述', + align: 'center', formatter: function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -258,6 +277,7 @@ { field: 'brand', title: '品牌', + align: 'center', formatter: function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -269,6 +289,7 @@ { field: 'unit', title: '单位', + align: 'center', formatter: function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -280,7 +301,8 @@ { field: 'processMethod', - title: '半成品类型', + title: '加工方式', + align: 'center', formatter: function(value, row, index) { return $.table.selectDictLabel(processMethodDatas, value); } @@ -288,6 +310,7 @@ { field: 'useNum', title: '用量', + align: 'center', formatter: function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -299,29 +322,36 @@ { field: 'lossRate', title: '损耗率', + align: 'center', }, { field: 'orderNum', title: '订单用量', + align: 'center', formatter: function (value,row,index){ - return parentRow.materialNum * row.useNum; + return parentRow.orderNum * row.useNum; } }, { field: 'storageNum', title: '可用库存数', + align: 'center', }, { field: 'hasPickNum', - title: '已领料数量', + title: '已领料数', + align: 'center', }, { field: 'pickNum', - title: '本次领料数量', + title: '本次领料数', + align: 'center', formatter: function (value,row,index){ var curIndex = row.sortNo-1; - var inputValue = parentRow.materialNum * row.useNum; - return ''; + var inputValue = parentRow.orderNum * row.useNum; + inputValue = inputValue - row.hasPickNum;//订单用量 - 已领料数 + inputValue = inputValue > row.storageNum? row.storageNum:inputValue; + return ''; } }, { @@ -346,32 +376,133 @@ }], // 当所有数据被加载时触发 onLoadSuccess: function(data) { - + var childRows = data.rows; + if(childRows[0].orderNum == 0||childRows[0].orderNum == null){ + childRows.forEach(function(row) { + row.orderNum = parentRow.orderNum * row.useNum; + }); + } + childRows.forEach(function (materialData){ + var key = childTableId + '_' + materialData.materialNo; + var curIndex = materialData.sortNo -1; + var pick = sessionStorage.getItem(key); + if (pick) { + var pickDetail = JSON.parse(pick); + $("#"+childTableId+curIndex).val(pickDetail.pickNum); + }else{ + sessionStorage.setItem(key,JSON.stringify(materialData)); + } + }) }, }); }; function queryParams(params) { var curParams = { - // 传递参数查询参数 - // pageSize: params.limit, - // pageNum: params.offset / params.limit + 1, - // searchValue: params.search, - // orderByColumn: params.sort, - // isAsc: params.order + }; // 额外传参 - curParams.quoteId = $("#saleNo").val(); + curParams.makeNo = $("#makeNo").val(); + curParams.level = 0; return curParams; } + function savePickNum(materialNo,processMethod,sortNo,childid,event){ + var pickNum = event.target.value; + if (isNaN(pickNum)) { + $.modal.msgError('请输入有效的数字'); + return; + } + if (pickNum < 0) { + $.modal.msgError('领料数必须大于0'); + return; + } + if (pickNum % 1 !== 0) { + $.modal.msgError('领料数不能为小数'); + return; + } + var key = childid +'_'+ materialNo; + updateSessionKey(key,pickNum); + + // 生产装配类型物料 + if(processMethod == 3){ + var childData = $("#"+childid).bootstrapTable("getData"); + var storageNum = childData[sortNo].storageNum; + var level = Number(childData[sortNo].level)+1; + + //领料数大于库存数 + if(pickNum > storageNum){ + //子阶需要领料数(2阶,领料数-现有库存数(不足数量)) + var childPickNum = pickNum - storageNum; + //重新设置生产装配物料领料数(1阶,现有库存数) + updateSessionKey(key,storageNum); + $("#"+childid+sortNo).val(storageNum); + for(var i= (sortNo+1); i < childData.length; i++){ + if(childData[i].level==level){ + $("#"+childid+i).val(childPickNum); + var key = childid + '_' + childData[i].materialNo; + updateSessionKey(key,childPickNum); + } + } + }else{ + $("#"+childid+sortNo).val(pickNum); + for(var i= (sortNo+1); i < childData.length; i++){ + if(childData[i].level==level){ + $("#"+childid+i).val(0); + var key = childid + '_' + childData[i].materialNo; + updateSessionKey(key,0); + } + } + } + } + } + + function updateSessionKey(key,pickNum){ + var material = sessionStorage.getItem(key); + if(material){ + var materialDatas = JSON.parse(material); + materialDatas.pickNum = pickNum; + sessionStorage.setItem(key,JSON.stringify(materialDatas)); + } + } + $("#form-makeorder-edit").validate({ focusCleanup: true }); function submitHandler() { - var data = $("#form-makeorder-edit").serializeArray(); - $.operate.save(ctx + "system/makeorderpick/add", data); + var makeNo = $("#makeNo").val(); + var data = { + makeNo: makeNo, + saleNo: $("#saleNo").val(), + Salesman: $("input[name='Salesman']").val(), + }; + var pickDetails = []; + const length = sessionStorage.length; + if(length<=0){ + $.modal.msgError("至少添加一条有效领料数据!"); + return; + } + var allDisable = 0; + for (let i = 0; i < length; i++) { + const key = sessionStorage.key(i); + var rows = sessionStorage.getItem(key); + if(rows){ + var rowData = JSON.parse(rows); + if(rowData.pickNum>0){ + allDisable = 1; + rowData.makeorderBomId = rowData.id; + pickDetails.push(rowData); + } + } + } + if(allDisable === 0){ + $.modal.msgError("至少添加一条有效领料数据!"); + return; + } + data.pickDetails = pickDetails; + console.log(data); + $.operate.saveJson(ctx + "system/makeorderpick/ad", JSON.stringify(data)); } diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html index 48d68152..17232d72 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/detail.html @@ -64,7 +64,7 @@ $(function(){ var options = { - url: ctx + "system/orderChild/list", + url: ctx + "system/makeorderbom/list", id: 'bootstrap-sub-table-1', showSearch: false, showRefresh: false, @@ -78,12 +78,6 @@ onExpandRow : function(index, row, $detail) { initChildTable(index, row, $detail); }, - /*onCollapseRow: function(index, row){ - var childTableFormId = 'child_table_form_'+index; - var formData = $('#'+childTableFormId).serialize(); - var formObj = $.common.formDataToObj(formData); - subTableFormArray.push(formObj); - },*/ columns: [ { field: 'id', @@ -101,7 +95,7 @@ visible: false }, { - field: 'materialCode', + field: 'materialNo', align: 'center', title: '料号' }, @@ -131,6 +125,11 @@ align: 'center', title: '品牌' }, + { + field: 'materialModel', + align: 'center', + title: '型号' + }, { field: 'describe', align: 'center', @@ -150,7 +149,7 @@ title: '客户期望交付时间' }, { - field: 'materialNum', + field: 'orderNum', align: 'center', title: '订单数量' } @@ -160,6 +159,7 @@ }) initChildTable = function(index, row, $detail) { + var makeNo = $("#makeNo").val(); var parentRow = row; var parentRowIndex = index; var childTableId = 'child_table_'+index; @@ -169,12 +169,13 @@ $detail.html('
'); // BOM展示 $('#'+childTableId).bootstrapTable({ - url: ctx + "erp/bom/allLevelList", + url: ctx + "system/makeorderbom/list", method: 'post', sidePagination: "server", contentType: "application/x-www-form-urlencoded", queryParams : { - parentId: parentRow.bomId + salesOrderMaterialNo: parentRow.materialNo, + makeNo: makeNo, }, columns: [{ field: 'id', @@ -183,6 +184,7 @@ }, { field: 'level', + align: 'center', title: '阶层', formatter: function(value, row, index) { return $.table.selectDictLabel(levelDatas, value); @@ -190,6 +192,7 @@ }, { field: 'bomNo', + align: 'center', title: 'BOM号', formatter:function (value,row,index){ if (value == null || value == ''){ @@ -201,6 +204,7 @@ }, { field: 'materialNo', + align: 'center', title: '料号', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -212,6 +216,7 @@ }, { field: 'photoUrl', + align: 'center', title: '图片', formatter: function(value, row, index) { return $.table.imageView(value); @@ -219,6 +224,7 @@ }, { field: 'materialName', + align: 'center', title: '物料名称', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -230,13 +236,20 @@ }, { field: 'materialType', + align: 'center', title: '物料类型', formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + align: 'center', + title: '型号' + }, { field: 'describe', + align: 'center', title: '描述', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -248,6 +261,7 @@ }, { field: 'brand', + align: 'center', title: '品牌', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -259,6 +273,7 @@ }, { field: 'unit', + align: 'center', title: '单位', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -268,9 +283,9 @@ } } }, - { field: 'processMethod', + align: 'center', title: '半成品类型', formatter: function(value, row, index) { return $.table.selectDictLabel(processMethodDatas, value); @@ -278,6 +293,7 @@ }, { field: 'useNum', + align: 'center', title: '用量', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -289,6 +305,7 @@ }, { field: 'lossRate', + align: 'center', title: '损耗率', // formatter: function (value,row,index){ // if (value == null || value == ''){ @@ -300,9 +317,10 @@ }, { field: 'materialNum', + align: 'center', title: '订单用量', formatter: function (value,row,index){ - return parentRow.materialNum * row.useNum; + return parentRow.orderNum * row.useNum; } }, { @@ -472,15 +490,11 @@ function queryParams(params) { var curParams = { - // 传递参数查询参数 - // pageSize: params.limit, - // pageNum: params.offset / params.limit + 1, - // searchValue: params.search, - // orderByColumn: params.sort, - // isAsc: params.order + }; // 额外传参 - curParams.quoteId = $("#saleNo").val(); + curParams.makeNo = $("#makeNo").val(); + curParams.level = 0; return curParams; } diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html index 182e92c8..35094dc8 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/gcsh.html @@ -60,12 +60,15 @@ var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; var levelDatas = [[${@dict.getType('bomLevel')}]]; var processMethodDatas = [[${@dict.getType('processMethod')}]]; + var makeNo = [[${sysMakeOrder.makeNo}]]; + var makeOrderBom = {}; // var subTableFormArray = []; $(function(){ + sessionStorage.clear(); var options = { - url: ctx + "system/orderChild/list", + url: ctx + "system/makeorderbom/selectedList", id: 'bootstrap-sub-table-1', showSearch: false, showRefresh: false, @@ -102,7 +105,7 @@ visible: false }, { - field: 'materialCode', + field: 'materialNo', align: 'center', title: '料号' }, @@ -132,6 +135,11 @@ align: 'center', title: '品牌' }, + { + field: 'materialModel', + align: 'center', + title: '型号' + }, { field: 'describe', align: 'center', @@ -140,7 +148,7 @@ { field: 'processMethod', align: 'center', - title: '半成品类型', + title: '加工方式', formatter: function(value, row, index) { return $.table.selectDictLabel(processMethodDatas, value); } @@ -151,7 +159,7 @@ title: '客户期望交付时间' }, { - field: 'materialNum', + field: 'orderNum', align: 'center', title: '订单数量' }, @@ -166,7 +174,16 @@ align: 'center', title: '审核状态', visible: false - } + }, + { + title: '操作', + align: 'center', + formatter: function(value, row, index) { + var actions = []; + actions.push('编辑生产bom '); + return actions.join(''); + } + }, ] }; $.table.init(options); @@ -182,15 +199,13 @@ $detail.html('
'); // BOM展示 $('#'+childTableId).bootstrapTable({ - url: ctx + "erp/bom/otherOrderAllLevelList", + url: ctx + "system/makeorderbom/list", method: 'post', sidePagination: "server", contentType: "application/x-www-form-urlencoded", queryParams : { - parentId: parentRow.bomId, - useStatus:parentRow.useStatus, - auditStatus:parentRow.auditStatus, - // materialNo: parentRow.materialCode + salesOrderMaterialNo: parentRow.materialNo, + makeNo: makeNo, }, columns: [{ field: 'id', @@ -200,12 +215,14 @@ { field: 'level', title: '阶层', + align: 'center', formatter: function(value, row, index) { return $.table.selectDictLabel(levelDatas, value); } }, { field: 'bomNo', + align: 'center', title: 'BOM号', formatter:function (value,row,index){ if (value == null || value == ''){ @@ -217,6 +234,7 @@ }, { field: 'materialNo', + align: 'center', title: '料号', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -228,6 +246,7 @@ }, { field: 'photoUrl', + align: 'center', title: '图片', formatter: function(value, row, index) { return $.table.imageView(value); @@ -235,6 +254,7 @@ }, { field: 'materialName', + align: 'center', title: '物料名称', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -246,13 +266,20 @@ }, { field: 'materialType', + align: 'center', title: '物料类型', formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + align: 'center', + title: '型号' + }, { field: 'describe', + align: 'center', title: '描述', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -264,6 +291,7 @@ }, { field: 'brand', + align: 'center', title: '品牌', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -275,6 +303,7 @@ }, { field: 'unit', + align: 'center', title: '单位', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -287,13 +316,15 @@ { field: 'processMethod', - title: '半成品类型', + align: 'center', + title: '加工方式', formatter: function(value, row, index) { return $.table.selectDictLabel(processMethodDatas, value); } }, { field: 'useNum', + align: 'center', title: '用量', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -305,6 +336,7 @@ }, { field: 'lossRate', + align: 'center', title: '损耗率', // formatter: function (value,row,index){ // if (value == null || value == ''){ @@ -316,9 +348,10 @@ }, { field: 'materialNum', + align: 'center', title: '订单用量', formatter: function (value,row,index){ - return parentRow.materialNum * row.useNum; + return parentRow.orderNum * row.useNum; } }, { @@ -333,170 +366,171 @@ }], // 当所有数据被加载时触发 onLoadSuccess: function(data) { - - }, - }); - // 预审部门展示 - $('#'+childFormTableId).bootstrapTable({ - url: ctx + "system/makeorderdept/list", - method: 'post', - sidePagination: "server", - contentType: "application/x-www-form-urlencoded", - queryParams : { - makeNo: $("#makeNo").val(), - materialNo: parentRow.materialCode - }, - columns: [ - { - field : 'id', - title : '生产订单部门ID', - formatter: function (value, row, index) { - var curIndex = parentRowIndex*6+index; - return ''; - } - }, - { - field : 'makeNo', - title : '生产订单号', - visible: false, - formatter: function (value, row, index) { - var curIndex = parentRowIndex*6+index; - return ''; - } - }, - { - field : 'materialNo', - title : '料号', - visible: false, - formatter: function (value, row, index) { - var curIndex = parentRowIndex*6+index; - return ''; - } - }, - { - field : 'deptName', - title : '部门名称', - visible: false - }, - { - field : 'planFinishDays', - title : '计划完成天数', - visible: false - }, - { - field : 'actualFinishStartTime', - title : '实际完成开始时间', - visible: false - }, - { - field : 'actualFinishEndTime', - title : '实际完成结束时间', - visible: false - }, - { - field : 'deptNumber', - title : '部门', - formatter: function (value, row, index) { - /*if(subTableFormArray[parentRowIndex]){ - value = subTableFormArray[parentRowIndex].deptName?subTableFormArray[parentRowIndex].deptName:value; - }*/ - var curIndex = parentRowIndex*6+index; - return ''; - } - }, - { - field: 'planFinishDate', - title: '计划完成时间', - formatter: function(value, row, index) { - var curIndex = parentRowIndex*6+index; - var endDateName = 'planFinishEndDate_'+parentRowIndex; - var startDateName = 'planFinishStartDate_'+parentRowIndex; - var html; - // 业务部门 - if(row.deptNumber=='GMD'){ - html = '
' + - '\n' + - '-\n' + - '
' - }else{ - html = ''; - } - return html; - } - }, - { - field : 'deptLeaderConfirmStatus', - title : '部门主管确认', - formatter: function(value, row, index) { - var curIndex = parentRowIndex*6+index; - var html = ''; - return html; - } - }, - { - field: 'actualFinishTime', - title: '实际完成时间', - formatter: function(value, row, index) { - if (row.actualFinishStartTime == null || row.actualFinishStartTime == ''){ - return ''; - }else if(row.actualFinishStartTime){ - return row.actualFinishStartTime - }else if(row.actualFinishStartTime && row.actualFinishEndTime){ - return row.actualFinishStartTime + '-' + row.actualFinishEndTime - } - } - } - ], - // 当所有数据被加载时触发 - onLoadSuccess: function(data) { - for (let i = 0; i < data.rows.length; i++) { - var curIndex = parentRowIndex*6+i; - var startDateIndex = 'planFinishStartDate_'+i; - var endDateIndex = 'planFinishEndDate_'+i; - - $('[data-id="'+startDateIndex+'"]').datetimepicker({ - format: 'yyyy-mm-dd', - minView: "month", - todayBtn: true, - autoclose: true, - }).on('changeDate', function(event) { - event.preventDefault(); - event.stopPropagation(); - var startTime = event.date; - $('[data-id="'+endDateIndex+'"]').datetimepicker('setStartDate', startTime); - }); - $('[data-id="'+endDateIndex+'"]').datetimepicker({ - format: 'yyyy-mm-dd', - minView: "month", - todayBtn: true, - autoclose: true, - }).on('changeDate', function(event) { - event.preventDefault(); - event.stopPropagation(); - var endTime = event.date; - $('[data-id="'+startDateIndex+'"]').datetimepicker('setEndDate', endTime); - }); - + var key = "all_level_" + childTableId; + var rowData = sessionStorage.getItem(key); + if(rowData){ + var tableData = JSON.parse(rowData); + $("#"+childTableId).bootstrapTable('load',tableData); } - }, }); + // 预审部门展示 + // $('#'+childFormTableId).bootstrapTable({ + // url: ctx + "system/makeorderdept/list", + // method: 'post', + // sidePagination: "server", + // contentType: "application/x-www-form-urlencoded", + // queryParams : { + // makeNo: $("#makeNo").val(), + // materialNo: parentRow.materialCode + // }, + // columns: [ + // { + // field : 'id', + // title : '生产订单部门ID', + // formatter: function (value, row, index) { + // var curIndex = parentRowIndex*6+index; + // return ''; + // } + // }, + // { + // field : 'makeNo', + // title : '生产订单号', + // visible: false, + // formatter: function (value, row, index) { + // var curIndex = parentRowIndex*6+index; + // return ''; + // } + // }, + // { + // field : 'materialNo', + // title : '料号', + // visible: false, + // formatter: function (value, row, index) { + // var curIndex = parentRowIndex*6+index; + // return ''; + // } + // }, + // { + // field : 'deptName', + // title : '部门名称', + // visible: false + // }, + // { + // field : 'planFinishDays', + // title : '计划完成天数', + // visible: false + // }, + // { + // field : 'actualFinishStartTime', + // title : '实际完成开始时间', + // visible: false + // }, + // { + // field : 'actualFinishEndTime', + // title : '实际完成结束时间', + // visible: false + // }, + // { + // field : 'deptNumber', + // title : '部门', + // formatter: function (value, row, index) { + // /*if(subTableFormArray[parentRowIndex]){ + // value = subTableFormArray[parentRowIndex].deptName?subTableFormArray[parentRowIndex].deptName:value; + // }*/ + // var curIndex = parentRowIndex*6+index; + // return ''; + // } + // }, + // { + // field: 'planFinishDate', + // title: '计划完成时间', + // formatter: function(value, row, index) { + // var curIndex = parentRowIndex*6+index; + // var endDateName = 'planFinishEndDate_'+parentRowIndex; + // var startDateName = 'planFinishStartDate_'+parentRowIndex; + // var html; + // // 业务部门 + // if(row.deptNumber=='GMD'){ + // html = '
' + + // '\n' + + // '-\n' + + // '
' + // }else{ + // html = ''; + // } + // return html; + // } + // }, + // { + // field : 'deptLeaderConfirmStatus', + // title : '部门主管确认', + // formatter: function(value, row, index) { + // var curIndex = parentRowIndex*6+index; + // var html = ''; + // return html; + // } + // }, + // { + // field: 'actualFinishTime', + // title: '实际完成时间', + // formatter: function(value, row, index) { + // if (row.actualFinishStartTime == null || row.actualFinishStartTime == ''){ + // return ''; + // }else if(row.actualFinishStartTime){ + // return row.actualFinishStartTime + // }else if(row.actualFinishStartTime && row.actualFinishEndTime){ + // return row.actualFinishStartTime + '-' + row.actualFinishEndTime + // } + // } + // } + // ], + // // 当所有数据被加载时触发 + // onLoadSuccess: function(data) { + // for (let i = 0; i < data.rows.length; i++) { + // var curIndex = parentRowIndex*6+i; + // var startDateIndex = 'planFinishStartDate_'+i; + // var endDateIndex = 'planFinishEndDate_'+i; + // + // $('[data-id="'+startDateIndex+'"]').datetimepicker({ + // format: 'yyyy-mm-dd', + // minView: "month", + // todayBtn: true, + // autoclose: true, + // }).on('changeDate', function(event) { + // event.preventDefault(); + // event.stopPropagation(); + // var startTime = event.date; + // $('[data-id="'+endDateIndex+'"]').datetimepicker('setStartDate', startTime); + // }); + // $('[data-id="'+endDateIndex+'"]').datetimepicker({ + // format: 'yyyy-mm-dd', + // minView: "month", + // todayBtn: true, + // autoclose: true, + // }).on('changeDate', function(event) { + // event.preventDefault(); + // event.stopPropagation(); + // var endTime = event.date; + // $('[data-id="'+startDateIndex+'"]').datetimepicker('setEndDate', endTime); + // }); + // + // } + // + // }, + // }); }; function queryParams(params) { var curParams = { - // 传递参数查询参数 - // pageSize: params.limit, - // pageNum: params.offset / params.limit + 1, - // searchValue: params.search, - // orderByColumn: params.sort, - // isAsc: params.order + }; // 额外传参 - curParams.quoteId = $("#saleNo").val(); + curParams.makeNo = $("#makeNo").val(); + curParams.level = 0; return curParams; } @@ -505,13 +539,106 @@ }); function submitHandler() { - debugger + // debugger // var data = $("#form-makeorder-edit").serializeArray(); - var data = { - makeNo:$("#makeNo").val(), - saleNo:$("#saleNo").val() + var saleNo = $("#saleNo").val(); + var makeNo = $("#makeNo").val(); + let makeOrderBomList = []; + var keyPre = 'all_level_child_table_'; + const length = sessionStorage.length; + + for (let i = 0; i < length; i++) { + const key = sessionStorage.key(i); + if (key.startsWith(keyPre)) { + var rows = sessionStorage.getItem(key); + var rowData = JSON.parse(rows); + rowData.forEach(function (value){ + makeOrderBomList.push(value); + }) + } + } + var sysMakeOrder = { + makeNo: makeNo, + saleNo: saleNo, + sysMakeorderBomList: makeOrderBomList, + } + $.operate.saveJson(prefix + "/gcReview", JSON.stringify(sysMakeOrder)); + } + + function editMakeOrderBom(curIndex,materialNo){ + var url = ctx + "system/makeorderbom/editMakeorderBom?materialNo=" + materialNo+"&curIndex="+curIndex+"&makeNo="+makeNo; + var options = { + title: '编辑生产bom', + url: url, + callBack: handleMakeOrderBomData }; - $.operate.save(prefix + "/gcReview", data); + $.modal.openOptions(options); + } + + function handleMakeOrderBomData(index, layero){ + var iframeWin = window[layero.find('iframe')[0]['name']]; + iframeWin.$('#materialNo').removeAttr("disabled"); + var materialNo = iframeWin.$('#materialNo').val(); + var curIndex = iframeWin.$('#curIndex').val(); + var saleNo = $("#saleNo").val(); + var makeNo = $("#makeNo").val(); + var tableData = iframeWin.$('#bootstrap-sub-table-1').bootstrapTable('getData'); + + if (tableData.length===0){ + $.modal.alertWarning("请至少添加一条bom信息再保存!"); + return; + } + var bomData = []; + var oneLevelKey = "one_level_child_table_"+curIndex; + var allLevelKey = "all_level_child_table_"+curIndex; + var formData = []; + for(var i=0;i diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html index 558c9fe9..3c831c2b 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorder/makeorder.html @@ -106,6 +106,7 @@ var reviewFlag = [[${@permission.hasPermi('system:makeorder:review')}]]; var confirmFlag = [[${@permission.hasPermi('system:makeorder:confirm')}]]; var engineerFlag = [[${@permission.hasPermi('system:makeorder:engineer')}]]; + var purchaseFlag = [[${@permission.hasPermi('system:makeorder:purchase')}]]; var makeStatusDatas = [[${@dict.getType('sys_erp_makeStatus')}]]; var eceiptStatusDatas = [[${@dict.getType('eceiptStatus')}]]; var qualityStatusDatas = [[${@dict.getType('qualityStatus')}]]; @@ -179,6 +180,11 @@ return $.table.selectDictLabel(useStatusDatas, value); } }, + { + field: 'purchaseStatus', + title: '采购确认状态', + visible: false, + }, { field: 'saleNo', @@ -252,34 +258,38 @@ // actions.push('删除 '); //详情页面 工程审核为详情页面 // actions.push('详情 '); - actions.push('详情 '); + actions.push('详情 '); // 评审 if(row.makeStatus == '0'){ - actions.push('评审 '); + actions.push('评审 '); } // 部门主管确认 if(row.deptLeaderConfirmStatus == '0'){ - actions.push('确认时间 '); + actions.push('确认时间 '); } // 工程审核 if(row.makeStatus == '2'){ - actions.push('工程审核 '); + actions.push('工程审核 '); + } + // 采购审核:生产状态-待采购审核,采购上级确认状态-已确认 + if(row.makeStatus == '7'&&row.purchaseStatus == '1'){ + actions.push('采购审核 '); } // 领料 if((row.makeStatus == '3' || row.makeStatus == '4' || row.makeStatus == '5') && (row.eceiptStatus == '7' || row.eceiptStatus == '8')){ - actions.push('领料 '); + actions.push('领料 '); } // 委外计划 if((row.makeStatus == '3' || row.makeStatus == '4' || row.makeStatus == '5') && (row.eceiptStatus == '3' || row.eceiptStatus == '4'|| row.eceiptStatus == '5'|| row.eceiptStatus == '6'|| row.eceiptStatus == '7' || row.eceiptStatus == '8')){ - actions.push('委外计划 '); + actions.push('委外计划 '); } // 委内入库 对应生产中 if(row.makeStatus == '4' || row.makeStatus == '5'){ - actions.push('委内入库 '); - actions.push('生产入库 '); + // actions.push('委内入库 '); + actions.push('生产入库 '); } @@ -288,7 +298,8 @@ // }else{ // actions.push('恢复 '); // } - return actions.join(''); + var actionLinks = actions.join(''); + return $.table.dropdownToggle(actionLinks); } }] }; diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorderpick/detail.html b/ruoyi-admin/src/main/resources/templates/system/makeorderpick/detail.html index 5670bb39..9b85f543 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorderpick/detail.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorderpick/detail.html @@ -57,8 +57,9 @@ $(function(){ var options = { - url: ctx + "system/orderChild/list", id: 'bootstrap-sub-table-1', + url: ctx + "system/makeorderpickdetail/list", + method: 'post', showSearch: false, showRefresh: false, showToggle: false, @@ -66,105 +67,6 @@ uniqueId: "id", pagination: false, // 设置不分页 sidePagination: "client", - queryParams: queryParams, - detailView: true, - onExpandRow : function(index, row, $detail) { - initChildTable(index, row, $detail); - }, - /*onCollapseRow: function(index, row){ - var childTableFormId = 'child_table_form_'+index; - var formData = $('#'+childTableFormId).serialize(); - var formObj = $.common.formDataToObj(formData); - subTableFormArray.push(formObj); - },*/ - columns: [ - { - field: 'id', - title: '主键id', - visible: false - }, - { - field: 'quoteId', - title: '关联销售订单编号', - visible: false - }, - { - field: 'bomId', - title: 'bom主键Id', - visible: false - }, - { - field: 'materialCode', - align: 'center', - title: '料号' - }, - { - field: 'materialName', - align: 'center', - title: '物料名称', - }, - { - field: 'materialType', - align: 'center', - title: '物料类型', - formatter: function(value, row, index) { - return $.table.selectCategoryLabel(materialTypeDatas, value); - } - }, - { - field: 'unit', - align: 'center', - title: '单位', - formatter: function(value, row, index) { - return $.table.selectDictLabel(sysUnitClassDatas, value); - } - }, - { - field: 'brand', - align: 'center', - title: '品牌' - }, - { - field: 'describe', - align: 'center', - title: '描述' - }, - { - field: 'processMethod', - align: 'center', - title: '半成品类型', - formatter: function(value, row, index) { - return $.table.selectDictLabel(processMethodDatas, value); - } - }, - { - field: 'deliveryTime', - align: 'center', - title: '客户期望交付时间' - }, - { - field: 'materialNum', - align: 'center', - title: '订单数量' - } - ] - }; - $.table.init(options); - }) - - initChildTable = function(index, row, $detail) { - var parentRow = row; - var parentRowIndex = index; - var childTableId = 'child_table_'+index; - var childFormTableId = 'child_form_table_'+index; - var childTableFormId = 'child_table_form_'+index; - // $detail.html('
'); - $detail.html('
'); - // BOM展示 - $('#'+childTableId).bootstrapTable({ - url: ctx + "system/makeorderpickdetail/list", - method: 'post', - sidePagination: "server", contentType: "application/x-www-form-urlencoded", queryParams : { pickNo: $("#pickNo").val() @@ -177,6 +79,7 @@ { field: 'level', title: '阶层', + align: 'center', formatter: function(value, row, index) { return $.table.selectDictLabel(levelDatas, value); } @@ -184,6 +87,7 @@ { field: 'bomNo', title: 'BOM号', + visible: false, formatter:function (value,row,index){ if (value == null || value == ''){ return '/'; @@ -195,13 +99,11 @@ { field: 'materialNo', title: '料号', - formatter: function (value,row,index){ - var curIndex = row.sortNo-1; - return ''; - } + align: 'center', }, { field: 'photoUrl', + align: 'center', title: '图片', formatter: function(value, row, index) { return $.table.imageView(value); @@ -209,6 +111,7 @@ }, { field: 'materialName', + align: 'center', title: '物料名称', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -220,13 +123,20 @@ }, { field: 'materialType', + align: 'center', title: '物料类型', formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value); } }, + { + field: 'materialModel', + title: '型号', + align: 'center', + }, { field: 'describe', + align: 'center', title: '描述', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -238,6 +148,7 @@ }, { field: 'brand', + align: 'center', title: '品牌', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -249,6 +160,7 @@ }, { field: 'unit', + align: 'center', title: '单位', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -261,13 +173,15 @@ { field: 'processMethod', - title: '半成品类型', + align: 'center', + title: '加工方式', formatter: function(value, row, index) { return $.table.selectDictLabel(processMethodDatas, value); } }, { field: 'useNum', + align: 'center', title: '用量', formatter: function (value,row,index){ if (value == null || value == ''){ @@ -279,77 +193,35 @@ }, { field: 'lossRate', + align: 'center', title: '损耗率', - // formatter: function (value,row,index){ - // if (value == null || value == ''){ - // return '/'; - // }else{ - // return value + "%"; - // } - // } - }, - { - field: 'materialNum', - title: '订单用量', - formatter: function (value,row,index){ - return parentRow.materialNum * row.useNum; - } }, + // { + // field: 'materialNum', + // title: '订单用量', + // formatter: function (value,row,index){ + // return parentRow.materialNum * row.useNum; + // } + // }, { field: 'hasPickNum', + align: 'center', title: '已领料数', }, { field: 'pickNum', + align: 'center', title: '本次领料数量', - formatter: function (value,row,index){ - var curIndex = row.sortNo-1; - return ''; - } }, { field: 'sortNo', title: '排序', visible: false }], - // 当所有数据被加载时触发 - onLoadSuccess: function(data) { - - }, - }); - }; - - - function queryParams(params) { - var curParams = { - // 传递参数查询参数 - // pageSize: params.limit, - // pageNum: params.offset / params.limit + 1, - // searchValue: params.search, - // orderByColumn: params.sort, - // isAsc: params.order }; - // 额外传参 - curParams.quoteId = $("#saleNo").val(); - return curParams; - } - - $("#form-makeorderpick-edit").validate({ - focusCleanup: true - }); - - /*function submitHandler() { - if ($.validate.form()) { - $.operate.save(prefix + "/edit", $('#form-makeorderpick-edit').serialize()); - } - }*/ - - $("input[name='applyTime']").datetimepicker({ - format: "yyyy-mm-dd", - minView: "month", - autoclose: true + $.table.init(options); }); diff --git a/ruoyi-admin/src/main/resources/templates/system/makeorderpick/makeorderpick.html b/ruoyi-admin/src/main/resources/templates/system/makeorderpick/makeorderpick.html index 515cb9b7..ed80dafc 100644 --- a/ruoyi-admin/src/main/resources/templates/system/makeorderpick/makeorderpick.html +++ b/ruoyi-admin/src/main/resources/templates/system/makeorderpick/makeorderpick.html @@ -100,9 +100,6 @@ restoreUrl: prefix + "/restore/{id}", exportUrl: prefix + "/export", modalName: "生产领料单", - fixedColumns: true, - fixedNumber: 1, - fixedRightNumber: 1, columns: [{ checkbox: true }, @@ -277,7 +274,8 @@ } // 详情 actions.push(' 详情 '); - return actions.join(''); + var actionLinks = actions.join(''); + return $.table.dropdownToggle(actionLinks); } }], rowStyle: function (row, index) {