Commit d0ddda17 by yukang

增加智能排产

parent 46955641
package com.baosight.hpjx.hp.ff.service; package com.baosight.hpjx.hp.ff.service;
import com.baosight.hpjx.common.HPConstants; import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.domain.HPSC006; import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.ExcelUtils; import com.baosight.hpjx.util.ExcelUtils;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ServiceHPFF001 extends ServiceEPBase { public class ServiceHPFF001 extends ServiceEPBase {
...@@ -48,7 +51,14 @@ public class ServiceHPFF001 extends ServiceEPBase { ...@@ -48,7 +51,14 @@ public class ServiceHPFF001 extends ServiceEPBase {
map1.put("productionOrderNo",productionOrderNo); map1.put("productionOrderNo",productionOrderNo);
map1.put("inventType","7"); map1.put("inventType","7");
ExcelUtils.importFromExcel(inInfo, fileName,map1, new HPSC006()); ExcelUtils.importFromExcel(inInfo, fileName,map1, new HPSC006());
inInfo = this.refreshHPSC006(inInfo, productionOrderNo);
} }
return inInfo; return inInfo;
} }
private EiInfo refreshHPSC006(EiInfo inInfo, String productionOrderNo) {
List<HPSC006> HPSC006 = HPSCTools.Hpsc006.get(productionOrderNo);
inInfo.addBlock(CommonConstant.Field.DETAIL).addRows(HPSC006);
return inInfo;
}
} }
...@@ -111,6 +111,7 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -111,6 +111,7 @@ public class ServiceHPSC006 extends ServiceBase {
@OperationLogAnnotation(operModul = "生产下料",operType = "新增",operDesc = "新增") @OperationLogAnnotation(operModul = "生产下料",operType = "新增",operDesc = "新增")
@Override @Override
public EiInfo insert(EiInfo inInfo) { public EiInfo insert(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try { try {
HPSC006 HPSC006 = new HPSC006(); HPSC006 HPSC006 = new HPSC006();
String productionOrderNo = inInfo.getString("productionOrderNo"); String productionOrderNo = inInfo.getString("productionOrderNo");
...@@ -143,19 +144,19 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -143,19 +144,19 @@ public class ServiceHPSC006 extends ServiceBase {
DaoUtils.insert("HPSC006.insert",HPSC006); DaoUtils.insert("HPSC006.insert",HPSC006);
} }
//刷新 //刷新
inInfo = this.refreshHPSC006(inInfo, productionOrderNo); outInfo = this.refreshHPSC006(outInfo, productionOrderNo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS); outInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!"); outInfo.setMsg("新增成功!");
} catch (PlatException e) { } catch (PlatException e) {
e.printStackTrace(); e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE); outInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!"); outInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage()); outInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage()); logError("新增失败", e.getMessage());
return inInfo; return outInfo;
} }
return inInfo; return outInfo;
} }
private EiInfo refreshHPSC006(EiInfo inInfo, String productionOrderNo) { private EiInfo refreshHPSC006(EiInfo inInfo, String productionOrderNo) {
List<HPSC006> HPSC006 = HPSCTools.Hpsc006.get(productionOrderNo); List<HPSC006> HPSC006 = HPSCTools.Hpsc006.get(productionOrderNo);
...@@ -167,6 +168,7 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -167,6 +168,7 @@ public class ServiceHPSC006 extends ServiceBase {
*/ */
@OperationLogAnnotation(operModul = "生产下料",operType = "修改",operDesc = "修改") @OperationLogAnnotation(operModul = "生产下料",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) { public EiInfo update(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try { try {
HPSC006 HPSC006 = new HPSC006(); HPSC006 HPSC006 = new HPSC006();
String productionOrderNo = inInfo.getString("productionOrderNo"); String productionOrderNo = inInfo.getString("productionOrderNo");
...@@ -192,16 +194,18 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -192,16 +194,18 @@ public class ServiceHPSC006 extends ServiceBase {
HPSC006.setFactoryName(HPXSTools.XsOrg.get(HPSC006.getOrgNo()).getOrgCname()); HPSC006.setFactoryName(HPXSTools.XsOrg.get(HPSC006.getOrgNo()).getOrgCname());
DaoUtils.update("HPSC006.update",HPSC006); DaoUtils.update("HPSC006.update",HPSC006);
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); //刷新
inInfo.setMsg("修改成功!"); outInfo = this.refreshHPSC006(outInfo, productionOrderNo);
outInfo.setStatus(EiConstant.STATUS_SUCCESS);
outInfo.setMsg("新增成功!");
} catch (PlatException e) { } catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE); outInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!"); outInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage()); outInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage()); logError("修改失败", e.getMessage());
return inInfo; return outInfo;
} }
return query(inInfo); return outInfo;
} }
/** /**
...@@ -268,6 +272,7 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -268,6 +272,7 @@ public class ServiceHPSC006 extends ServiceBase {
*/ */
@OperationLogAnnotation(operModul = "生产下料",operType = "新增",operDesc = "分派") @OperationLogAnnotation(operModul = "生产下料",operType = "新增",operDesc = "分派")
public EiInfo assign(EiInfo eiInfo) { public EiInfo assign(EiInfo eiInfo) {
EiInfo outInfo = new EiInfo();
try { try {
String ids = eiInfo.get("ids").toString(); String ids = eiInfo.get("ids").toString();
String factoryCode = eiInfo.get("factoryCode").toString(); String factoryCode = eiInfo.get("factoryCode").toString();
...@@ -276,6 +281,8 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -276,6 +281,8 @@ public class ServiceHPSC006 extends ServiceBase {
String groupName = eiInfo.get("groupName").toString(); String groupName = eiInfo.get("groupName").toString();
String [] id = ids.split(","); String [] id = ids.split(",");
HPSC006 hpsc006 = HPSCTools.Hpsc006.getById(NumberUtils.toLong(id[0]));
String productionOrderNo = hpsc006.getProductionOrderNo();
for (int i = 0; i < id.length; i++) { for (int i = 0; i < id.length; i++) {
// 更新HPSC005的数据 // 更新HPSC005的数据
HPSC006 HPSC006 = new HPSC006(); HPSC006 HPSC006 = new HPSC006();
...@@ -288,16 +295,18 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -288,16 +295,18 @@ public class ServiceHPSC006 extends ServiceBase {
DaoUtils.update("HPSC006.updateAssign", HPSC006.toMap()); DaoUtils.update("HPSC006.updateAssign", HPSC006.toMap());
} }
eiInfo.setStatus(EiConstant.STATUS_SUCCESS); //刷新
eiInfo.setMsg("分派成功!"); outInfo = this.refreshHPSC006(outInfo, productionOrderNo);
outInfo.setStatus(EiConstant.STATUS_SUCCESS);
outInfo.setMsg("新增成功!");
} catch (PlatException e) { } catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE); outInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("分派失败!原因参见详细错误描述!"); outInfo.setMsg("分派失败!原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage()); outInfo.setDetailMsg(e.getMessage());
logError("分派失败", e.getMessage()); logError("分派失败", e.getMessage());
return eiInfo; return outInfo;
} }
return query(eiInfo); return outInfo;
} }
} }
...@@ -117,7 +117,7 @@ public class ServiceHPSC007 extends ServiceBase { ...@@ -117,7 +117,7 @@ public class ServiceHPSC007 extends ServiceBase {
DaoUtils.insert("HPSC007.insert",HPSC007); DaoUtils.insert("HPSC007.insert",HPSC007);
} }
// 修改下料表中的字段 // 修改下料表中的字段
AssertUtils.isGt(totalNum, HPSC006.getNum(), "登记数量不能大于计划数量!");
HPSC006.setActualCompletionNum(HPSC006.getActualCompletionNum().add(totalNum)); HPSC006.setActualCompletionNum(HPSC006.getActualCompletionNum().add(totalNum));
HPSC006.setActualCompletionTotalWt(HPSC006.getActualCompletionTotalWt().add(actualCompletionTotalWt)); HPSC006.setActualCompletionTotalWt(HPSC006.getActualCompletionTotalWt().add(actualCompletionTotalWt));
if (HPSC006.getActualCompletionNum().compareTo(HPSC006.getNum()) >= 0) { if (HPSC006.getActualCompletionNum().compareTo(HPSC006.getNum()) >= 0) {
...@@ -181,6 +181,7 @@ public class ServiceHPSC007 extends ServiceBase { ...@@ -181,6 +181,7 @@ public class ServiceHPSC007 extends ServiceBase {
DaoUtils.insert("HPSC007.update",HPSC007); DaoUtils.insert("HPSC007.update",HPSC007);
} }
// 修改下料表中的字段 // 修改下料表中的字段
AssertUtils.isGt(HPSC006.getActualCompletionNum().add(totalNum), HPSC006.getNum(), "登记数量不能大于计划数量!");
HPSC006.setActualCompletionNum(HPSC006.getActualCompletionNum().add(totalNum)); HPSC006.setActualCompletionNum(HPSC006.getActualCompletionNum().add(totalNum));
HPSC006.setActualCompletionTotalWt(HPSC006.getActualCompletionTotalWt().add(actualCompletionTotalWt)); HPSC006.setActualCompletionTotalWt(HPSC006.getActualCompletionTotalWt().add(actualCompletionTotalWt));
if (HPSC006.getActualCompletionNum().compareTo(HPSC006.getNum()) >= 0) { if (HPSC006.getActualCompletionNum().compareTo(HPSC006.getNum()) >= 0) {
......
...@@ -135,87 +135,87 @@ function showUploadFile(id) { ...@@ -135,87 +135,87 @@ function showUploadFile(id) {
}); });
} }
function check(id, auditStatus,planInfoNo) { function check(id, auditStatus,planInfoNo) {
// const inEiInfo = new EiInfo(); const inEiInfo = new EiInfo();
// inEiInfo.set("id", id); inEiInfo.set("id", id);
// inEiInfo.set("planInfoNo",planInfoNo); inEiInfo.set("planInfoNo",planInfoNo);
// //先判断本身是否填写 //先判断本身是否填写
// EiCommunicator.send('HPSC003', 'getInfo', inEiInfo, { EiCommunicator.send('HPSC003', 'getInfo', inEiInfo, {
// onSuccess(ei) { onSuccess(ei) {
// var model=ei.get("model"); var model=ei.get("model");
// if(!(model.planCompletionDate).trim()) { if(!(model.planCompletionDate).trim()) {
// NotificationUtil("提交失败!原因:基本信息中计划完成日期未填写", "error"); NotificationUtil("提交失败!原因:基本信息中计划完成日期未填写", "error");
// return; return;
// } else { } else {
// //提交 //提交
// //提交前先判断明细信息中的计划开始和计划结束时间是否都已经填写,只有填写了之后才能进行提交 //提交前先判断明细信息中的计划开始和计划结束时间是否都已经填写,只有填写了之后才能进行提交
// if (auditStatus == 1) { if (auditStatus == 1) {
// EiCommunicator.send('HPSC004', 'inspectDetail', inEiInfo, { EiCommunicator.send('HPSC004', 'inspectDetail', inEiInfo, {
// onSuccess(ei) { onSuccess(ei) {
// var list=ei.get("list"); var list=ei.get("list");
// if(list) { if(list) {
// var count = list[0]; var count = list[0];
// if (count > 0) { if (count > 0) {
// NotificationUtil("提交失败!原因:明细信息中有未填写的计划开始时间或计划结束时间", "error"); NotificationUtil("提交失败!原因:明细信息中有未填写的计划开始时间或计划结束时间", "error");
// } else { } else {
// EiCommunicator.send('HPSC004','queryDetail',inEiInfo,{ EiCommunicator.send('HPSC004','queryDetail',inEiInfo,{
// onSuccess(ei){ onSuccess(ei){
// var rows = ei.blocks.detail.rows; var rows = ei.blocks.detail.rows;
// var res = check_time(model,rows); var res = check_time(model,rows);
// if (!res){ if (!res){
// NotificationUtil("计划结束时间应该大于计划开始时间!", "error"); NotificationUtil("计划结束时间应该大于计划开始时间!", "error");
// } }
// else { else {
// // 提交通过,生成 // 提交通过,生成
// EiCommunicator.send('HPSC003', 'submitPlan', inEiInfo, { EiCommunicator.send('HPSC003', 'submitPlan', inEiInfo, {
// onSuccess(response) { onSuccess(response) {
// NotificationUtil(response.msg); NotificationUtil(response.msg);
// console.log(response) console.log(response)
// autoProductionschedul(response.get('planInfoNo')); autoProductionschedul(response.get('planInfoNo'));
// resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
// }, },
// onFail(errorMessage, status, e) { onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error"); NotificationUtil("执行失败!", "error");
// } }
// }, },
// { {
// async: false async: false
// } }
// ); );
// } }
//
//
// }
// })
//
// }
// } else {
// NotificationUtil("提交失败!未找到明细信息", "error");
// }
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
// } else {
// // 撤回
//
// }
// }
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
autoProductionschedul('SCJH24030700006');
}
})
}
} else {
NotificationUtil("提交失败!未找到明细信息", "error");
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
} else {
// 撤回
}
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
// autoProductionschedul('SCJH24030700006');
} }
/** /**
...@@ -242,8 +242,8 @@ function autoProductionschedulCallback (factoryCode,planInfoNo) { ...@@ -242,8 +242,8 @@ function autoProductionschedulCallback (factoryCode,planInfoNo) {
href: "HPSC003B?methodName=initLoad&inqu_status-0-planInfoNo=" + planInfoNo + href: "HPSC003B?methodName=initLoad&inqu_status-0-planInfoNo=" + planInfoNo +
'&inqu_status-0-factoryCode=' + factoryCode, '&inqu_status-0-factoryCode=' + factoryCode,
title: "<div style='text-align: center;'>自动排产</div>", title: "<div style='text-align: center;'>自动排产</div>",
width: "80%", // width: "80%",
height: "80%", // height: "80%",
callbackName: autoProductionschedulCallback1 callbackName: autoProductionschedulCallback1
}); });
} else { } else {
......
...@@ -14,6 +14,16 @@ $(function () { ...@@ -14,6 +14,16 @@ $(function () {
$('#confirm').on('click',function () { $('#confirm').on('click',function () {
var factoryCode = $('#inqu_status-0-factoryCode').val(); var factoryCode = $('#inqu_status-0-factoryCode').val();
var planInfoNo = $('#inqu_status-0-planInfoNo').val(); var planInfoNo = $('#inqu_status-0-planInfoNo').val();
parent.JSColorbox.setValueCallback(factoryCode,planInfoNo); if (factoryCode) {
if (planInfoNo) {
parent.JSColorbox.setValueCallback(factoryCode,planInfoNo);
} else {
message("生产计划单号不能为空!");
return;
}
} else {
message("请选择工厂生成生产任务!");
return;
}
}) })
}); });
...@@ -5,10 +5,16 @@ $(function () { ...@@ -5,10 +5,16 @@ $(function () {
toolbarConfig: { toolbarConfig: {
hidden: true, // true时,不显示功能按钮,但保留setting导出按钮 hidden: true, // true时,不显示功能按钮,但保留setting导出按钮
}, },
pageable: { columns: [{
pageSize: 15, field: "operator",
pageSizes: [15, 50, 70, 100], title: "操作",
} template: function (item) {
let template = '';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="deleteRow(' + item.rowNo + ')" >删除</a>';
return template
}
}]
} }
} }
...@@ -22,3 +28,32 @@ function query() { ...@@ -22,3 +28,32 @@ function query() {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
} }
function deleteRow(rowNo) {
resultGrid.removeRows([rowNo]);// 刷新行号
refreshRowNo();
}
let refreshRowNo =function() {
let allRows = resultGrid.getDataItems();
for (let i = 0; i < allRows.length; i++) {
resultGrid.setCellValue(i, "rowNo", i);
resultGrid.refresh();
}
}
$(window).load(function () {
refreshRowNo();
});
/**
* 取消
*/
$('#cancel').on('click',function () {
// 关闭弹窗
parent.JSColorbox.close();
})
/**
* 确认
*/
$('#confirm').on('click',function () {
})
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
<EF:EFRegion id="result" title="记录集"> <EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override"> <EF:EFGrid blockId="result" autoDraw="override">
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
<EF:EFColumn ename="id" cname="主键" hidden="true"/> <EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="rowNo" cname="行号" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/> <EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="100" align="center"/>
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="100" align="center"/> <EF:EFColumn ename="partName" cname="零件名称" enable="false" width="100" align="center"/>
...@@ -22,10 +24,9 @@ ...@@ -22,10 +24,9 @@
<EF:EFColumn ename="factoryCode" cname="厂区" enable="false" width="140" align="center" hidden="true"/> <EF:EFColumn ename="factoryCode" cname="厂区" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="orgName" cname="生产组" enable="false" width="140" align="center" hidden="true"/> <EF:EFColumn ename="orgName" cname="生产组" enable="false" width="140" align="center" hidden="true"/>
<EF:EFComboColumn ename="orgNo" cname="生产组" width="110" align="center" defaultValue="" <EF:EFComboColumn ename="orgNo" cname="生产组" width="110" align="center" defaultValue=""
filter="contains" readonly="true"> filter="contains">
<EF:EFOptions blockId="group_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="group_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
<span style='color: red;font-size: 13px;'>注:只会对未分派的订单进行自动排产!</span> <span style='color: red;font-size: 13px;'>注:只会对未分派的订单进行自动排产!</span>
......
...@@ -397,7 +397,7 @@ assignCallback = function (row) { ...@@ -397,7 +397,7 @@ assignCallback = function (row) {
msg: '修改成功' msg: '修改成功'
}); });
// 刷新列表 // 刷新列表
resultGrid.dataSource.page(1); detailGrid.setEiInfo(ei);
// 关闭弹窗 // 关闭弹窗
JSColorbox.close(); JSColorbox.close();
} }
...@@ -458,7 +458,6 @@ function saveFunc() { ...@@ -458,7 +458,6 @@ function saveFunc() {
ok: function () { ok: function () {
JSUtils.submitGridsData("detail", "HPSC006", "insert", true, JSUtils.submitGridsData("detail", "HPSC006", "insert", true,
function (e) { function (e) {
query();
detailGrid.setEiInfo(e); detailGrid.setEiInfo(e);
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment