Commit cd6434a7 by liuyang

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

parent 2a121af0
......@@ -13,10 +13,7 @@ import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.sc.util.HgScUtils;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.BeanUtils;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -161,6 +158,26 @@ public class ServiceHGSC006A extends ServiceBase {
return inInfo;
}
public EiInfo revocation(EiInfo inInfo){
try {
List<HGSC006A> hgsc006aList =MapUtils.toDaoEPBases(inInfo, HGSC006A.class);
List<Long> orderIds =hgsc006aList.stream().map(HGSC006A::getId).collect(Collectors.toList());
List<HGSC007> hgsc007List = HGSCTools.THGSC007.listByOrderDetailId(orderIds);
if (hgsc007List.size() > 0) {
List<Long> taskIds = hgsc007List.stream().map(HGSC007::getId).collect(Collectors.toList());
List<HGSC008> hgsc008List = HGSCTools.THGSC008.getByTaskId(taskIds);
AssertUtils.isNotEmpty(hgsc008List, "生产任务存在已报工,撤回失败!");
hgsc007List.forEach(hgsc007 -> DaoUtils.update(HGSC007.DELETE, hgsc007));
}
hgsc006aList.forEach(HGSCTools.THGSC006A::revocation);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgsc006aList.size() + "]条数据撤回成功!");
}catch (Exception e){
LogUtils.setMsg(inInfo, e, "撤销失败");
}
return inInfo;
}
private void cleanBaseInfo(HGSC007 hgsc007){
hgsc007.setCreatedBy(null);
hgsc007.setCreatedName(null);
......
......@@ -1522,6 +1522,16 @@ public class HGSCTools {
List<HGSC006A> results = DaoBase.getInstance().query(HGSC006A.QUERY_OTHER, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
public static void revocation(HGSC006A hgsc006a) {
AssertUtils.isTrue(Objects.isNull(hgsc006a) || Objects.isNull(hgsc006a.getId()) || hgsc006a.getId() <= 0, "生产订单明细ID不能为空!");
hgsc006a.setAssignStatus(UNASSIGN.getCode());
hgsc006a.setAssignQuantity(BigDecimal.ZERO);
hgsc006a.setAssignWeight(BigDecimal.ZERO);
hgsc006a.setUnassignQuantity(hgsc006a.getQuantity());
hgsc006a.setUnassignWeight(hgsc006a.getTotalWeight());
DaoBase.getInstance().update(HGSC006A.UPDATE, hgsc006a);
}
}
/**
......@@ -1577,7 +1587,7 @@ public class HGSCTools {
* @param orderDetailIds
* @return
*/
public static List<HGSC007> listByOrderDetailId(List<String> orderDetailIds) {
public static List<HGSC007> listByOrderDetailId(List orderDetailIds) {
if (CollectionUtils.isEmpty(orderDetailIds)) {
return null;
}
......
......@@ -28,6 +28,8 @@ $(function () {
$("#BNT_ASSIGN").on("click", assign);
// 批量改派
$("#BNT_ASSIGN_CHANGE").on("click", assignChange);
$("#BNT_REVOCA").on("click", revocate)
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
......@@ -114,6 +116,9 @@ function assign() {
}
}
/**
* 批量改派
*/
function assignChange() {
//重置全局变量
ids = [];
......@@ -175,6 +180,42 @@ function assignChange() {
}
}
/**
* 撤销派工
*/
let revocate = function () {
//重置全局变量
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要撤销的数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
if(item.assignStatus == 0){
message(`选中第${index+1}行的生产订单未派工,无法撤销!`)
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定撤销派工?", {
ok: function() {
JSUtils.submitGrid("result", "HGSC006A", "revocation",
{onSuccessCallback: function(ei){
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({msg: ei.msg}, "success");
query();
}
}}
)
}
})
}
};
function separateAssign(orderDetailId){
JSColorbox.open({
......
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