提交 c06b9ba7 编写于 作者: doc_wei's avatar doc_wei

feat: 加工单甘特图

上级 a6b58b65
// 已经选择的资产集合key:表格的行trId,value:资产信息
// 改
var allChooseFarm = {};
layui.config({ layui.config({
base: basePath, base: basePath,
version: skyeyeVersion version: skyeyeVersion
}).extend({ }).extend({
window: 'js/winui.window' window: 'js/winui.window'
}).define(['window', 'table','jquery', 'winui', 'form'], function (exports) { }).define(['window', 'jquery', 'winui', 'form', 'laydate'], function (exports) {
winui.renderColor(); winui.renderColor();
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$, var $ = layui.$,
form = layui.form, form = layui.form,
table = layui.table; laydate = layui.laydate;
// var selTemplate = getFileContent('tpl/template/select-option.tpl'); var selTemplate = getFileContent('tpl/template/select-option.tpl');
let farmId = getNotUndefinedVal(GetUrlParam("id")); var id = GetUrlParam("id");
// 改
// let assetMap = {}; AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinProcedureById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) {
$("#showForm").html(getDataUseHandlebars($("#beanTemplate").html(), 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({ initTableChooseUtil.initTable({
id: "arrangeList", id: "arrangeList",
cols: [ cols: [
{id: 'workshopId', title: '安排车间', formType: 'select', width: '150', verify: 'required',templet: function(d) { {id: 'farmId', title: '安排车间', formType: 'select', width: '200', verify: 'required', modelHtml: farmModelHtml },
var options = queryWorkshopList(); {id: 'targetNum', title: '安排任务数量', formType: 'input', width: '140', verify: 'required|number' },
return '<select name="workshop" class="workshop-select">' + options + '</select>'; {id: 'stateName', title: '状态', formType: 'detail', width: '140' }
}
},
{id: 'taskNumber', title: '安排任务数量', formType: 'input', width: '140', verify: 'required|number'}
], ],
deleteRowCallback: function (trcusid) { deleteRowCallback: function (trcusid) {},
delete allChooseFarm[trcusid]; addRowCallback: function (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, form: form,
minData: 1 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('<option value="' + item.id + '">' + item.name + '</option>');
// // // }, $(this));
// // // });
// // }
// });
// }
function queryWorkshopList() { initTableChooseUtil.deleteAllRow('arrangeList');
// 假设您有一个函数可以处理Ajax请求 $.each(json.bean.machinProcedureFarmList, function(i, item) {
AjaxPostUtil.request({ item.stateName = skyeyeClassEnumUtil.getEnumDataNameByCodeAndKey("machinProcedureFarmState", 'id', item.state, 'name');
url: sysMainMation.erpBasePath + "erpfarm001", var trcusid = initTableChooseUtil.resetData('arrangeList', item);
params: {page: 1, limit: 30}, var thisRowKey = trcusid.replace("tr", "");
type: 'json', if (item.state != 'waitReceive') {
method: "POST", // 只有【待接收】的任务可以删除
callback: function(json) { let itemBox = $('input[type="checkbox"][rowId="row' + thisRowKey + '"]');
console.log(666, json); itemBox.prop('disabled', true);
itemBox.addClass('layui-btn-disabled');
itemBox.next().css("cursor", "not-allowed");
} }
}); });
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
};
} }
});
// $("body").on("click", "workshopId", function (e) { var planEndTime = laydate.render({
// // 查询车间列表 elem: '#planEndTime', //指定元素
// AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page:1,limit:30}, type: 'json', method: "POST", callback: function(json) { format: 'yyyy-MM-dd',
// console.log(666,json) theme: 'grid',
// // $("#workshopId").html(getDataUseHandlebars(selTemplate, json)); done:function(value, date){
// // form.render('select'); planStartTime.config.max = {
// // initTable(); year: date.year,
// }, async: false}); month: date.month - 1,//关键
// }); date: date.date,
hours: date.hours,
minutes: date.minutes,
seconds: date.seconds
}
}
});
// var workshopId = ""; var actualStartTime = laydate.render({
// form.on('select(workshopId)', function(data) { elem: '#actualStartTime', //指定元素
// var thisRowValue = data.value; format: 'yyyy-MM-dd',
// workshopId = isNull(thisRowValue) ? "" : thisRowValue; theme: 'grid',
// loadTable(); 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
};
}
});
// AjaxPostUtil.request({url: sysMainMation.erpBasePath + "erpfarm001", params: {page: page, limit: 15}, type: 'json', method: 'POST', callback: function (json) { var actualEndTime = laydate.render({
// parent.layer.close(index); elem: '#actualEndTime', //指定元素
// parent.refreshCode = '0'; 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
}
}
});
matchingLanguage(); matchingLanguage();
form.render(); form.render();
...@@ -141,72 +124,27 @@ layui.config({ ...@@ -141,72 +124,27 @@ layui.config({
if (!result.checkResult) { if (!result.checkResult) {
return false; return false;
} }
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;
}
// 车间对象
// 更换下面两个
// assert
// allChooseAsset
// inTableDataArrayByAssetarId
var farm = allChooseFarm["tr" + thisRowKey];
if (inTableDataArrayByAssetarId(farm.id, tableData)) {
winui.window.msg('一张单中不允许出现相同的资产信息.', {icon: 2, time: 2000});
noError = true;
return false;
}
item["farmId"] = farm.id;
tableData.push(item);
});
if (noError) {
return false;
}
var params = { var params = {
list: JSON.stringify(tableData), id: id,
planStartTime: $("#planStartTime").val(),
planEndTime: $("#planEndTime").val(),
actualStartTime: $("#actualStartTime").val(),
actualEndTime: $("#actualEndTime").val(),
machinProcedureFarmList: JSON.stringify(result.dataList),
}; };
AjaxPostUtil.request({url: sysMainMation.admBasePath + "insertAssetReport", params: params, type: 'json', method: 'POST', callback: function (json) { AjaxPostUtil.request({url: sysMainMation.erpBasePath + "setMachinProcedureById", params: params, type: 'json', method: 'POST', callback: function (json) {
parent.layer.close(index); parent.layer.close(index);
parent.refreshCode = '0'; parent.refreshCode = '0';
}}); }});
} }
return false; return false;
}); });
}});
// 判断选中的资产是否也在数组中 // 取消
function inTableDataArrayByAssetarId(farmId, array) {
var isIn = false;
$.each(array, function(i, item) {
if(item.farmId === farmId) {
isIn = true;
return false;
}
});
return isIn;
}
$("body").on("click", "#cancle", function() { $("body").on("click", "#cancle", function() {
parent.layer.close(index); 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
...@@ -11,14 +11,16 @@ layui.config({ ...@@ -11,14 +11,16 @@ layui.config({
var id = GetUrlParam("id"); var id = GetUrlParam("id");
let noteList = []; let noteList = [];
loadDate();
function loadDate() {
// 根据id查询加工单信息 // 根据id查询加工单信息
AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) { AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMachinForGanttById", params: {id: id}, type: 'json', method: 'GET', callback: function (json) {
matchingLanguage(); matchingLanguage();
form.render(); form.render();
renderPanel(); renderPanel();
gantt.config.start_date = new Date(json.bean.mathinTime.start_time); gantt.config.start_date = new Date(json.bean.mathinTime.start_date);
gantt.config.end_date = new Date(json.bean.mathinTime.end_time); gantt.config.end_date = new Date(json.bean.mathinTime.end_date);
gantt.clearAll(); //清空缓存 gantt.clearAll(); //清空缓存
// 解析 // 解析
noteList = json.bean.node; noteList = json.bean.node;
...@@ -27,6 +29,7 @@ layui.config({ ...@@ -27,6 +29,7 @@ layui.config({
links: json.bean.link links: json.bean.link
}); });
}}); }});
}
function renderPanel() { function renderPanel() {
document.getElementById('device_load').style.cssText = 'height:' + $(window).height() + 'px'; document.getElementById('device_load').style.cssText = 'height:' + $(window).height() + 'px';
...@@ -100,15 +103,14 @@ layui.config({ ...@@ -100,15 +103,14 @@ layui.config({
// e 参数是点击事件的事件对象 // e 参数是点击事件的事件对象
let item = getInPoingArr(noteList, "id", id, null); let item = getInPoingArr(noteList, "id", id, null);
if (item.types != "project") { if (item.types != "project") {
console.log(item)
_openNewWindows({ _openNewWindows({
url: "../../tpl/departmentMachining/arrange.html?id=" + id, url: "../../tpl/departmentMachining/arrange.html?id=" + item.data.id,
title: "车间任务安排", title: "车间任务安排",
pageId: "workshopTaskArrangement", pageId: "workshopTaskArrangement",
area: ['90vw', '90vh'], area: ['90vw', '90vh'],
callBack: function (refreshCode) { callBack: function (refreshCode) {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000}); winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1, time: 2000});
loadTable(); loadDate();
}}); }});
} }
// 返回true以允许默认行为继续,返回false可以阻止默认行为 // 返回true以允许默认行为继续,返回false可以阻止默认行为
......
...@@ -6,67 +6,60 @@ ...@@ -6,67 +6,60 @@
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" /> <link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head> </head>
<body> <body>
<div class="time"> <div style="margin:0 auto;padding:20px;">
<div> <form class="layui-form" action="" autocomplete="off" id="showForm">
<label for="planned-start">计划开始时间:</label>
<input type="date" id="planned-start" name="planned-start"> </form>
</div> </div>
<div>
<label for="planned-end">计划结束时间:</label> <script type="text/x-handlebars-template" id="beanTemplate">
<input type="date" id="planned-end" name="planned-end"> {{#bean}}
<div class="layui-form-item layui-col-xs12">
<span class="hr-title">基本信息</span><hr>
</div> </div>
</div> <div class="layui-form-item layui-col-xs6">
<div class="time"> <label class="layui-form-label">计划开始时间<i class="red">*</i></label>
<div> <div class="layui-input-block">
<label for="actual-start">实际开始时间:</label> <input type="text" id="planStartTime" name="planStartTime" value="{{planStartTime}}" class="layui-input" win-verify="required"/>
<input type="date" id="actual-start" name="actual-start"> </div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">计划结束时间<i class="red">*</i></label>
<div class="layui-input-block">
<input type="text" id="planEndTime" name="planEndTime" value="{{planEndTime}}" class="layui-input" win-verify="required"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">实际开始时间</label>
<div class="layui-input-block">
<input type="text" id="actualStartTime" name="actualStartTime" value="{{actualStartTime}}" class="layui-input"/>
</div>
</div>
<div class="layui-form-item layui-col-xs6">
<label class="layui-form-label">实际结束时间</label>
<div class="layui-input-block">
<input type="text" id="actualEndTime" name="actualEndTime" value="{{actualEndTime}}" class="layui-input"/>
</div> </div>
<div>
<label for="actual-end">实际结束时间:</label>
<input type="date" id="actual-end" name="actual-end">
</div> </div>
</div>
<div style="margin:0 auto;padding:20px;margin-top:40px">
<form class="layui-form" action="" autocomplete="off">
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<label class="layui-form-label">详细安排</label> <label class="layui-form-label">目标任务指标</label>
<div class="layui-input-block" id="arrangeList"> <div class="layui-input-block" id="arrangeList">
</div> </div>
</div> </div>
<div class="layui-form-item layui-col-xs12"> <div class="layui-form-item layui-col-xs12">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button> <button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
<button class="winui-btn" lay-submit lay-filter="formAddBean"><language showName="com.skyeye.save"></language></button> <button class="winui-btn" lay-submit lay-filter="formAddBean"><language showName="com.skyeye.save"></language></button>
</div> </div>
</div> </div>
</form> {{/bean}}
</div> </script>
<script src="../../assets/lib/layui/layui.js"></script> <script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script> <script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript"> <script type="text/javascript">
layui.config({base : '../../js/departmentMachining/'}).use('arrange'); layui.config({base : '../../js/departmentMachining/'}).use('arrange');
</script> </script>
</body> </body>
<style>
.time {
display: flex;
margin-top: 50px;
}
.time > div {
display: flex;
margin-left: 97px;
align-items: center;
}
.time > div:not(:last-child) {
margin-right: 100px;
}
.time input[type="date"] {
width: 150px;
border: 1px solid #ccc;
padding: 5px;
}
</style>
</html> </html>
\ No newline at end of file
...@@ -30,7 +30,6 @@ layui.config({ ...@@ -30,7 +30,6 @@ layui.config({
let tabIndex = 1; let tabIndex = 1;
let supplierIds = []; let supplierIds = [];
$.each(json.bean, function (key, value) { $.each(json.bean, function (key, value) {
console.log(value)
if (!isNull(key)) { if (!isNull(key)) {
supplierIds.push(key) supplierIds.push(key)
} }
......
...@@ -172,18 +172,6 @@ layui.config({ ...@@ -172,18 +172,6 @@ layui.config({
return false; 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() { $("body").on("click", "#cancle", function() {
parent.layer.close(index); parent.layer.close(index);
......
...@@ -532,3 +532,15 @@ function turnTime(time, mm){ ...@@ -532,3 +532,15 @@ function turnTime(time, mm){
} }
return (hour < 10 ? ("0" + hour) : hour) + ":" + (minute < 10 ? (minute + "0") : minute); 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
...@@ -92,6 +92,7 @@ ...@@ -92,6 +92,7 @@
"depotPutState": {"name": "仓库入库单入库状态", "className": "skyeye-erp#com.skyeye.depot.classenum.DepotPutState"}, "depotPutState": {"name": "仓库入库单入库状态", "className": "skyeye-erp#com.skyeye.depot.classenum.DepotPutState"},
"generateDepotLevelValType": {"name": "ERP-批量生成仓库级别的值的类型", "className": "skyeye-erp#com.skyeye.depot.classenum.GenerateDepotLevelValType"}, "generateDepotLevelValType": {"name": "ERP-批量生成仓库级别的值的类型", "className": "skyeye-erp#com.skyeye.depot.classenum.GenerateDepotLevelValType"},
"productionChildFromType": {"name": "生产计划单子单据生产类型", "className": "skyeye-erp#com.skyeye.production.classenum.ProductionChildType"}, "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"}, "skyeyeView": {"name": "视图类型", "className": "skyeye-pro#com.skyeye.common.SkyeyeViewEnum"},
"widthScale": {"name": "宽度比例", "className": "skyeye-pro#com.skyeye.attr.classenum.WidthScale"}, "widthScale": {"name": "宽度比例", "className": "skyeye-pro#com.skyeye.attr.classenum.WidthScale"},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册