Commit d0ddda17 by yukang

增加智能排产

parent 46955641
package com.baosight.hpjx.hp.ff.service;
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.HPSC006;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.ExcelUtils;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ServiceHPFF001 extends ServiceEPBase {
......@@ -48,7 +51,14 @@ public class ServiceHPFF001 extends ServiceEPBase {
map1.put("productionOrderNo",productionOrderNo);
map1.put("inventType","7");
ExcelUtils.importFromExcel(inInfo, fileName,map1, new HPSC006());
inInfo = this.refreshHPSC006(inInfo, productionOrderNo);
}
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 {
@OperationLogAnnotation(operModul = "生产下料",operType = "新增",operDesc = "新增")
@Override
public EiInfo insert(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try {
HPSC006 HPSC006 = new HPSC006();
String productionOrderNo = inInfo.getString("productionOrderNo");
......@@ -143,19 +144,19 @@ public class ServiceHPSC006 extends ServiceBase {
DaoUtils.insert("HPSC006.insert",HPSC006);
}
//刷新
inInfo = this.refreshHPSC006(inInfo, productionOrderNo);
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
outInfo = this.refreshHPSC006(outInfo, productionOrderNo);
outInfo.setStatus(EiConstant.STATUS_SUCCESS);
outInfo.setMsg("新增成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
outInfo.setStatus(EiConstant.STATUS_FAILURE);
outInfo.setMsg("新增失败!原因参见详细错误描述!");
outInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
return outInfo;
}
return inInfo;
return outInfo;
}
private EiInfo refreshHPSC006(EiInfo inInfo, String productionOrderNo) {
List<HPSC006> HPSC006 = HPSCTools.Hpsc006.get(productionOrderNo);
......@@ -167,6 +168,7 @@ public class ServiceHPSC006 extends ServiceBase {
*/
@OperationLogAnnotation(operModul = "生产下料",operType = "修改",operDesc = "修改")
public EiInfo update(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
try {
HPSC006 HPSC006 = new HPSC006();
String productionOrderNo = inInfo.getString("productionOrderNo");
......@@ -192,16 +194,18 @@ public class ServiceHPSC006 extends ServiceBase {
HPSC006.setFactoryName(HPXSTools.XsOrg.get(HPSC006.getOrgNo()).getOrgCname());
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) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
outInfo.setStatus(EiConstant.STATUS_FAILURE);
outInfo.setMsg("操作失败!原因参见详细错误描述!");
outInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
return outInfo;
}
return query(inInfo);
return outInfo;
}
/**
......@@ -268,6 +272,7 @@ public class ServiceHPSC006 extends ServiceBase {
*/
@OperationLogAnnotation(operModul = "生产下料",operType = "新增",operDesc = "分派")
public EiInfo assign(EiInfo eiInfo) {
EiInfo outInfo = new EiInfo();
try {
String ids = eiInfo.get("ids").toString();
String factoryCode = eiInfo.get("factoryCode").toString();
......@@ -276,6 +281,8 @@ public class ServiceHPSC006 extends ServiceBase {
String groupName = eiInfo.get("groupName").toString();
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++) {
// 更新HPSC005的数据
HPSC006 HPSC006 = new HPSC006();
......@@ -288,16 +295,18 @@ public class ServiceHPSC006 extends ServiceBase {
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) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("分派失败!原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
outInfo.setStatus(EiConstant.STATUS_FAILURE);
outInfo.setMsg("分派失败!原因参见详细错误描述!");
outInfo.setDetailMsg(e.getMessage());
logError("分派失败", e.getMessage());
return eiInfo;
return outInfo;
}
return query(eiInfo);
return outInfo;
}
}
......@@ -117,7 +117,7 @@ public class ServiceHPSC007 extends ServiceBase {
DaoUtils.insert("HPSC007.insert",HPSC007);
}
// 修改下料表中的字段
AssertUtils.isGt(totalNum, HPSC006.getNum(), "登记数量不能大于计划数量!");
HPSC006.setActualCompletionNum(HPSC006.getActualCompletionNum().add(totalNum));
HPSC006.setActualCompletionTotalWt(HPSC006.getActualCompletionTotalWt().add(actualCompletionTotalWt));
if (HPSC006.getActualCompletionNum().compareTo(HPSC006.getNum()) >= 0) {
......@@ -181,6 +181,7 @@ public class ServiceHPSC007 extends ServiceBase {
DaoUtils.insert("HPSC007.update",HPSC007);
}
// 修改下料表中的字段
AssertUtils.isGt(HPSC006.getActualCompletionNum().add(totalNum), HPSC006.getNum(), "登记数量不能大于计划数量!");
HPSC006.setActualCompletionNum(HPSC006.getActualCompletionNum().add(totalNum));
HPSC006.setActualCompletionTotalWt(HPSC006.getActualCompletionTotalWt().add(actualCompletionTotalWt));
if (HPSC006.getActualCompletionNum().compareTo(HPSC006.getNum()) >= 0) {
......
......@@ -135,87 +135,87 @@ function showUploadFile(id) {
});
}
function check(id, auditStatus,planInfoNo) {
// const inEiInfo = new EiInfo();
// inEiInfo.set("id", id);
// inEiInfo.set("planInfoNo",planInfoNo);
// //先判断本身是否填写
// EiCommunicator.send('HPSC003', 'getInfo', inEiInfo, {
// onSuccess(ei) {
// var model=ei.get("model");
// if(!(model.planCompletionDate).trim()) {
// NotificationUtil("提交失败!原因:基本信息中计划完成日期未填写", "error");
// return;
// } else {
// //提交
// //提交前先判断明细信息中的计划开始和计划结束时间是否都已经填写,只有填写了之后才能进行提交
// if (auditStatus == 1) {
// EiCommunicator.send('HPSC004', 'inspectDetail', inEiInfo, {
// onSuccess(ei) {
// var list=ei.get("list");
// if(list) {
// var count = list[0];
// if (count > 0) {
// NotificationUtil("提交失败!原因:明细信息中有未填写的计划开始时间或计划结束时间", "error");
// } else {
// EiCommunicator.send('HPSC004','queryDetail',inEiInfo,{
// onSuccess(ei){
// var rows = ei.blocks.detail.rows;
// var res = check_time(model,rows);
// if (!res){
// NotificationUtil("计划结束时间应该大于计划开始时间!", "error");
// }
// else {
// // 提交通过,生成
// EiCommunicator.send('HPSC003', 'submitPlan', inEiInfo, {
// onSuccess(response) {
// NotificationUtil(response.msg);
// console.log(response)
// autoProductionschedul(response.get('planInfoNo'));
// resultGrid.dataSource.page(1);
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
// }
//
//
// }
// })
//
// }
// } else {
// NotificationUtil("提交失败!未找到明细信息", "error");
// }
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
// } else {
// // 撤回
//
// }
// }
// },
// onFail(errorMessage, status, e) {
// NotificationUtil("执行失败!", "error");
// }
// },
// {
// async: false
// }
// );
const inEiInfo = new EiInfo();
inEiInfo.set("id", id);
inEiInfo.set("planInfoNo",planInfoNo);
//先判断本身是否填写
EiCommunicator.send('HPSC003', 'getInfo', inEiInfo, {
onSuccess(ei) {
var model=ei.get("model");
if(!(model.planCompletionDate).trim()) {
NotificationUtil("提交失败!原因:基本信息中计划完成日期未填写", "error");
return;
} else {
//提交
//提交前先判断明细信息中的计划开始和计划结束时间是否都已经填写,只有填写了之后才能进行提交
if (auditStatus == 1) {
EiCommunicator.send('HPSC004', 'inspectDetail', inEiInfo, {
onSuccess(ei) {
var list=ei.get("list");
if(list) {
var count = list[0];
if (count > 0) {
NotificationUtil("提交失败!原因:明细信息中有未填写的计划开始时间或计划结束时间", "error");
} else {
EiCommunicator.send('HPSC004','queryDetail',inEiInfo,{
onSuccess(ei){
var rows = ei.blocks.detail.rows;
var res = check_time(model,rows);
if (!res){
NotificationUtil("计划结束时间应该大于计划开始时间!", "error");
}
else {
// 提交通过,生成
EiCommunicator.send('HPSC003', 'submitPlan', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
console.log(response)
autoProductionschedul(response.get('planInfoNo'));
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
}
})
}
} else {
NotificationUtil("提交失败!未找到明细信息", "error");
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
} else {
// 撤回
}
}
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
autoProductionschedul('SCJH24030700006');
// autoProductionschedul('SCJH24030700006');
}
/**
......@@ -242,8 +242,8 @@ function autoProductionschedulCallback (factoryCode,planInfoNo) {
href: "HPSC003B?methodName=initLoad&inqu_status-0-planInfoNo=" + planInfoNo +
'&inqu_status-0-factoryCode=' + factoryCode,
title: "<div style='text-align: center;'>自动排产</div>",
width: "80%",
height: "80%",
// width: "80%",
// height: "80%",
callbackName: autoProductionschedulCallback1
});
} else {
......
......@@ -14,6 +14,16 @@ $(function () {
$('#confirm').on('click',function () {
var factoryCode = $('#inqu_status-0-factoryCode').val();
var planInfoNo = $('#inqu_status-0-planInfoNo').val();
if (factoryCode) {
if (planInfoNo) {
parent.JSColorbox.setValueCallback(factoryCode,planInfoNo);
} else {
message("生产计划单号不能为空!");
return;
}
} else {
message("请选择工厂生成生产任务!");
return;
}
})
});
......@@ -5,10 +5,16 @@ $(function () {
toolbarConfig: {
hidden: true, // true时,不显示功能按钮,但保留setting导出按钮
},
pageable: {
pageSize: 15,
pageSizes: [15, 50, 70, 100],
columns: [{
field: "operator",
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() {
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 @@
<EF:EFRegion id="result" title="记录集">
<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="rowNo" cname="行号" hidden="true"/>
<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="partName" cname="零件名称" enable="false" width="100" align="center"/>
......@@ -22,10 +24,9 @@
<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: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:EFComboColumn>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="80" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
<span style='color: red;font-size: 13px;'>注:只会对未分派的订单进行自动排产!</span>
......
......@@ -397,7 +397,7 @@ assignCallback = function (row) {
msg: '修改成功'
});
// 刷新列表
resultGrid.dataSource.page(1);
detailGrid.setEiInfo(ei);
// 关闭弹窗
JSColorbox.close();
}
......@@ -458,7 +458,6 @@ function saveFunc() {
ok: function () {
JSUtils.submitGridsData("detail", "HPSC006", "insert", true,
function (e) {
query();
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