opt:优化半成品入库点位锁定与生成任务代码;

This commit is contained in:
2023-04-14 14:26:25 +08:00
parent 797c2e84c9
commit d841b8e6c3
6 changed files with 130 additions and 138 deletions

View File

@@ -1,20 +1,23 @@
package org.nl.modules.system.util;
import org.nl.common.utils.RedissonUtils;
import org.nl.modules.system.service.GenCodeService;
import org.nl.modules.system.service.impl.GenCodeServiceImpl;
import org.nl.modules.wql.util.SpringContextHolder;
import java.util.HashMap;
public class CodeUtil {
public static String getNewCode(String ruleCode){
GenCodeService service = SpringContextHolder.getBean(GenCodeServiceImpl.class);
String flag = "1";
HashMap<String,String> map = new HashMap<>();
map.put("flag",flag);
map.put("code",ruleCode);
return service.codeDemo(map);
}
public class CodeUtil{
public static String getNewCode(String ruleCode) {
final String[] code = {""};
HashMap<String,String> map = new HashMap<>();
map.put("flag", "1");
map.put("code", ruleCode);
GenCodeService service = SpringContextHolder.getBean(GenCodeServiceImpl.class);
String codeId = service.queryIdByCode(ruleCode);
RedissonUtils.lock(() -> {
code[0] = service.codeDemo(map);
}, codeId, 3);
return code[0];
}
}

View File

@@ -13,11 +13,8 @@ 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.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.service.dto.StructattrDto;
import org.nl.wms.basedata.st.service.impl.StructattrServiceImpl;
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.in.service.impl.ProductInServiceImpl;
import org.nl.wms.st.in.service.impl.StorPublicServiceImpl;
import org.springframework.transaction.annotation.Transactional;
@@ -150,7 +147,6 @@ public class ProductInTask extends AbstractAcsTask {
@Override
@Transactional(rollbackFor = Exception.class)
public String createTask(JSONObject form) {
String task_type = form.getString("task_type");
if (StrUtil.isBlank(task_type)) {
throw new BadRequestException("业务类型不能为空");
@@ -195,6 +191,12 @@ public class ProductInTask extends AbstractAcsTask {
return json.getString("task_id");
}
@Override
public void cancel(String task_id) {
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);

View File

@@ -11,7 +11,6 @@ import org.apache.commons.lang3.StringUtils;
import org.nl.common.anno.Log;
import org.nl.common.utils.api.ResultCode;
import org.nl.modules.common.exception.BizCoreException;
import org.nl.wms.st.in.service.ProductInService;
import org.nl.wms.st.in.service.SemiProductInService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
@@ -32,7 +31,7 @@ public class SemiProductInController{
@GetMapping
@Log("查询入库单据")
@ApiOperation("查询入库单据")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
public ResponseEntity<Object> query(@RequestParam Map<String,Object> whereJson, Pageable page) {
return new ResponseEntity<>(semiProductInService.pageQuery(whereJson, page), HttpStatus.OK);
}
@@ -47,7 +46,7 @@ public class SemiProductInController{
@GetMapping("/getBillDtl")
@Log("查询入库单来源")
@ApiOperation("查询入库单来源")
public ResponseEntity<Object> getBillDtl(@RequestParam Map whereJson, Pageable page) {
public ResponseEntity<Object> getBillDtl(@RequestParam Map<String,Object> whereJson, Pageable page) {
return new ResponseEntity<>(semiProductInService.getBillDtl(whereJson, page), HttpStatus.OK);
}
@@ -61,7 +60,7 @@ public class SemiProductInController{
@PostMapping("/semiProductInFromPda")
@Log("C端半成品入库")
@ApiOperation("C端入库")
@ApiOperation("C端半成品入库")
public ResponseEntity<Object> semiProductInFromPda(@RequestBody JSONObject whereJson) {
log.info("海亮缓存线手持服务 [半成品入库] 接口被请求, 请求参数-{}", whereJson);
//参数校验
@@ -96,7 +95,7 @@ public class SemiProductInController{
@PostMapping("/commit")
@Log("出入单提交")
@ApiOperation("出入单提交")
public ResponseEntity<Object> commit(@RequestBody Map whereJson) {
public ResponseEntity<Object> commit(@RequestBody Map<String,Object> whereJson) {
semiProductInService.commit(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@@ -158,7 +157,7 @@ public class SemiProductInController{
@PostMapping("/updateTask")
@Log("变更任务")
@ApiOperation("变更任务")
public ResponseEntity<Object> updateTask(@RequestBody Map whereJson) {
public ResponseEntity<Object> updateTask(@RequestBody Map<String,Object> whereJson) {
semiProductInService.updateTask(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@@ -166,7 +165,7 @@ public class SemiProductInController{
@PostMapping("/confirm")
@Log("完成单据")
@ApiOperation("完成单据")
public ResponseEntity<Object> confirm(@RequestBody Map whereJson) {
public ResponseEntity<Object> confirm(@RequestBody Map<String,Object> whereJson) {
semiProductInService.confirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}

View File

@@ -15,9 +15,9 @@ public interface SemiProductInService{
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String,Object> pageQuery(Map whereJson, Pageable page);
Map<String,Object> pageQuery(Map<String,Object> whereJson, Pageable page);
Map<String,Object> getBillDtl(Map whereJson, Pageable page);
Map<String,Object> getBillDtl(Map<String,Object> whereJson, Pageable page);
/**
* 新增单据
@@ -53,7 +53,7 @@ public interface SemiProductInService{
*/
void update(JSONObject whereJson);
void commit(Map whereJson);
void commit(Map<String,Object> whereJson);
/**
* 查询出入库单明细
@@ -84,9 +84,9 @@ public interface SemiProductInService{
*/
void divPoint(JSONObject whereJson);
void updateTask(Map whereJson);
void updateTask(Map<String,Object> whereJson);
void confirm(Map whereJson);
void confirm(Map<String,Object> whereJson);
/**
* 查询入库分配明细

View File

@@ -7,11 +7,13 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.sun.org.apache.regexp.internal.RE;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.common.enums.AcsTaskEnum;
import org.nl.common.enums.StatusEnum;
import org.nl.common.utils.RedissonUtils;
import org.nl.common.utils.SecurityUtils;
import org.nl.common.utils.api.CommonResult;
import org.nl.common.utils.api.RestBusinessTemplate;
@@ -22,7 +24,6 @@ import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.service.StorattrService;
import org.nl.wms.basedata.st.service.StructattrService;
import org.nl.wms.basedata.st.service.dto.StructattrDto;
import org.nl.wms.sch.service.PointService;
@@ -34,9 +35,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.*;
/**
* PC端出入库新增
@@ -45,34 +44,28 @@ import java.util.Map;
@RequiredArgsConstructor
@Slf4j
public class SemiProductInServiceImpl implements SemiProductInService{
private final StorattrService storattrService;
private final StructattrService structattrService;
private final PointService pointService;
private final StorPublicService storPublicService;
@Override
public Map<String,Object> pageQuery(Map whereJson, Pageable page) {
public Map<String,Object> pageQuery(Map<String,Object> whereJson, Pageable page) {
String bill_code = MapUtil.getStr(whereJson, "bill_code");
String stor_id = MapUtil.getStr(whereJson, "stor_id");
String begin_time = MapUtil.getStr(whereJson, "begin_time");
String end_time = MapUtil.getStr(whereJson, "end_time");
String bill_status = MapUtil.getStr(whereJson, "bill_status");
JSONObject map = new JSONObject();
map.put("flag", "1");
map.put("stor_id", stor_id);
map.put("begin_time", begin_time);
map.put("end_time", end_time);
map.put("bill_status", bill_status);
map.put("stor_id", MapUtil.getStr(whereJson, "stor_id"));
map.put("begin_time", MapUtil.getStr(whereJson, "begin_time"));
map.put("end_time", MapUtil.getStr(whereJson, "end_time"));
map.put("bill_status", MapUtil.getStr(whereJson, "bill_status"));
map.put("bill_type", "0002");
if(ObjectUtil.isNotEmpty(bill_code)) {
map.put("bill_code", "%" + bill_code + "%");
}
JSONObject jo = WQL.getWO("QST_IVT_PRODUCTIN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time desc");
return jo;
return WQL.getWO("QST_IVT_PRODUCTIN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "create_time desc");
}
@Override
public Map<String,Object> getBillDtl(Map whereJson, Pageable page) {
public Map<String,Object> getBillDtl(Map<String,Object> whereJson, Pageable page) {
HashMap<String,String> map = new HashMap<>();
String bill_code = (String) whereJson.get("bill_code");
String material_search = (String) whereJson.get("material_search");
@@ -101,8 +94,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
map.put("begin_time", begin_time.substring(0, 10));
map.put("end_time", end_time.substring(0, 10));
}
JSONObject jo = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "date_of_FG_inbound,package_box_sn desc");
return jo;
return WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "date_of_FG_inbound,package_box_sn desc");
}
@Override
@@ -110,7 +102,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
public CommonResult<Integer> semiProductInFromPda(JSONObject whereJson) {
WQLObject vehicleTab = WQLObject.getWQLObject("md_pb_storagevehicleinfo");
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis");
//生成单据
//1.生成单据
JSONObject iostorinvInfo = insertDtls(whereJson);
whereJson.put("iostorinv_id", iostorinvInfo.getString("iostorinv_id"));
whereJson.put("iostorinvdis_id", iostorinvInfo.getString("iostorinvdis_id"));
@@ -120,26 +112,24 @@ public class SemiProductInServiceImpl implements SemiProductInService{
//区域
whereJson.put("sect_id", "KQ004");
//组盘确认
String storagevehicle_code = whereJson.getString("storagevehicle_code");
// 1.校验载具是否存在
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + storagevehicle_code + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
JSONObject jsonVehicle = vehicleTab.query("storagevehicle_code = '" + whereJson.getString("storagevehicle_code") + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
if(ObjectUtil.isEmpty(jsonVehicle)) {
throw new BadRequestException("载具不存在");
}
// 2.更新分配明细载具号
//更新分配明细载具号
JSONObject jsonDis = disTab.query("iostorinvdis_id = '" + iostorinvInfo.getString("iostorinvdis_id") + "'").uniqueResult(0);
// 校验此明细是否已经分配
//校验此明细是否已经分配
if(ObjectUtil.isNotEmpty(jsonDis.getString("struct_id"))) {
throw new BadRequestException("此明细已分配不可组盘!");
}
jsonDis.put("storagevehicle_id", jsonVehicle.getString("storagevehicle_id"));
jsonDis.put("storagevehicle_code", jsonVehicle.getString("storagevehicle_code"));
disTab.update(jsonDis);
//自动分配货位
//2.自动分配货位
HashMap<String,String> dis_map = divStructs(whereJson);
whereJson.put("point_code", dis_map.get("struct_code"));
whereJson.put("point_id", dis_map.get("struct_id"));
//设置起点
//3.设置起点
JSONObject mst = WQLObject.getWQLObject("st_ivt_iostorinv").query("iostorinv_id = '" + whereJson.getString("iostorinv_id") + "'").uniqueResult(0);
//如果终点已确定,创建任务
ProductInTask task = new ProductInTask();
@@ -163,7 +153,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
}
public HashMap<String,String> divStructs(JSONObject whereJson) {
String is_length = "";
String is_length;
//出入单据主表
JSONObject mst = WQLObject.getWQLObject("st_ivt_iostorinv").query("iostorinv_id = '" + whereJson.get("iostorinv_id") + "'").uniqueResult(0);
//分配表
@@ -176,9 +166,9 @@ public class SemiProductInServiceImpl implements SemiProductInService{
if(StringUtils.isBlank(jsonDis.getString("storagevehicle_code"))) {
throw new BadRequestException("请先进行组盘");
}
JSONObject jsonParam = new JSONObject();
JSONObject jsonPoint;
if(whereJson.containsKey("sect_id")) {
JSONObject jsonParam = new JSONObject();
//生产区域
jsonParam.put("sect_id", whereJson.get("sect_id"));
//库区
@@ -193,7 +183,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
if(ObjectUtil.isEmpty(jsonPoint)) {
throw new BadRequestException("未查询到适用点位!");
}
HashMap<String,String> dis_map = new HashMap();
HashMap<String,String> dis_map = new HashMap(9);
dis_map.put("is_length", is_length);
dis_map.put("region_code", jsonPoint.getString("region_code"));
dis_map.put("region_name", jsonPoint.getString("region_name"));
@@ -208,61 +198,67 @@ public class SemiProductInServiceImpl implements SemiProductInService{
}
private void lockPoint(HashMap<String,String> dis_map, JSONObject mst) {
//仓位
WQLObject pointTab = WQLObject.getWQLObject("st_ivt_structattr");
//锁定货位
JSONObject jsonPoint1 = pointTab.query("struct_id = '" + dis_map.get("struct_id") + "'").uniqueResult(0);
jsonPoint1.put("lock_type", StatusEnum.LOCK_ON.getCode());
pointTab.update(jsonPoint1);
// 判断是否需要锁定两个货位
if(StrUtil.equals(dis_map.get("is_length"), "1")) {
JSONObject jsonPoint2 = pointTab.query("struct_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0);
jsonPoint2.put("lock_type", StatusEnum.LOCK_ON.getCode());
pointTab.update(jsonPoint2);
String pointId = dis_map.get("struct_id");
if(StringUtils.isBlank(pointId)) {
return;
}
// 更新分配明细
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinvdtl_id = '" + dis_map.get("iostorinvdtl_id") + "'");
//更新库存,直接取出入库分配表的库存
JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_map.get("iostorinvdtl_id") + "'").getResultJSONArray(0);
for(int i = 0; i < dis_rows.size(); i++) {
JSONObject dis_jo = dis_rows.getJSONObject(i);
JSONObject i_form = new JSONObject();
i_form.put("struct_id", dis_jo.getString("struct_id"));
i_form.put("material_id", dis_jo.getString("material_id"));
i_form.put("pcsn", dis_jo.getString("pcsn"));
i_form.put("change_qty", dis_jo.getString("plan_qty"));
i_form.put("bill_type_scode", mst.getString("bill_type"));
i_form.put("quality_scode", "01");
i_form.put("inv_id", mst.getString("iostorinv_id"));
i_form.put("bill_code", mst.getString("bill_code"));
i_form.put("bill_table", "ST_IVT_IOStorInv");
i_form.put("qty_unit_id", dis_jo.getString("qty_unit_id"));
i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name"));
//查询仓位信息
i_form.put("isStructAttr", "1");
storPublicService.IOStor(i_form, "31");
JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0);
if(dtl_jo.getDoubleValue("unassign_qty") == 0) {
//判断该明细下是否还存在未分配货位的分配明细
JSONArray disdiv_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "' AND (struct_id = '' OR struct_id is null)").getResultJSONArray(0);
if(disdiv_rows.size() == 0) {
dtl_jo.put("bill_status", "30");
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
//判断主表下的明细是否都为30
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + dis_jo.getString("iostorinv_id") + "' AND bill_status < '30'").getResultJSONArray(0);
mst.put("dis_id", SecurityUtils.getCurrentUserId());
mst.put("dis_name", SecurityUtils.getCurrentNickName());
mst.put("dis_time", DateUtil.now());
if(dtl_rows.size() == 0) {
mst.put("bill_status", "30");
RedissonUtils.lock(() -> {
//仓位
WQLObject pointTab = WQLObject.getWQLObject("st_ivt_structattr");
//锁定货位
JSONObject jsonPoint1 = pointTab.query("struct_id = '" + pointId + "'").uniqueResult(0);
jsonPoint1.put("lock_type", StatusEnum.LOCK_ON.getCode());
pointTab.update(jsonPoint1);
// 判断是否需要锁定两个货位
if(StrUtil.equals(dis_map.get("is_length"), "1")) {
JSONObject jsonPoint2 = pointTab.query("struct_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0);
jsonPoint2.put("lock_type", StatusEnum.LOCK_ON.getCode());
pointTab.update(jsonPoint2);
}
// 更新分配明细
WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinvdtl_id = '" + dis_map.get("iostorinvdtl_id") + "'");
//更新库存,直接取出入库分配表的库存
JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_map.get("iostorinvdtl_id") + "'").getResultJSONArray(0);
for(int i = 0; i < dis_rows.size(); i++) {
JSONObject dis_jo = dis_rows.getJSONObject(i);
JSONObject i_form = new JSONObject();
i_form.put("struct_id", dis_jo.getString("struct_id"));
i_form.put("material_id", dis_jo.getString("material_id"));
i_form.put("pcsn", dis_jo.getString("pcsn"));
i_form.put("change_qty", dis_jo.getString("plan_qty"));
i_form.put("bill_type_scode", mst.getString("bill_type"));
i_form.put("quality_scode", "01");
i_form.put("inv_id", mst.getString("iostorinv_id"));
i_form.put("bill_code", mst.getString("bill_code"));
i_form.put("bill_table", "ST_IVT_IOStorInv");
i_form.put("qty_unit_id", dis_jo.getString("qty_unit_id"));
i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name"));
//查询仓位信息
i_form.put("isStructAttr", "1");
storPublicService.IOStor(i_form, "31");
JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0);
if(dtl_jo.getDoubleValue("unassign_qty") == 0) {
//判断该明细下是否还存在未分配货位的分配明细
JSONArray disdiv_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "' AND (struct_id = '' OR struct_id is null)").getResultJSONArray(0);
if(disdiv_rows.size() == 0) {
dtl_jo.put("bill_status", "30");
WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
//判断主表下的明细是否都为30
JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + dis_jo.getString("iostorinv_id") + "' AND bill_status < '30'").getResultJSONArray(0);
mst.put("dis_id", SecurityUtils.getCurrentUserId());
mst.put("dis_name", SecurityUtils.getCurrentNickName());
mst.put("dis_time", DateUtil.now());
if(dtl_rows.size() == 0) {
mst.put("bill_status", "30");
}
else{
mst.put("bill_status", "20");
}
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst);
}
else{
mst.put("bill_status", "20");
}
WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst);
}
}
}
}, pointId, 3);
}
public JSONObject insertDtls(JSONObject whereJson) {
@@ -412,7 +408,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
JSONObject param = new JSONObject();
param.put("iostorinv_id", String.valueOf(id));
param.put("is_delete", "1");
param.put("update_id", currentUserId);
param.put("update_id", currentUserId + "");
param.put("update_name", nickName);
param.put("update_time", now);
wo.update(param);
@@ -515,7 +511,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
}
@Override
public void commit(Map whereJson) {
public void commit(Map<String,Object> whereJson) {
String iostorinv_id = (String) whereJson.get("iostorinv_id");
JSONObject mst = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
if(!mst.getString("bill_status").equals("10")) {
@@ -537,15 +533,13 @@ public class SemiProductInServiceImpl implements SemiProductInService{
public JSONArray getIODtl(JSONObject whereJson) {
String bill_code = whereJson.getString("bill_code");
String iostorinv_id = whereJson.getString("iostorinv_id");
JSONArray ja = WQL.getWO("QST_IVT_PRODUCTIN_01").addParam("flag", "2").addParam("bill_code", bill_code).addParam("iostorinv_id", iostorinv_id).process().getResultJSONArray(0);
return ja;
return WQL.getWO("QST_IVT_PRODUCTIN_01").addParam("flag", "2").addParam("bill_code", bill_code).addParam("iostorinv_id", iostorinv_id).process().getResultJSONArray(0);
}
@Override
public JSONArray getDisDtl(JSONObject whereJson) {
//查询该明细下的所有入库分配明细
JSONArray resultJSONArray = WQL.getWO("QST_IVT_PRODUCTIN_01").addParam("flag", "3").addParam("iostorinvdtl_id", whereJson.get("iostorinvdtl_id")).process().getResultJSONArray(0);
return resultJSONArray;
return WQL.getWO("QST_IVT_PRODUCTIN_01").addParam("flag", "3").addParam("iostorinvdtl_id", whereJson.get("iostorinvdtl_id")).process().getResultJSONArray(0);
}
/**
@@ -554,12 +548,12 @@ public class SemiProductInServiceImpl implements SemiProductInService{
@Transactional(rollbackFor = Exception.class)
@Override
public void divStruct(JSONObject whereJson) {
String region_code = "";
String region_name = "";
String point_id = "";
String point_code = "";
String point_name = "";
String is_length = "";
String region_code;
String region_name;
String point_id;
String point_code;
String point_name;
String is_length = "0";
JSONObject map = whereJson.getJSONArray("tableMater").getJSONObject(0);
JSONObject jsonDtl = whereJson.getJSONObject("dtl_row");
//出入单据主表
@@ -606,7 +600,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_id = '" + map.getString("material_id") + "'").uniqueResult(0);
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
double material_length = jsonMater.getDoubleValue("length");
double material_length_up = Double.valueOf(length_up);
double material_length_up = Double.parseDouble(length_up);
if(material_length > material_length_up) {
throw new BadRequestException("物料超长,请自动分配");
}
@@ -643,7 +637,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
double material_length = jsonMater.getDoubleValue("length");
//预设的最大长度
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
double material_length_up = Double.valueOf(length_up);
double material_length_up = Double.parseDouble(length_up);
// 判断物料是否超长
if(material_length > material_length_up) {
// 超长:找一层两个货位
@@ -657,16 +651,13 @@ public class SemiProductInServiceImpl implements SemiProductInService{
struct_jo = json;
break;
}
else{
continue;
}
}
}
else{
// 未超长:判断是否超重
String weight_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_WEIGHT_UP").getValue();
double material_weight = jsonMater.getDoubleValue("net_weight");
double material_weight_up = Double.valueOf(weight_up);
double material_weight_up = Double.parseDouble(weight_up);
if(material_weight > material_weight_up) {
// TODO 查询点位改成查询仓位,需增加仓位层字段,对层进行排序,判断优先级
// 超重: 尽量放在一层
@@ -699,7 +690,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
JSONObject jsonMater = materTab.query("material_id = '" + whereJson.getString("material_id") + "'").uniqueResult(0);
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
double material_length = jsonMater.getDoubleValue("length");
double material_length_up = Double.valueOf(length_up);
double material_length_up = Double.parseDouble(length_up);
if(material_length > material_length_up) {
// 超长则解锁对应点位
JSONObject jsonPoint2 = point_table.query("struct_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0);
@@ -793,8 +784,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
@Override
public JSONArray queryStor() {
WQLObject storTab = WQLObject.getWQLObject("st_ivt_bsrealstorattr");
JSONArray resultJSONArray = storTab.query("is_delete = '0' and is_used = '1'").getResultJSONArray(0);
return resultJSONArray;
return storTab.query("is_delete = '0' and is_used = '1'").getResultJSONArray(0);
}
/**
@@ -825,8 +815,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
@Override
public JSONArray getDisTask(JSONObject whereJson) {
//查询该明细下的所有入库分配明细
JSONArray resultJSONArray = WQL.getWO("QST_IVT_PRODUCTIN_01").addParam("flag", "4").addParam("iostorinvdtl_id", whereJson.get("iostorinvdtl_id")).process().getResultJSONArray(0);
return resultJSONArray;
return WQL.getWO("QST_IVT_PRODUCTIN_01").addParam("flag", "4").addParam("iostorinvdtl_id", whereJson.get("iostorinvdtl_id")).process().getResultJSONArray(0);
}
public JSONObject queryEmpStruct(JSONObject whereJson) {
@@ -887,13 +876,13 @@ public class SemiProductInServiceImpl implements SemiProductInService{
@Override
@Transactional(rollbackFor = Exception.class)
public void updateTask(Map whereJson) {
public void updateTask(Map<String,Object> whereJson) {
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
WQLObject task_wql = WQLObject.getWQLObject("SCH_BASE_Task");
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
//判断指令状态,只能修改生成状态的任务
String task_code = (String) whereJson.get("task_code");/*
/* String task_code = (String) whereJson.get("task_code");
TaskDto taskDto = taskService.findByCode(task_code);
if (ObjectUtil.isEmpty(taskDto)) {
throw new BadRequestException("请输入正确的任务号!");
@@ -945,12 +934,11 @@ public class SemiProductInServiceImpl implements SemiProductInService{
if(dis_rows.size() <= 0) {
throw new BadRequestException("数据参数有误!");
}
StructattrDto old_struct = structattrService.findByCode((String) whereJson.get("struct_code"));
//StructattrDto old_struct = structattrService.findByCode((String) whereJson.get("struct_code"));
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"));
@@ -962,8 +950,8 @@ public class SemiProductInServiceImpl implements SemiProductInService{
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"));
// storPublicService.IOStor(i_form, "32");
i_form.put("struct_id", structattrDto.getStruct_id());
// storPublicService.IOStor(i_form, "32");
// storPublicService.IOStor(i_form, "31");
}
}
@@ -971,7 +959,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
@Override
@Transactional(rollbackFor = Exception.class)
public void confirm(Map whereJson) {
public void confirm(Map<String,Object> whereJson) {
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
//校验主表状态为分配中、分配完
@@ -1053,7 +1041,7 @@ public class SemiProductInServiceImpl implements SemiProductInService{
JSONObject jsonMater = materTab.query("material_id = '" + dis_row.getString("material_id") + "'").uniqueResult(0);
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
double material_length = jsonMater.getDoubleValue("length");
double material_length_up = Double.valueOf(length_up);
double material_length_up = Double.parseDouble(length_up);
if(material_length > material_length_up) {
// 找对应货位并更新
JSONObject jsonPoint2 = pointTab.query("point_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0);