代码更新

This commit is contained in:
2023-02-02 14:28:23 +08:00
parent 44d179c360
commit 28217e9bee

View File

@@ -11,12 +11,16 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.basedata.st.service.StructattrService;
import org.nl.wms.basedata.st.service.dto.StructattrDto;
import org.nl.wms.basedata.st.service.impl.StructattrServiceImpl;
import org.nl.wms.sch.AcsTaskDto;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.sch.service.TaskService;
import org.nl.wms.st.inbill.service.impl.InbillServiceImpl;
import org.nl.wms.st.inbill.service.impl.RawAssistIStorServiceImpl;
import org.nl.wms.st.inbill.service.impl.StorPublicServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
@@ -28,6 +32,7 @@ import java.util.Map;
* Created by ZZ on 2021/12/22.
*/
public class InTask extends AbstractAcsTask {
private final String THIS_CLASS = InTask.class.getName();
@Override
@@ -72,6 +77,8 @@ public class InTask extends AbstractAcsTask {
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配表
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); // 出入库明细表
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
@@ -95,15 +102,83 @@ public class InTask extends AbstractAcsTask {
inbillService.confirmDis(dis_form);
}
if (StrUtil.equals(status, "0")) {
// 更新删除字段
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
if (taskObj.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.ISSUE.getCode())) {
throw new BadRequestException("任务已执行不能取消");
}
// 更新任务表删除字段
map.put("is_delete","1");
// 更新分配明细为:未生成
JSONObject mapParam = new JSONObject();
mapParam.put("work_status", "00");
mapParam.put("point_id", "");
JSONObject jsonDis = disTab.query("task_id ='" + taskObj.getString("task_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonDis)) throw new BadRequestException("分配明细不存在");
String iostorinv_id = jsonDis.getString("iostorinv_id");
disTab.update(map,"task_id = '"+taskObj.getString("task_id")+"'");
// 解锁货位
HashMap unlock_map = new HashMap();
unlock_map.put("lock_type", "1");
unlock_map.put("taskdtl_type", "");
unlock_map.put("taskdtl_id", "");
unlock_map.put("task_code", "");
unlock_map.put("inv_type", "");
unlock_map.put("inv_id", "");
unlock_map.put("inv_code", "");
point_table.update(unlock_map, "point_code = '" + taskObj.get("point_code2") + "'");
struct_table.update(unlock_map, "struct_code = '" + taskObj.get("point_code2") + "'");
//减去原货位的待入数
JSONArray dis_rows = disTab.query("struct_code = '" + taskObj.get("point_code2") + "' AND work_status < '99'").getResultJSONArray(0);
if (dis_rows.size() <= 0) {
throw new BadRequestException("数据参数有误!");
}
StructattrDto old_struct = new StructattrServiceImpl().findByCode(taskObj.getString("point_code2"));
JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + dis_rows.getJSONObject(0).getString("iostorinv_id") + "'").uniqueResult(0);
for (int i = 0; i < dis_rows.size(); i++) {
JSONObject i_form = new JSONObject();
JSONObject dis_row = dis_rows.getJSONObject(i);
i_form.put("struct_id", old_struct.getStruct_id());
i_form.put("material_id", dis_row.getString("material_id"));
i_form.put("quality_scode", dis_row.getString("quality_scode"));
i_form.put("pcsn", dis_row.getString("pcsn"));
i_form.put("ivt_level", dis_row.getString("ivt_level"));
i_form.put("change_qty", dis_row.getString("plan_qty"));
i_form.put("bill_type_scode", mst_jo.getString("bill_type"));
i_form.put("inv_id", mst_jo.getString("iostorinv_id"));
i_form.put("bill_code", mst_jo.getString("bill_code"));
i_form.put("bill_table", "ST_IVT_IOStorInv");
i_form.put("qty_unit_id", dis_row.getString("qty_unit_id"));
i_form.put("qty_unit_name", dis_row.getString("qty_unit_name"));
new StorPublicServiceImpl().IOStor(i_form,"32");
}
// 修改主表状态为分配中30
JSONObject mstMap = new JSONObject();
mstMap.put("bill_status", "30");
mstMap.put("update_optid", currentUserId);
mstMap.put("update_optname", nickName);
mstMap.put("update_time", now);
mstTab.update(mstMap,"iostorinv_id = '"+iostorinv_id+"'");
// 修改明细状态为生成10
JSONObject dtlMap = new JSONObject();
dtlMap.put("bill_status", "10");
dtlTab.update(dtlMap,"iostorinv_id = '"+iostorinv_id+"'");
// 更新分配明细为:未生成:00,清空对应字段
JSONObject disMap = new JSONObject();
disMap.put("work_status", "00");
disMap.put("point_id", "");
disMap.put("task_id", "");
disMap.put("sect_id", "");
disMap.put("sect_code", "");
disMap.put("sect_name", "");
disMap.put("struct_id", "");
disMap.put("struct_code", "");
disMap.put("struct_name", "");
disTab.update(disMap,"task_id = '"+taskObj.getString("task_id")+"'");
}
map.put("update_optid", currentUserId);
map.put("update_optname", nickName);