Commit b90a3719 by liuyang

2024-09-24 生产订单增加撤销功能

parent d787e9af
...@@ -318,24 +318,21 @@ public class ServiceHPSC005A extends ServiceBase { ...@@ -318,24 +318,21 @@ public class ServiceHPSC005A extends ServiceBase {
@OperationLogAnnotation(operModul = "拆单派工",operType = "撤销",operDesc = "生产订单-拆单派工A-撤销") @OperationLogAnnotation(operModul = "拆单派工",operType = "撤销",operDesc = "生产订单-拆单派工A-撤销")
public EiInfo revocation(EiInfo inInfo) { public EiInfo revocation(EiInfo inInfo) {
try { try {
String prodOrderNo = inInfo.getString("prodOrderNo"); //生产订单号 List<HPSC005> hgsc005List =MapUtils.toDaoEPBases(inInfo, HPSC005.class);
List<String> prodOrderNos =hgsc005List.stream().map(HPSC005::getProdOrderNo).collect(Collectors.toList());
// 校验主订单是否已分派 List<HPZL001> hpzl001List = HPZLTools.getByprodOrderNos(prodOrderNos);
HPSC005 hgsc005 = HPSCTools.HpSc005.get(prodOrderNo);
AssertUtils.isEmpty(Collections.singleton(hgsc005), "未找到生产订单信息");
//List<String> prodOrderNos = hgsc005List.stream().map(HPSC005::getProdOrderNo).collect(Collectors.toList());
List<HPSC005A> hgsc005AList = HPSCTools.HpSc005a.getByProdOrderNo(prodOrderNo);
List<HPZL001> hpzl001List = HPZLTools.getByprodOrderNos(Arrays.asList(prodOrderNo));
AssertUtils.isTrue(CollectionUtils.isNotEmpty(hpzl001List), "生产订单已经进入质检环节,无法撤销"); AssertUtils.isTrue(CollectionUtils.isNotEmpty(hpzl001List), "生产订单已经进入质检环节,无法撤销");
List<HPSC005A> hgsc005AList = HPSCTools.HpSc005a.getByProdOrderNo(prodOrderNos);
for (HPSC005 hgsc005:hgsc005List) {
hgsc005.setStatus(ProdOrderStatusEnum.NOT_ASSIGN.getCode()); hgsc005.setStatus(ProdOrderStatusEnum.NOT_ASSIGN.getCode());
hgsc005.setAssignedNum(BigDecimal.ZERO); hgsc005.setAssignedNum(BigDecimal.ZERO);
hgsc005.setUnassignedNum(hgsc005.getNum()); hgsc005.setUnassignedNum(hgsc005.getNum());
DaoUtils.update(HPSC005.UPDATE, hgsc005); DaoUtils.update(HPSC005.UPDATE, hgsc005);
for (HPSC005A hgsc005A: hgsc005AList) {
DaoUtils.update(HPSC005A.DELETE, hgsc005A);
} }
hgsc005AList.forEach(hgsc005A -> DaoUtils.update(HPSC005A.DELETE, hgsc005A));
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + 1 + "]条数据撤销成功!"); inInfo.setMsg("操作成功!本次对[" + 1 + "]条数据撤销成功!");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -32,10 +32,6 @@ $(function () { ...@@ -32,10 +32,6 @@ $(function () {
} }
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showGroupDetail(\'' + prodOrderNo + '\')" >任务详情</a>'; + 'onclick="showGroupDetail(\'' + prodOrderNo + '\')" >任务详情</a>';
if (status > 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="revocation(\'' + prodOrderNo + '\')" >撤销</a>';
}
if (filePath1) { if (filePath1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ')" >附件</a>'; + 'onclick="showUploadFile(' + filePath1 + ')" >附件</a>';
...@@ -55,8 +51,11 @@ $(function () { ...@@ -55,8 +51,11 @@ $(function () {
} }
} }
],
loadComplete: function(grid) {
$("#BNT_REVOCA").on("click", revocation)
}
]
} }
}); });
...@@ -234,36 +233,38 @@ function assignChange() { ...@@ -234,36 +233,38 @@ function assignChange() {
} }
} }
function revocation(prodOrderNo) { function revocation() {
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要撤销的数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
if(item.status == 0){
message(`选中第${index+1}行的生产订单未派工,无法撤销!`)
flag = false;
return false;
}
});
if (flag){
JSUtils.confirm(" 确定要撤销派工吗?", { JSUtils.confirm(" 确定要撤销派工吗?", {
ok: function () { ok: function () {
var info = new EiInfo(); JSUtils.submitGrid("result", "HPSC005A", "revocation",
info.set("prodOrderNo", prodOrderNo) {onSuccessCallback: function(ei){
EiCommunicator.send("HPSC005A", "revocation", info, { if (ei["status"] == -1) {
onSuccess: function (ei) { NotificationUtil(ei, "error");
if (ei.getStatus() >= 0) {
try {
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else { } else {
NotificationUtil(ei); NotificationUtil({msg: ei.msg}, "success");
}
query(); query();
} else {
NotificationUtil(ei, "error");
} }
},
onFail: function (ei) {
// 发生异常
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