Commit 94397c7b by liuyang

生产计划添加排产功能

parent ac45f1a3
...@@ -382,4 +382,39 @@ public class ServiceHPSC103 extends ServiceEPBase { ...@@ -382,4 +382,39 @@ public class ServiceHPSC103 extends ServiceEPBase {
} }
} }
} }
@OperationLogAnnotation(operModul = "生产计划", operType = "排产", operDesc = "提交排产")
public EiInfo submitProduc(EiInfo inInfo) {
try {
List<HPSC003> hpsc003s = MapUtils.toDaoEPBases(inInfo, HPSC003.class);
for (HPSC003 hpsc003 : hpsc003s) {
List<HPSC004> hpsc004s = HPSCTools.HpSc004.queryByParent(hpsc003.getPlanInfoNo());
for (HPSC004 hpsc004:hpsc004s) {
String startDate =handleEndDate(hpsc004.getPlanCommentDate());
String endDate =handleEndDate(hpsc004.getPlanCompletionDate());
hpsc004.setPlanCommentDate(startDate);
hpsc004.setPlanCompletionDate(endDate);
DaoUtils.update(HPSC004.UPDATE, hpsc004);
}
String planCompletionDate =handleEndDate(hpsc003.getPlanCompletionDate());
hpsc003.setPlanCompletionDate(planCompletionDate);
DaoUtils.update(HPSC003.UPDATE, hpsc003);
}
}catch (PlatException e){
LogUtils.setMsg(inInfo,e,"提交排产失败");
}
return inInfo;
}
/**
* 处理计划完成日期
* @param endDate 计划完成日期
* @return 处理后的计划完成日期减3天
*/
private static String handleEndDate(String endDate){
if(StringUtils.isNotBlank(endDate)){
endDate = DateUtils.toDateStr(DateUtils.addDays(DateUtils.toDate(endDate,DateUtils.DATE8_PATTERN),-3),DateUtils.DATE8_PATTERN);
}
return endDate;
}
} }
...@@ -66,6 +66,10 @@ $(function () { ...@@ -66,6 +66,10 @@ $(function () {
pageOffset = e.page; pageOffset = e.page;
console.log(e.page); console.log(e.page);
}, },
loadComplete: function (grid) {
//此grid对象
$("#SUBMIT_PRODUC").on("click",submitProduc);
},
onSave: function (e) { onSave: function (e) {
// 阻止默认请求,使用自定义保存 // 阻止默认请求,使用自定义保存
e.preventDefault(); e.preventDefault();
...@@ -462,3 +466,39 @@ let imgClick = function (docId) { ...@@ -462,3 +466,39 @@ let imgClick = function (docId) {
$(this).fadeOut("fast"); $(this).fadeOut("fast");
}); });
} }
let submitProduc = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(status == "1"){
message("选中的第"+(index+1)+"行\"任务已提交\",不能排产!");
flag = false;
return false;
}
});
if (flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"排产\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC003", "submitProduc", true,
function (ei) {
if (ei.getStatus() >= 0) {
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
query();
} else {
NotificationUtil(ei, "error");
}
})
}
});
}
}
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