diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js b/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js index d30f980e92cd83c2bf85b821e5504aea49efa68b..f13145802bd86330325cc32a414e8a9032a40408 100644 --- a/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js +++ b/erp-produce/src/main/resources/template/js/departmentMachining/arrange.js @@ -1,212 +1,150 @@ -// 已经选择的资产集合key:表格的行trId,value:资产信息 -// 改 -var allChooseFarm = {}; - layui.config({ base: basePath, version: skyeyeVersion }).extend({ window: 'js/winui.window' -}).define(['window', 'table','jquery', 'winui', 'form'], function (exports) { +}).define(['window', 'jquery', 'winui', 'form', 'laydate'], function (exports) { winui.renderColor(); var index = parent.layer.getFrameIndex(window.name); var $ = layui.$, form = layui.form, - table = layui.table; - // var selTemplate = getFileContent('tpl/template/select-option.tpl'); - let farmId = getNotUndefinedVal(GetUrlParam("id")); - // 改 - // let assetMap = {}; + laydate = layui.laydate; + var selTemplate = getFileContent('tpl/template/select-option.tpl'); + var id = GetUrlParam("id"); - initTableChooseUtil.initTable({ - id: "arrangeList", - cols: [ - {id: 'workshopId', title: '安排车间', formType: 'select', width: '150', verify: 'required',templet: function(d) { - var options = queryWorkshopList(); - return ''; - } - }, - {id: 'taskNumber', title: '安排任务数量', formType: 'input', width: '140', verify: 'required|number'} - ], - deleteRowCallback: function (trcusid) { - delete allChooseFarm[trcusid]; - }, - addRowCallback: function (trcusid) { - // if (!isNull(farmId)) { - // if (isNull(assetMap[farmId])) { - // AjaxPostUtil.request({url: sysMainMation.admBasePath + "queryAssetById", params: {"id": farmId}, type: 'json', method: 'GET', callback: function (json) { - // assetMap[farmId] = json.bean - // }, async: false}); - // } - // let chooseAssetMation = assetMap[farmId] - // // 获取表格行号 - // var thisRowKey = trcusid.replace("tr", ""); - // // 资产名称赋值 - // $("#farmId" + thisRowKey).val(chooseAssetMation.name); - // $("#farmId" + thisRowKey).attr(initTableChooseUtil.chooseInputDataIdKey, chooseAssetMation.id); - // // 资产赋值 - // allChooseFarm[trcusid] = chooseAssetMation; - // } - }, - form: form, - minData: 1 - }); - // - // var workshopId = ""; - // form.on('select(workshopId)', function(data) { - // console.log(555,data) - // // var thisRowValue = data.value; - // // workshopId = isNull(thisRowValue) ? "" : thisRowValue; - // aaa(); - // }); - // 渲染表格 -// function aaa(){ -// table.render({ -// id: 'arrangeList',//表格 -// elem: '#workshopId', //表格里的元素 -// method: 'post', -// url: sysMainMation.erpBasePath + 'erpfarm001', -// where: getTableParams(), -// even: true, -// page: true, -// limits: getLimits(), -// limit: getLimit(), -// done: function(json){ -// // 表格渲染完成后的回调 -// // 在这里添加事件监听 -// $('select[name="workshop"]').on('change', function(){ -// console.log('Workshop selected', $(this).val()); -// // 如果需要,可以在这里打印'123'或进行其他操作 -// }); -// -// $('input[name="taskNumber"]').on('click', function(){ -// console.log('taskNumber input clicked'); -// // 打印'123'或其他操作 -// }); -// } -// // done: function(json){ -// // console.log(json) -// // // matchingLanguage(); -// // // $('select[name="workshop"]').each(function(){ -// // // $(this).empty(); -// // // workshopData.forEach(function(item){ -// // // $(this).append(''); -// // // }, $(this)); -// // // }); -// // } -// }); -// } + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinProcedureById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { + $("#showForm").html(getDataUseHandlebars($("#beanTemplate").html(), json)); - function queryWorkshopList() { - // 假设您有一个函数可以处理Ajax请求 - AjaxPostUtil.request({ - url: sysMainMation.erpBasePath + "erpfarm001", - params: {page: 1, limit: 30}, - type: 'json', - method: "POST", - callback: function(json) { - console.log(666, json); - } + let par = { + workProcedureId: json.bean.procedureId + }; + let farmModelHtml = ''; + // 根据工序id查询可以执行该工序的车间 + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryExecuteFarmByWorkProcedureId", params: par, type: 'json', method: 'GET', callback: function (json) { + farmModelHtml = getDataUseHandlebars(selTemplate, json); + }, async: false}); + + initTableChooseUtil.initTable({ + id: "arrangeList", + cols: [ + {id: 'farmId', title: '安排车间', formType: 'select', width: '200', verify: 'required', modelHtml: farmModelHtml }, + {id: 'targetNum', title: '安排任务数量', formType: 'input', width: '140', verify: 'required|number' }, + {id: 'stateName', title: '状态', formType: 'detail', width: '140' } + ], + deleteRowCallback: function (trcusid) {}, + addRowCallback: function (trcusid) {}, + form: form, + minData: 1 }); - } -// $("body").on("click", "workshopId", function (e) { -// // 查询车间列表 -// AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page:1,limit:30}, type: 'json', method: "POST", callback: function(json) { -// console.log(666,json) -// // $("#workshopId").html(getDataUseHandlebars(selTemplate, json)); -// // form.render('select'); -// // initTable(); -// }, async: false}); -// }); + initTableChooseUtil.deleteAllRow('arrangeList'); + $.each(json.bean.machinProcedureFarmList, function(i, item) { + item.stateName = skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("machinProcedureFarmState", 'id', item.state, 'name'); + var trcusid = initTableChooseUtil.resetData('arrangeList', item); + var thisRowKey = trcusid.replace("tr", ""); + if (item.state != 'waitReceive') { + // 只有【待接收】的任务可以删除 + let itemBox = $('input[type="checkbox"][rowId="row' + thisRowKey + '"]'); + itemBox.prop('disabled', true); + itemBox.addClass('layui-btn-disabled'); + itemBox.next().css("cursor", "not-allowed"); + } + }); - // var workshopId = ""; - // form.on('select(workshopId)', function(data) { - // var thisRowValue = data.value; - // workshopId = isNull(thisRowValue) ? "" : thisRowValue; - // loadTable(); - // }); + var planStartTime = laydate.render({ + elem: '#planStartTime', //指定元素 + format: 'yyyy-MM-dd', + theme: 'grid', + done:function(value, date){ + planEndTime.config.min = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds + }; + } + }); - // AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page: page, limit: 15}, type: 'json', method: 'POST', callback: function (json) { - // parent.layer.close(index); - // parent.refreshCode = '0'; - // }}); + var planEndTime = laydate.render({ + elem: '#planEndTime', //指定元素 + format: 'yyyy-MM-dd', + theme: 'grid', + done:function(value, date){ + planStartTime.config.max = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds + } + } + }); - matchingLanguage(); - form.render(); - form.on('submit(formAddBean)', function (data) { - if (winui.verifyForm(data.elem)) { - var result = initTableChooseUtil.getDataList('arrangeList'); - if (!result.checkResult) { - return false; + var actualStartTime = laydate.render({ + elem: '#actualStartTime', //指定元素 + format: 'yyyy-MM-dd', + theme: 'grid', + done:function(value, date){ + actualEndTime.config.min = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds + }; } - var noError = false; - var tableData = []; - $.each(result.dataList, function(i, item) { - // 获取行编号 - var thisRowKey = item["trcusid"].replace("tr", ""); - if (parseInt(item.taskNumber) == 0) { - $("#taskNumber" + thisRowKey).addClass("layui-form-danger"); - $("#taskNumber" + thisRowKey).focus(); - winui.window.msg('数量不能为0', {icon: 2, time: 2000}); - noError = true; - return false; + }); + + var actualEndTime = laydate.render({ + elem: '#actualEndTime', //指定元素 + format: 'yyyy-MM-dd', + theme: 'grid', + done:function(value, date){ + actualStartTime.config.max = { + year: date.year, + month: date.month - 1,//关键 + date: date.date, + hours: date.hours, + minutes: date.minutes, + seconds: date.seconds } - // 车间对象 - // 更换下面两个 - // assert - // allChooseAsset - // inTableDataArrayByAssetarId - var farm = allChooseFarm["tr" + thisRowKey]; - if (inTableDataArrayByAssetarId(farm.id, tableData)) { - winui.window.msg('一张单中不允许出现相同的资产信息.', {icon: 2, time: 2000}); - noError = true; + } + }); + + matchingLanguage(); + form.render(); + form.on('submit(formAddBean)', function (data) { + if (winui.verifyForm(data.elem)) { + var result = initTableChooseUtil.getDataList('arrangeList'); + if (!result.checkResult) { return false; } - item["farmId"] = farm.id; - tableData.push(item); - }); - if (noError) { - return false; - } - var params = { - list: JSON.stringify(tableData), - }; - AjaxPostUtil.request({url: sysMainMation.admBasePath + "insertAssetReport", params: params, type: 'json', method: 'POST', callback: function (json) { + var params = { + id: id, + planStartTime: $("#planStartTime").val(), + planEndTime: $("#planEndTime").val(), + actualStartTime: $("#actualStartTime").val(), + actualEndTime: $("#actualEndTime").val(), + machinProcedureFarmList: JSON.stringify(result.dataList), + }; + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "setMachinProcedureById", params: params, type: 'json', method: 'POST', callback: function (json) { parent.layer.close(index); parent.refreshCode = '0'; }}); - } - return false; - }); - - // 判断选中的资产是否也在数组中 - function inTableDataArrayByAssetarId(farmId, array) { - var isIn = false; - $.each(array, function(i, item) { - if(item.farmId === farmId) { - isIn = true; - return false; } + return false; }); - return isIn; - } + }}); + // 取消 $("body").on("click", "#cancle", function() { parent.layer.close(index); }); - function loadTable() { - table.reloadData("arrangeList", {where: getTableParams()}); - } - - function getTableParams() { - var params = { - type: 'farm', - objectId: workshopId - } - return $.extend(true, params, initTableSearchUtil.getSearchValue("messageTable")); - } }); \ No newline at end of file diff --git a/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js b/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js index 5113d4e572a722a248ee6484d72c43ba0867ff78..b2804842a0620c7a60d590f6cedeea00eef29e5e 100644 --- a/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js +++ b/erp-produce/src/main/resources/template/js/departmentMachining/machiningGantt.js @@ -11,22 +11,25 @@ layui.config({ var id = GetUrlParam("id"); let noteList = []; - // 根据id查询加工单信息 - AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { - matchingLanguage(); - form.render(); - renderPanel(); + loadDate(); + function loadDate() { + // 根据id查询加工单信息 + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { + matchingLanguage(); + form.render(); + renderPanel(); - gantt.config.start_date = new Date(json.bean.mathinTime.start_time); - gantt.config.end_date = new Date(json.bean.mathinTime.end_time); - gantt.clearAll(); //清空缓存 - // 解析 - noteList = json.bean.node; - gantt.parse({ - data: json.bean.node, - links: json.bean.link - }); - }}); + gantt.config.start_date = new Date(json.bean.mathinTime.start_date); + gantt.config.end_date = new Date(json.bean.mathinTime.end_date); + gantt.clearAll(); //清空缓存 + // 解析 + noteList = json.bean.node; + gantt.parse({ + data: json.bean.node, + links: json.bean.link + }); + }}); + } function renderPanel() { document.getElementById('device_load').style.cssText = 'height:' + $(window).height() + 'px'; @@ -100,15 +103,14 @@ layui.config({ // e 参数是点击事件的事件对象 let item = getInPoingArr(noteList, "id", id, null); if (item.types != "project") { - console.log(item) _openNewWindows({ - url: "../../tpl/departmentMachining/arrange.html?id=" + id, + url: "../../tpl/departmentMachining/arrange.html?id=" + item.data.id, title: "车间任务安排", pageId: "workshopTaskArrangement", area: ['90vw', '90vh'], callBack: function (refreshCode) { winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); - loadTable(); + loadDate(); }}); } // 返回true以允许默认行为继续,返回false可以阻止默认行为 diff --git a/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html b/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html index c10f10e2b0709f9b35025ba6c74b308cf3324870..e7b3cd79f5e2201429b3680a8d1bb15bb9faa1d0 100644 --- a/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html +++ b/erp-produce/src/main/resources/template/tpl/departmentMachining/arrange.html @@ -6,67 +6,60 @@ -
-
- - -
-
- - -
-
-
-
- - -
-
- - +
+
+ +
-
-
-
+ - - - + + + - \ No newline at end of file diff --git a/erp/src/main/resources/template/js/purchaseRequest/requestToContract.js b/erp/src/main/resources/template/js/purchaseRequest/requestToContract.js index d44b3dd11ab7fc7719840e2349ab7297355bd04e..c6be36b790f96acc28c4e6115b93bfb9f9aba0fe 100644 --- a/erp/src/main/resources/template/js/purchaseRequest/requestToContract.js +++ b/erp/src/main/resources/template/js/purchaseRequest/requestToContract.js @@ -30,7 +30,6 @@ layui.config({ let tabIndex = 1; let supplierIds = []; $.each(json.bean, function (key, value) { - console.log(value) if (!isNull(key)) { supplierIds.push(key) } diff --git a/schedule/src/main/resources/template/js/index/addSchedule.js b/schedule/src/main/resources/template/js/index/addSchedule.js index 3e577db1290675c9f702a3624aa4cfadfe7239c1..a613effe3992e25671f121f2c0db696d942ec0c1 100644 --- a/schedule/src/main/resources/template/js/index/addSchedule.js +++ b/schedule/src/main/resources/template/js/index/addSchedule.js @@ -172,18 +172,6 @@ layui.config({ return false; }); - // 设置最小可选的日期 - function minDate(){ - var now = new Date(); - return now.getFullYear()+"-" + (now.getMonth()+1) + "-" + now.getDate(); - } - - // 设置最小可选的小时日期 - function minHourDate(){ - var now = new Date(); - return now.getHours() + ':' + now.getMinutes() + ':00'; - } - // 取消 $("body").on("click", "#cancle", function() { parent.layer.close(index); diff --git a/web/src/main/resources/template/assets/lib/layui/customer/systemDateUtil.js b/web/src/main/resources/template/assets/lib/layui/customer/systemDateUtil.js index 482f8561ca6f34dab168ed4ba0e2d2aa0c12c412..6e6c0ff149df54ee59b2afd6ad72dd277d9e323e 100644 --- a/web/src/main/resources/template/assets/lib/layui/customer/systemDateUtil.js +++ b/web/src/main/resources/template/assets/lib/layui/customer/systemDateUtil.js @@ -531,4 +531,16 @@ function turnTime(time, mm){ minute = minute + mm; } return (hour < 10 ? ("0" + hour) : hour) + ":" + (minute < 10 ? (minute + "0") : minute); +} + +// 设置最小可选的日期 +function minDate(){ + var now = new Date(); + return now.getFullYear()+"-" + (now.getMonth()+1) + "-" + now.getDate(); +} + +// 设置最小可选的小时日期 +function minHourDate(){ + var now = new Date(); + return now.getHours() + ':' + now.getMinutes() + ':00'; } \ No newline at end of file diff --git a/web/src/main/resources/template/json/skyeyeClassEnum.json b/web/src/main/resources/template/json/skyeyeClassEnum.json index d11259e7abc0836c1617bcaeb00e7b49e95d7213..ad4dee99a98131e7b5735ad2dfb76e81498652b5 100644 --- a/web/src/main/resources/template/json/skyeyeClassEnum.json +++ b/web/src/main/resources/template/json/skyeyeClassEnum.json @@ -92,6 +92,7 @@ "depotPutState": {"name": "仓库入库单入库状态", "className": "skyeye-erp#com.skyeye.depot.classenum.DepotPutState"}, "generateDepotLevelValType": {"name": "ERP-批量生成仓库级别的值的类型", "className": "skyeye-erp#com.skyeye.depot.classenum.GenerateDepotLevelValType"}, "productionChildFromType": {"name": "生产计划单子单据生产类型", "className": "skyeye-erp#com.skyeye.production.classenum.ProductionChildType"}, + "machinProcedureFarmState": {"name": "车间任务状态", "className": "skyeye-erp#com.skyeye.machinprocedure.classenum.MachinProcedureFarmState"}, "skyeyeView": {"name": "视图类型", "className": "skyeye-pro#com.skyeye.common.SkyeyeViewEnum"}, "widthScale": {"name": "宽度比例", "className": "skyeye-pro#com.skyeye.attr.classenum.WidthScale"},