diff --git a/javascript/xuanran.wang/bme/js/BuildContractApply.js b/javascript/xuanran.wang/bme/js/BuildContractApply.js index 723ec25..c8df318 100644 --- a/javascript/xuanran.wang/bme/js/BuildContractApply.js +++ b/javascript/xuanran.wang/bme/js/BuildContractApply.js @@ -47,6 +47,8 @@ jQuery().ready(function(){ } } + addRowBack(2, configObj); + changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, computeDatePayType) // 主表字段发生变化 diff --git a/javascript/xuanran.wang/bme/js/Common.js b/javascript/xuanran.wang/bme/js/Common.js index 4aae9d3..5c432b3 100644 --- a/javascript/xuanran.wang/bme/js/Common.js +++ b/javascript/xuanran.wang/bme/js/Common.js @@ -42,6 +42,8 @@ function getDate(time) { return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d); } + + /** * 校验比例是否等于100 * @param detailTable 明细表 @@ -153,6 +155,18 @@ function changeDetailPayDate(obj){ } } +/** + * 字段联动后添加明细行后执行的逻辑 + * @param detail + * @param configObj + */ +function addRowBack(detail, configObj){ + WfForm.registerAction(WfForm.ACTION_ADDROW + detail, function(index){ + configObj.index = index; + changeDetailPayDate(configObj); + }); +} + /** * 改变明细表字段只读 * @param detailTable @@ -173,3 +187,5 @@ function changeDetailFieldReadOnly(detailTable, detailComDateField, detailPaymen } } } + + diff --git a/javascript/xuanran.wang/bme/js/InventFileFirst.js b/javascript/xuanran.wang/bme/js/InventFileFirst.js new file mode 100644 index 0000000..032724b --- /dev/null +++ b/javascript/xuanran.wang/bme/js/InventFileFirst.js @@ -0,0 +1,31 @@ + // 存货分类编码 + const chflbmId = WfForm.convertFieldNameToId("chflbm"); + // 流程类型 + const workflowType = WfForm.convertFieldNameToId("lcxz"); + // 唯一编码 + const unqieCode = WfForm.convertFieldNameToId("wybm"); + // 帐套查询 + const zt = WfForm.convertFieldNameToId("ztcx"); + // 存货编码 + const chbm = WfForm.convertFieldNameToId("chbm2"); + + changeVal(); + WfForm.bindFieldChangeEvent(chflbmId, function(obj,id,value){ + changeVal(); + }); + + function changeVal(){ + let value = WfForm.getFieldValue(chflbmId) + console.log('value: ', value); + if(!value){ + return; + } + let firstVal = value.charAt(0); + if(firstVal == 0){ + value = value.substring(1, value.length); + console.log('修改后的val ', value); + setTimeout(()=>{ + $(`#${chflbmId}span`)[0].innerHTML = value; + },5); + } + } \ No newline at end of file diff --git a/javascript/xuanran.wang/bme/js/PayApply.js b/javascript/xuanran.wang/bme/js/PayApply.js new file mode 100644 index 0000000..fbe6238 --- /dev/null +++ b/javascript/xuanran.wang/bme/js/PayApply.js @@ -0,0 +1,32 @@ +// 主表预计付款日期 +const yjfksj = WfForm.convertFieldNameToId('yjfksj'); +// 主表比例 +const bl = WfForm.convertFieldNameToId('bcfkbl'); +// 明细要求付款日期 +const detail3Yqfkrq = WfForm.convertFieldNameToId('yqfkrq',"detail_3"); +// 明细本次付款比例 +const detailBl = WfForm.convertFieldNameToId('bcfkbl',"detail_3"); + +WfForm.registerCheckEvent(WfForm.OPER_ADDROW + "3", function (callback) { + callback(); + initDeatail3Date(); +}); + +WfForm.bindFieldChangeEvent(`${yjfksj},${bl}`, function(obj,id,value){ + initDeatail3Date(); +}); + +function initDeatail3Date(){ + let dateVal = WfForm.getFieldValue(yjfksj); + let blVal = WfForm.getFieldValue(bl); + console.log('dateVal ', dateVal); + console.log('blVal ', blVal); + let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(","); + for (let i = 0; i < detail3RowArr.length; i++) { + let rowIndex = detail3RowArr[i]; + if (rowIndex !== "") { + WfForm.changeFieldValue(`${detail3Yqfkrq}_${rowIndex}`,{value: dateVal}); + WfForm.changeFieldValue(`${detailBl}_${rowIndex}`,{value: blVal}); + } + } +} \ No newline at end of file diff --git a/javascript/xuanran.wang/bme/js/ProDataConfirm.js b/javascript/xuanran.wang/bme/js/ProDataConfirm.js new file mode 100644 index 0000000..6994422 --- /dev/null +++ b/javascript/xuanran.wang/bme/js/ProDataConfirm.js @@ -0,0 +1,217 @@ +var m_xmmc = WfForm.convertFieldNameToId("xmmc");//项目名称 +var m_bmwyz = WfForm.convertFieldNameToId("glkcjlb");//关联勘察 +var m_bmwyz1 = WfForm.convertFieldNameToId("glxsxqd");//关联销售 +var m_bmwyz2 = WfForm.convertFieldNameToId("chdadx");//唯一值多选 +var dt2_tyrq = WfForm.convertFieldNameToId("tyrq", "detail_2");//明细2停用日期 +jQuery(document).ready(function () { + setTimeout("bindFieldChange()", "500"); +}); + +function bindFieldChange() { + WfForm.bindFieldChangeEvent(m_xmmc, function (obj, id, value) { + WfForm.changeFieldValue(m_bmwyz, {value: ''}); + WfForm.changeFieldValue(m_bmwyz1, {value: ''}); + WfForm.changeFieldValue(m_bmwyz2, {value: ''}); + }); + //提交检验 + WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, function (callback) { + var flag = true; + var rowArr = WfForm.getDetailAllRowIndexStr("detail_2").split(","); + for (var i = 0; i < rowArr.length; i++) { + var rowid = rowArr[i]; + var dt2_tyrq_v = WfForm.getFieldValue(dt2_tyrq + "_" + rowid); + if (dt2_tyrq_v != "") { + WfForm.showMessage("明细2第" + (i + 1) + "行设备已在" + dt2_tyrq_v + "停用!", 2, 5); + flag = flase; + break; + } + } + if (flag) { + callback(); //继续提交需调用callback,不调用代表阻断 + } + }); +} + +var rowArr = WfForm.getDetailAllRowIndexStr("detail_3").split(","); +// WfForm.delDetailRow("detail_2", "all"); +for (var i = 0; i < rowArr.length; i++) { + var rowIndex = rowArr[i]; + if (rowIndex !== "") { + var fieldMark = "field12566" + rowIndex; + if (fieldMark === "0") { + var count = WfForm.getFieldValue("field12562" + rowIndex); + var field7108_ = WfForm.getFieldValue("field6117_" + rowIndex); + WfForm.addDetailRow("detail_2", {field8567: {value: count}, field7583: {value: field7108_},}); + } + } +} +/* +dev-1 王宣然 限制明细表选择的bom不能重复 +*/ +const detailBomField = WfForm.convertFieldNameToId('bombm', 'detail_1'); +/** + * 主表辅助字段 + */ +const mainAttrField = WfForm.convertFieldNameToId('ycbmpzx'); +/** + * 明细1数量 + */ +const detail1NumFieldId = WfForm.convertFieldNameToId('sl1', "detail_1"); +/** + * 明细3 明细2数量 + */ +const detail3NumFieldId = WfForm.convertFieldNameToId('mx2sl', "detail_3"); +/** + * 明细3数量 + */ +const detail3NumFieldId2 = WfForm.convertFieldNameToId('sl1', "detail_3"); +/** + * 明细3需求数量 + */ +const detail3NumFieldId3 = WfForm.convertFieldNameToId('sl', "detail_3"); +/** + * 明细3bom编码 + */ +const detail3BomFieldId = WfForm.convertFieldNameToId('bombm', "detail_3"); +/** + * 明细1bom编码 + */ +const detail1BomFieldId = WfForm.convertFieldNameToId('bombm', "detail_1"); +/* +*已经选择的bom +*/ +let choiceArr = new Set(); +let updateNum = {}; + +const yjdhrq = WfForm.convertFieldNameToId('yjdhrq'); +console.log('id ', yjdhrq) +// 明细到货日期 +const detail1yjdhsj = WfForm.convertFieldNameToId('yjdhsj', "detail_2"); + +WfForm.bindFieldChangeEvent(yjdhrq, function (obj, id, value) { + initDeatail2Date(value); +}); + +WfForm.registerCheckEvent(WfForm.OPER_ADDROW + "2", function (callback) { + callback(); + let value = WfForm.getFieldValue(yjdhrq); + initDeatail2Date(value); +}); + +WfForm.bindDetailFieldChangeEvent(detailBomField, function (id, rowIndex, value) { + if (!value) { + return; + } + if (choiceArr.has(value)) { + WfForm.showMessage('不能选择重复的bom,请重新选择!'); + setTimeout(() => { + WfForm.changeFieldValue(`${detailBomField}_${rowIndex}`, {value: '', specialobj: []}); + }, 5); + } + initChoiceArr(); + getBomArr(); +}); + + +// 数量变化自动计算 +WfForm.bindDetailFieldChangeEvent(`${detail1NumFieldId},${detailBomField}`, function (id, rowIndex, value) { + let detail1RowArr = WfForm.getDetailAllRowIndexStr('detail_1').split(","); + console.log(detail1RowArr); + for (let i = 0; i < detail1RowArr.length; i++) { + let rowIndex = detail1RowArr[i]; + if (rowIndex !== "") { + let num = WfForm.getFieldValue(`${detail1NumFieldId}_${rowIndex}`); + // bom编码 + let bom = WfForm.getFieldValue(`${detail1BomFieldId}_${rowIndex}`); + setTimeout(() => { + computeNum(bom, num); + }, 500); + } + } + +}); + +function initDeatail2Date(value) { + let detail2RowArr = WfForm.getDetailAllRowIndexStr('detail_2').split(","); + for (let i = 0; i < detail2RowArr.length; i++) { + let rowIndex = detail2RowArr[i]; + if (rowIndex !== "") { + WfForm.changeFieldValue(`${detail1yjdhsj}_${rowIndex}`, {value: value}); + } + } +} + +/** + * 计算明细3数量 + */ +function computeNum(detail1Bom, detail1Num) { + let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(","); + console.log(detail3RowArr); + for (let i = 0; i < detail3RowArr.length; i++) { + let rowIndex = detail3RowArr[i]; + if (rowIndex !== "") { + // bom编码 + let bom = WfForm.getFieldValue(`${detail3BomFieldId}_${rowIndex}`); + if (bom != detail1Bom) { + continue; + } + console.log('需要改变的index ', rowIndex) + WfForm.changeFieldValue(`${detail3NumFieldId}_${rowIndex}`, {value: detail1Num}); + } + } +} + +/** + * 初始化已经选择的数组 + */ +function initChoiceArr() { + choiceArr = new Set(); + let rowArr = WfForm.getDetailAllRowIndexStr('detail_1').split(","); + for (let i = 0; i < rowArr.length; i++) { + let rowIndex = rowArr[i]; + if (rowIndex !== "") { + let bom = WfForm.getFieldValue(`${detailBomField}_${rowIndex}`); + // console.log('bom ', bom); + if (!bom) { + continue; + } + choiceArr.add(bom); + } + } + console.log('choiceArr ', choiceArr) +} + +WfForm.registerCheckEvent(WfForm.OPER_DELROW + "1", function (callback) { + callback(); + getBomArr(); + initChoiceArr(); +}); + +function getBomArr() { + let arr = []; + let rowArr = WfForm.getDetailAllRowIndexStr('detail_1').split(","); + for (let i = 0; i < rowArr.length; i++) { + let rowIndex = rowArr[i]; + if (rowIndex !== "") { + arr.push(WfForm.getFieldValue(`${detailBomField}_${rowIndex}`)); + } + } + let bom = new Set(arr); + let arr2 = [...bom]; + let obj = {}; + obj.value = arr2.join(','); + let specialobjArr = []; + for (let i = 0; i < arr2.length; i++) { + let obj = {}; + obj.id = arr2[i]; + obj.name = arr2[i]; + specialobjArr.push(obj); + } + obj.specialobj = specialobjArr; + let val = WfForm.changeFieldValue(mainAttrField, obj); + if (!val) { + WfForm.delDetailRow("detail_3", "all"); + } + console.log('主表辅助字段值 : ', WfForm.getFieldValue(mainAttrField)); +} + diff --git a/javascript/xuanran.wang/bme/js/PurchaseContractApply.js b/javascript/xuanran.wang/bme/js/PurchaseContractApply.js index 4303665..705e114 100644 --- a/javascript/xuanran.wang/bme/js/PurchaseContractApply.js +++ b/javascript/xuanran.wang/bme/js/PurchaseContractApply.js @@ -51,6 +51,9 @@ function init(){ 'computeDatePayType': computeDatePayType, 'paymentTypeGetValue': paymentTypeGetValue } + + addRowBack(3, obj); + changeDetailFieldReadOnly(detailTable, detailComPayDateId, detailPaymentTypeId, computeDatePayType) // 主表字段发生变化 mainFieldChangeDetailCom(`${mainProjectId},${contractSignDateId}`, detailTable, obj); diff --git a/javascript/xuanran.wang/bme/js/SaleContractApply.js b/javascript/xuanran.wang/bme/js/SaleContractApply.js index 2836a58..eff8107 100644 --- a/javascript/xuanran.wang/bme/js/SaleContractApply.js +++ b/javascript/xuanran.wang/bme/js/SaleContractApply.js @@ -52,6 +52,7 @@ function init(){ 'computeDatePayType': computeDatePayType, 'paymentTypeGetValue': paymentTypeGetValue } + addRowBack(2, obj); changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, computeDatePayType) // 主表字段发生变化 mainFieldChangeDetailCom(mainProjectId, detailTable, obj); diff --git a/src/main/java/com/api/xuanran/wang/shyl/controller/BatchCreateWorkFlowController.java b/src/main/java/com/api/xuanran/wang/shyl/controller/BatchCreateWorkFlowController.java new file mode 100644 index 0000000..3c0791d --- /dev/null +++ b/src/main/java/com/api/xuanran/wang/shyl/controller/BatchCreateWorkFlowController.java @@ -0,0 +1,91 @@ +package com.api.xuanran.wang.shyl.controller; + +import aiyh.utils.ApiResult; +import aiyh.utils.Util; +import aiyh.utils.excention.CustomerException; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.api.xuanran.wang.shyl.service.BatchCreateWorkflowService; +import com.api.xuanran.wang.shyl.service.MeetingService; +import com.api.xuanran.wang.shyl.vo.CreateWfVO; +import com.engine.common.util.ServiceUtil; +import com.engine.workflow.publicApi.WorkflowRequestOperatePA; +import com.engine.workflow.publicApi.impl.WorkflowRequestOperatePAImpl; +import com.engine.workflow.util.CommonUtil; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; +import weaver.hrm.User; +import weaver.xuanran.wang.common.mapper.CommonMapper; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.List; + +/** + *