Commit b90a3719 by liuyang

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

parent d787e9af
......@@ -318,24 +318,21 @@ public class ServiceHPSC005A extends ServiceBase {
@OperationLogAnnotation(operModul = "拆单派工",operType = "撤销",operDesc = "生产订单-拆单派工A-撤销")
public EiInfo revocation(EiInfo inInfo) {
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());
// 校验主订单是否已分派
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));
List<HPZL001> hpzl001List = HPZLTools.getByprodOrderNos(prodOrderNos);
AssertUtils.isTrue(CollectionUtils.isNotEmpty(hpzl001List), "生产订单已经进入质检环节,无法撤销");
hgsc005.setStatus(ProdOrderStatusEnum.NOT_ASSIGN.getCode());
hgsc005.setAssignedNum(BigDecimal.ZERO);
hgsc005.setUnassignedNum(hgsc005.getNum());
DaoUtils.update(HPSC005.UPDATE, hgsc005);
for (HPSC005A hgsc005A: hgsc005AList) {
DaoUtils.update(HPSC005A.DELETE, hgsc005A);
List<HPSC005A> hgsc005AList = HPSCTools.HpSc005a.getByProdOrderNo(prodOrderNos);
for (HPSC005 hgsc005:hgsc005List) {
hgsc005.setStatus(ProdOrderStatusEnum.NOT_ASSIGN.getCode());
hgsc005.setAssignedNum(BigDecimal.ZERO);
hgsc005.setUnassignedNum(hgsc005.getNum());
DaoUtils.update(HPSC005.UPDATE, hgsc005);
}
hgsc005AList.forEach(hgsc005A -> DaoUtils.update(HPSC005A.DELETE, hgsc005A));
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + 1 + "]条数据撤销成功!");
} catch (Exception e) {
......
......@@ -32,10 +32,6 @@ $(function () {
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ '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) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ')" >附件</a>';
......@@ -55,8 +51,11 @@ $(function () {
}
}
],
loadComplete: function(grid) {
$("#BNT_REVOCA").on("click", revocation)
}
]
}
});
......@@ -234,36 +233,38 @@ function assignChange() {
}
}
function revocation(prodOrderNo) {
JSUtils.confirm(" 确定要撤销派工吗?", {
ok: function () {
var info = new EiInfo();
info.set("prodOrderNo", prodOrderNo)
EiCommunicator.send("HPSC005A", "revocation", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
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(" 确定要撤销派工吗?", {
ok: function () {
JSUtils.submitGrid("result", "HPSC005A", "revocation",
{onSuccessCallback: function(ei){
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({msg: ei.msg}, "success");
query();
}
}
}
)
}
});
}
}
/**
......
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