Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -603,8 +603,11 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
data.put("box_width", box_width);
|
||||
data.put("box_high", box_high);
|
||||
|
||||
String bundle_times_num = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("bundle_times_num").getValue();
|
||||
Double box_length_value = Double.valueOf(box_length);
|
||||
if (box_length_value >= 772) {
|
||||
Double box_bundle_times_num = Double.valueOf(bundle_times_num);
|
||||
|
||||
if (box_length_value >= box_bundle_times_num) {
|
||||
data.put("bundle_times", 3);
|
||||
} else {
|
||||
data.put("bundle_times", 2);
|
||||
|
||||
@@ -468,26 +468,25 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
|
||||
try {
|
||||
String is_mesTolms = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("is_mesTolms").getValue();
|
||||
String container_name = param.getString("ContainerName");
|
||||
if (StrUtil.isEmpty(container_name)) {
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
|
||||
JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(plan_jo)) {
|
||||
throw new BadRequestException("未查询到该子卷号对应的分切计划!");
|
||||
}
|
||||
String Attribute1 = param.getString("Attribute1");
|
||||
String Attribute2 = param.getString("Attribute2");
|
||||
|
||||
if (StrUtil.equals("1", Attribute2)) {
|
||||
//更新该子卷号对应的分切计划为已呼叫
|
||||
plan_jo.put("is_call", "1");
|
||||
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(plan_jo);
|
||||
}
|
||||
if (StrUtil.equals(is_mesTolms, "1")) {
|
||||
String container_name = param.getString("ContainerName");
|
||||
if (StrUtil.isEmpty(container_name)) {
|
||||
throw new BadRequestException("子卷号不能为空!");
|
||||
}
|
||||
|
||||
JSONObject plan_jo = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("container_name = '" + container_name + "' AND is_delete = '0'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(plan_jo)) {
|
||||
throw new BadRequestException("未查询到该子卷号对应的分切计划!");
|
||||
}
|
||||
String Attribute1 = param.getString("Attribute1");
|
||||
String Attribute2 = param.getString("Attribute2");
|
||||
|
||||
if (StrUtil.equals("1", Attribute2)) {
|
||||
//更新该子卷号对应的分切计划为已呼叫
|
||||
plan_jo.put("is_call", "1");
|
||||
WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").update(plan_jo);
|
||||
}
|
||||
|
||||
if (Attribute1.equals("0")) {
|
||||
result.put("RTYPE", "S");
|
||||
result.put("RTMSG", "操作成功!");
|
||||
@@ -743,6 +742,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
|
||||
JSONArray up_rows = new JSONArray();
|
||||
JSONArray down_rows = new JSONArray();
|
||||
String up_qzz = "";
|
||||
String down_qzz = "";
|
||||
for (int i = 0; i < param.size(); i++) {
|
||||
JSONObject row = param.getJSONObject(i);
|
||||
//查询对应的分切计划
|
||||
@@ -750,6 +751,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
if (ObjectUtil.isEmpty(plan_jo)) {
|
||||
throw new BadRequestException("未查询到分切计划:" + row.getString("ContainerGroup"));
|
||||
}
|
||||
String qzzno = plan_jo.getString("qzzno");
|
||||
String need_down = row.getString("Attribute1");
|
||||
if (StrUtil.isEmpty(need_down)) {
|
||||
throw new BadRequestException("子卷:" + row.getString("ContainerGroup") + "对应的是否需要下轴字段不能为空!");
|
||||
@@ -759,10 +761,38 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
||||
} else {
|
||||
if (row.getString("ContainerPosition").equals("1")) {
|
||||
up_rows.add(plan_jo);
|
||||
if (StrUtil.isEmpty(up_qzz)) {
|
||||
up_qzz = qzzno;
|
||||
up_rows.add(plan_jo);
|
||||
} else {
|
||||
if (!StrUtil.equals(qzzno, up_qzz)) {
|
||||
down_qzz = qzzno;
|
||||
down_rows.add(plan_jo);
|
||||
} else {
|
||||
up_rows.add(plan_jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (row.getString("ContainerPosition").equals("2")) {
|
||||
down_rows.add(plan_jo);
|
||||
if (StrUtil.isEmpty(down_qzz)) {
|
||||
if (StrUtil.isEmpty(up_qzz)) {
|
||||
down_qzz = qzzno;
|
||||
down_rows.add(plan_jo);
|
||||
} else {
|
||||
if (StrUtil.equals(up_qzz, qzzno)) {
|
||||
up_rows.add(plan_jo);
|
||||
} else {
|
||||
down_qzz = qzzno;
|
||||
down_rows.add(plan_jo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (StrUtil.equals(down_qzz, qzzno)) {
|
||||
down_rows.add(plan_jo);
|
||||
} else {
|
||||
up_rows.add(plan_jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,18 @@ public class FeedingController {
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(feedingService.confirm(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/queryPoint")
|
||||
@Log("扫码起点获取母卷")
|
||||
@ApiOperation("扫码起点获取母卷")
|
||||
public ResponseEntity<Object> queryPoint(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(feedingService.queryPoint(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/handleConfirm")
|
||||
@Log("人工呼叫母卷确认")
|
||||
@ApiOperation("人工呼叫母卷确认")
|
||||
public ResponseEntity<Object> handleConfirm(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(feedingService.handleConfirm(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,20 @@ public interface FeedingService {
|
||||
*/
|
||||
JSONObject confirm(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 套轴确认
|
||||
*
|
||||
* @param whereJson /
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject queryPoint(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 套轴确认
|
||||
*
|
||||
* @param whereJson /
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject handleConfirm(JSONObject whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ public class BakingServiceImpl implements BakingService {
|
||||
JSONObject jsonMap = new JSONObject();
|
||||
jsonMap.put("flag", "1");
|
||||
jsonMap.put("product_area", product_area);
|
||||
jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose));
|
||||
jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose));
|
||||
jsonMap.put("min_temperature", NumberUtil.sub(temperature, temperature_lose)+"");
|
||||
jsonMap.put("max_temperature", NumberUtil.add(temperature, temperature_lose)+"");
|
||||
jsonMap.put("point_location", map.getString("point_location"));
|
||||
JSONObject jsonHotIvt = WQL.getWO("PDA_BAKING_01").addParamMap(jsonMap).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonHotIvt)) throw new BadRequestException("烘烤区没有合适温度的空位!");
|
||||
|
||||
@@ -211,9 +211,126 @@ public class FeedingServiceImpl implements FeedingService {
|
||||
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("message", "查询成功!");
|
||||
jo.put("message", "操作成功!");
|
||||
return jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject queryPoint(JSONObject form) {
|
||||
String point_code = form.getString("point_code");
|
||||
|
||||
if (StrUtil.isEmpty(point_code)) {
|
||||
throw new BadRequestException("输入的点位不能为空!");
|
||||
}
|
||||
|
||||
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(cool_jo)) {
|
||||
throw new BadRequestException("请输入或者扫描冷却区满轴位的点位!");
|
||||
}
|
||||
|
||||
if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) {
|
||||
throw new BadRequestException("该点位上不存在母卷!");
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("content", cool_jo);
|
||||
result.put("message", "查询成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public JSONObject handleConfirm(JSONObject form) {
|
||||
String point_code = form.getString("point_code");
|
||||
String next_point_code = form.getString("next_point_code");
|
||||
|
||||
if (StrUtil.isEmpty(point_code)) {
|
||||
throw new BadRequestException("输入的起点不能为空!");
|
||||
}
|
||||
|
||||
JSONObject cool_jo = WQLObject.getWQLObject("st_ivt_coolpointivt").query("full_point_code = '" + point_code + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(cool_jo)) {
|
||||
throw new BadRequestException("请输入或者扫描冷却区满轴位的点位做为起点!");
|
||||
}
|
||||
|
||||
if (!StrUtil.equals(cool_jo.getString("full_point_status"), "02")) {
|
||||
throw new BadRequestException("该点位上不存在母卷!");
|
||||
}
|
||||
|
||||
//查询该分切机对应的点位
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("st_ivt_cutpointivt").query("full_point_code = '" + next_point_code + "'").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(cut_jo)) {
|
||||
throw new BadRequestException("请扫描或者输入分切区域的满轴点位做为终点!");
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(cut_jo.getString("container_name")) || cut_jo.getString("full_point_status").equals("02")) {
|
||||
throw new BadRequestException("该分切机对应的上料位存在母卷,不能下发搬运任务!");
|
||||
}
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
if (StrUtil.equals("01", cut_jo.getString("empty_point_code"))) {
|
||||
jo.put("point_code1", point_code);
|
||||
jo.put("point_code2", next_point_code);
|
||||
jo.put("vehicle_code", cool_jo.getString("container_name"));
|
||||
jo.put("product_area", cut_jo.getString("product_area"));
|
||||
jo.put("task_type", "010302");
|
||||
} else {
|
||||
jo.put("point_code1", point_code);
|
||||
jo.put("point_code2", next_point_code);
|
||||
jo.put("point_code3", cut_jo.getString("empty_point_code"));
|
||||
jo.put("point_code4", cool_jo.getString("empty_point_code"));
|
||||
jo.put("vehicle_code", cool_jo.getString("container_name"));
|
||||
jo.put("vehicle_code2", cut_jo.getString("empty_vehicle_code"));
|
||||
jo.put("product_area", cut_jo.getString("product_area"));
|
||||
jo.put("task_type", "010301");
|
||||
}
|
||||
|
||||
//查询该母卷号对应的生箔信息
|
||||
JSONObject raw_jo = WQLObject.getWQLObject("pdm_bi_rawfoilworkorder").query("container_name = '" + cool_jo.getString("container_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(raw_jo)) {
|
||||
throw new BadRequestException("未查询到母卷:" + cool_jo.getString("container_name") + ",对应的生箔信息!");
|
||||
}
|
||||
|
||||
JSONObject mater_jo = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + raw_jo.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(mater_jo)) {
|
||||
throw new BadRequestException("未查询到物料:" + raw_jo.getString("product_name") + "基础信息!");
|
||||
}
|
||||
|
||||
AbstractAcsTask task = new CoolCutTask();
|
||||
String task_id = task.createTask(jo);
|
||||
|
||||
//生成半成品出库单据
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
|
||||
JSONObject jsonCool = new JSONObject();
|
||||
jsonCool.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonCool.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
|
||||
jsonCool.put("io_type", "1");
|
||||
jsonCool.put("material_id", mater_jo.getString("material_id"));
|
||||
jsonCool.put("pcsn", cool_jo.getString("container_name"));
|
||||
jsonCool.put("bill_status", "50");
|
||||
jsonCool.put("task_id", task_id);
|
||||
jsonCool.put("qty_unit_id", "1");
|
||||
jsonCool.put("start_point_code", cool_jo.getString("full_point_code"));
|
||||
jsonCool.put("end_point_code", cut_jo.getString("full_point_code"));
|
||||
jsonCool.put("create_mode", "03");
|
||||
jsonCool.put("create_id", currentUserId);
|
||||
jsonCool.put("create_name", currentUsername);
|
||||
jsonCool.put("create_time", DateUtil.now());
|
||||
jsonCool.put("update_optid", currentUserId);
|
||||
jsonCool.put("update_optname", currentUsername);
|
||||
jsonCool.put("update_time", DateUtil.now());
|
||||
jsonCool.put("confirm_optid", currentUserId);
|
||||
jsonCool.put("confirm_optname", currentUsername);
|
||||
jsonCool.put("confirm_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("ST_IVT_CoolRegionIO").insert(jsonCool);
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("message", "操作成功!");
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ public class RawFoilServiceImpl implements RawFoilService {
|
||||
JSONObject task_jo = WQLObject.getWQLObject("SCH_BASE_Task").query("material_code = '" + container_name + "' and task_status <> '07' AND is_delete = '0'").uniqueResult(0);
|
||||
|
||||
// 查询生箔点位库存表
|
||||
JSONObject jsonSb = rawTab.query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0);
|
||||
JSONObject jsonSb = WQLObject.getWQLObject("st_ivt_sbpointivt").query("ext_code = '" + jsonRaw.getString("resource_name") + "'and is_used = '1'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonSb)) throw new BadRequestException("点位不存在");
|
||||
|
||||
//下发ACS,执行取满放空的AGV动作
|
||||
|
||||
@@ -46,10 +46,10 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")){
|
||||
if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")){
|
||||
if (product_area.equals("A3") || product_area.equals("A4")) {
|
||||
agv_system_type = "3";
|
||||
}
|
||||
AcsTaskDto dto = AcsTaskDto.builder()
|
||||
@@ -87,7 +87,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
|
||||
//更新车号和重量
|
||||
String car_no = taskObj.getString("car_no");
|
||||
if (StrUtil.isNotEmpty(car_no)){
|
||||
if (StrUtil.isNotEmpty(car_no)) {
|
||||
JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0);
|
||||
jsonRaw.put("agvno", car_no);
|
||||
rawTab.update(jsonRaw);
|
||||
@@ -96,12 +96,12 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
String weight = taskObj.getString("weight");
|
||||
if (ObjectUtil.isNotEmpty(weight)) {
|
||||
JSONObject jsonRaw = rawTab.query("container_name ='" + jsonTask.getString("material_code") + "' AND status <> '09' AND is_delete = '0'").uniqueResult(0);
|
||||
jsonRaw.put("productin_qty", taskObj.getDoubleValue(weight));
|
||||
jsonRaw.put("productin_qty", weight);
|
||||
rawTab.update(jsonRaw);
|
||||
}
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 更新删除字段
|
||||
jsonTask.put("is_delete","1");
|
||||
jsonTask.put("is_delete", "1");
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
@@ -145,7 +145,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
// 判断是两个点位的任务还是四个点位的任务
|
||||
if (ObjectUtil.isEmpty(point_code3)) {
|
||||
// 判断是取满 or 取空 :取满起点是生箔区域、取空起点是冷却区域
|
||||
JSONObject jsonSbIvt = sbTab.query("point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
JSONObject jsonSbIvt = sbTab.query("point_code = '" + point_code1.substring(0, point_code1.length() - 2) + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonSbIvt)) {
|
||||
// 取满
|
||||
JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code2 + "'").uniqueResult(0);
|
||||
@@ -158,17 +158,17 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
ivtTab.update(jsonCoolIvt);
|
||||
|
||||
//更新母卷工单状态
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "09");
|
||||
map.put("realend_time", DateUtil.now());
|
||||
map.put("update_optid",currentUserId+"");
|
||||
map.put("update_optname",currentUsername);
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", currentUsername);
|
||||
map.put("finish_type", "01");
|
||||
map.put("update_time",DateUtil.now());
|
||||
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map,"container_name = '"+jsonTask.getString("material_code")+"'");
|
||||
map.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'");
|
||||
} else {
|
||||
// 取空
|
||||
JSONObject jsonCoolIvt = ivtTab.query("full_point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
JSONObject jsonCoolIvt = ivtTab.query("empty_point_code = '" + point_code1 + "'").uniqueResult(0);
|
||||
jsonCoolIvt.put("empty_point_status", "01");
|
||||
jsonCoolIvt.put("empty_vehicle_code", "");
|
||||
ivtTab.update(jsonCoolIvt);
|
||||
@@ -179,9 +179,9 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
JSONObject jsonIvt = ivtTab.query("empty_point_code ='" + point_code1 + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonIvt)) throw new BadRequestException("未找到可用点位:" + point_code1);
|
||||
// 校验终点是否存在
|
||||
JSONObject nextDto = sbTab.query("point_code ='" + point_code2 + "'").uniqueResult(0);
|
||||
/*JSONObject nextDto = sbTab.query("point_code ='" + point_code2.substring(point_code2.length()-2) + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(nextDto))
|
||||
throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2"));
|
||||
throw new BadRequestException("未找到可用点位:" + jsonTask.getString("point_code2"));*/
|
||||
|
||||
// 更新冷却库存状态
|
||||
jsonIvt.put("empty_point_status", "01");
|
||||
@@ -194,14 +194,14 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
|
||||
// 更新工单状态为完成
|
||||
//更新母卷工单状态
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "09");
|
||||
map.put("realend_time", DateUtil.now());
|
||||
map.put("update_optid",currentUserId+"");
|
||||
map.put("update_optname",currentUsername);
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", currentUsername);
|
||||
map.put("finish_type", "01");
|
||||
map.put("update_time",DateUtil.now());
|
||||
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map,"container_name = '"+jsonTask.getString("material_code")+"'");
|
||||
map.put("update_time", DateUtil.now());
|
||||
WQLObject.getWQLObject("PDM_BI_RawFoilWorkOrder").update(map, "container_name = '" + jsonTask.getString("material_code") + "'");
|
||||
|
||||
// 更新冷却库存状态
|
||||
jsonIvt2.put("full_point_status", "02");
|
||||
@@ -211,38 +211,36 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
jsonIvt2.put("ivt_qty", jsonRaw.getString("productin_qty"));
|
||||
ivtTab.update(jsonIvt2);
|
||||
|
||||
// 插入入库单
|
||||
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在");
|
||||
|
||||
JSONObject jsonRegion = new JSONObject();
|
||||
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
|
||||
jsonRegion.put("io_type", "0");
|
||||
jsonRegion.put("material_id", jsonMater.getString("material_id"));
|
||||
jsonRegion.put("pcsn", jsonRaw.getString("container_name"));
|
||||
jsonRegion.put("vehicle_code", "");
|
||||
jsonRegion.put("qty", jsonRaw.getString("productin_qty"));
|
||||
jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id"));
|
||||
jsonRegion.put("bill_status", "50");
|
||||
jsonRegion.put("start_point_code", point_code2);
|
||||
jsonRegion.put("end_point_code", point_code4);
|
||||
jsonRegion.put("cust_id", "");
|
||||
jsonRegion.put("create_mode", "03");
|
||||
jsonRegion.put("task_id", task_id);
|
||||
jsonRegion.put("create_id", currentUserId);
|
||||
jsonRegion.put("create_name", currentUsername);
|
||||
jsonRegion.put("create_time", DateUtil.now());
|
||||
jsonRegion.put("update_optid", currentUserId);
|
||||
jsonRegion.put("update_optname", currentUsername);
|
||||
jsonRegion.put("update_time", DateUtil.now());
|
||||
jsonRegion.put("confirm_optid", currentUserId);
|
||||
jsonRegion.put("confirm_optname", currentUsername);
|
||||
jsonRegion.put("confirm_time", DateUtil.now());
|
||||
coolTab.insert(jsonRegion);
|
||||
}
|
||||
|
||||
// 插入入库单
|
||||
JSONObject jsonMater = WQLObject.getWQLObject("md_me_materialbase").query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("产品不存在");
|
||||
|
||||
JSONObject jsonRegion = new JSONObject();
|
||||
jsonRegion.put("iostorinv_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
jsonRegion.put("bill_code", CodeUtil.getNewCode("COOLREGION_BILL_CODE"));
|
||||
jsonRegion.put("io_type", "0");
|
||||
jsonRegion.put("material_id", jsonMater.getString("material_id"));
|
||||
jsonRegion.put("pcsn", jsonRaw.getString("container_name"));
|
||||
jsonRegion.put("vehicle_code", "");
|
||||
jsonRegion.put("qty", jsonRaw.getString("productin_qty"));
|
||||
jsonRegion.put("qty_unit_id", jsonMater.get("base_unit_id"));
|
||||
jsonRegion.put("bill_status", "50");
|
||||
jsonRegion.put("start_point_code", point_code2);
|
||||
jsonRegion.put("end_point_code", point_code4);
|
||||
jsonRegion.put("cust_id", "");
|
||||
jsonRegion.put("create_mode", "03");
|
||||
jsonRegion.put("task_id", task_id);
|
||||
jsonRegion.put("create_id", currentUserId);
|
||||
jsonRegion.put("create_name", currentUsername);
|
||||
jsonRegion.put("create_time", DateUtil.now());
|
||||
jsonRegion.put("update_optid", currentUserId);
|
||||
jsonRegion.put("update_optname", currentUsername);
|
||||
jsonRegion.put("update_time", DateUtil.now());
|
||||
jsonRegion.put("confirm_optid", currentUserId);
|
||||
jsonRegion.put("confirm_optname", currentUsername);
|
||||
jsonRegion.put("confirm_time", DateUtil.now());
|
||||
coolTab.insert(jsonRegion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,7 +282,7 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("material_code", form.getString("material_code"));
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
@@ -299,14 +297,16 @@ public class CallEmpReelTask extends AbstractAcsTask {
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
//根据类型获取对应的任务优先级
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)){
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)) {
|
||||
json.put("priority", "1");
|
||||
}else {
|
||||
} else {
|
||||
json.put("priority", priority_jo.getString("value"));
|
||||
}
|
||||
if (form.getString("task_type").equals("010101")) {
|
||||
json.put("acs_task_type", "1");
|
||||
} else {
|
||||
json.put("acs_task_type", "3");
|
||||
}
|
||||
tab.insert(json);
|
||||
|
||||
|
||||
@@ -104,18 +104,21 @@ public class CutConveyorTask extends AbstractAcsTask {
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
//调用MES接口,通知MES运输中
|
||||
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
|
||||
JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_delete ='0' AND status < '09'").getResultJSONArray(0);
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("container_name", row.getString("container_name"));
|
||||
jo.put("is_send", "1");
|
||||
//判断该接口是否需要回传
|
||||
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'airSwellWithPaperTubeAssComplete'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) {
|
||||
lmsToMesService.airSwellWithPaperTubeAssComplete(jo);
|
||||
//只有输送入的时候才调用MES
|
||||
if (jsonTask.getString("task_type").equals("010402")) {
|
||||
//调用MES接口,通知MES运输中
|
||||
LmsToMesService lmsToMesService = SpringContextHolder.getBean(LmsToMesService.class);
|
||||
JSONArray rows = WQLObject.getWQLObject("PDM_BI_SlittingProductionPlan").query("qzzno = '" + jsonTask.getString("vehicle_code") + "' AND is_child_tz_ok = '1' AND is_delete ='0' AND status < '09'").getResultJSONArray(0);
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("container_name", row.getString("container_name"));
|
||||
jo.put("is_send", "1");
|
||||
//判断该接口是否需要回传
|
||||
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'airSwellWithPaperTubeAssComplete'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) {
|
||||
lmsToMesService.airSwellWithPaperTubeAssComplete(jo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,10 +45,10 @@ public class InHotTask extends AbstractAcsTask {
|
||||
|
||||
String product_area = json.getString("product_area");
|
||||
String agv_system_type = "";
|
||||
if (product_area.equals("A1") || product_area.equals("A2")){
|
||||
if (product_area.equals("A1") || product_area.equals("A2")) {
|
||||
agv_system_type = "2";
|
||||
}
|
||||
if (product_area.equals("A3") || product_area.equals("A4")){
|
||||
if (product_area.equals("A3") || product_area.equals("A4")) {
|
||||
agv_system_type = "3";
|
||||
}
|
||||
|
||||
@@ -63,10 +63,10 @@ public class InHotTask extends AbstractAcsTask {
|
||||
.priority(json.getString("priority"))
|
||||
.remark(json.getString("remark"))
|
||||
.build();
|
||||
if (StrUtil.isNotEmpty(json.getString("point_code3"))){
|
||||
if (StrUtil.isNotEmpty(json.getString("point_code3"))) {
|
||||
dto.setNext_device_code(json.getString("point_code3"));
|
||||
dto.setPut_device_code(json.getString("point_code2"));
|
||||
}else {
|
||||
} else {
|
||||
dto.setNext_device_code(json.getString("point_code2"));
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public class InHotTask extends AbstractAcsTask {
|
||||
|
||||
if (StrUtil.equals(status, "0")) {
|
||||
// 更新删除字段
|
||||
jsonTask.put("is_delete","1");
|
||||
jsonTask.put("is_delete", "1");
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
taskTab.update(jsonTask);
|
||||
|
||||
@@ -202,7 +202,7 @@ public class InHotTask extends AbstractAcsTask {
|
||||
|
||||
//判断该接口是否需要回传
|
||||
JSONObject back_jo = WQLObject.getWQLObject("MD_PB_InterfaceBack").query("interface_name = 'momRollBakeInBound'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")){
|
||||
if (ObjectUtil.isNotEmpty(back_jo) && back_jo.getString("is_back").equals("1")) {
|
||||
new LmsToMesServiceImpl().momRollBakeInBound(param);
|
||||
}
|
||||
}
|
||||
@@ -244,7 +244,7 @@ public class InHotTask extends AbstractAcsTask {
|
||||
}
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_type", "010201");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
@@ -255,17 +255,21 @@ public class InHotTask extends AbstractAcsTask {
|
||||
json.put("sort_seq", "1");
|
||||
json.put("handle_class", THIS_CLASS);
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("material_code",form.getString("material_code"));
|
||||
json.put("material_code", form.getString("material_code"));
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
//根据类型获取对应的任务优先级
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)){
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)) {
|
||||
json.put("priority", "1");
|
||||
}else {
|
||||
} else {
|
||||
json.put("priority", priority_jo.getString("value"));
|
||||
}
|
||||
json.put("acs_task_type", "8");
|
||||
if (StrUtil.isNotEmpty(form.getString("point_code3"))) {
|
||||
json.put("acs_task_type", "8");
|
||||
} else {
|
||||
json.put("acs_task_type", "6");
|
||||
}
|
||||
tab.insert(json);
|
||||
task_id = json.getString("task_id");
|
||||
|
||||
@@ -292,7 +296,7 @@ public class InHotTask extends AbstractAcsTask {
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
|
||||
json.put("task_code", IdUtil.getSnowflake(1, 1).nextId());
|
||||
json.put("task_type", "010203");
|
||||
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
|
||||
json.put("point_code1", form.getString("point_code1"));
|
||||
@@ -305,10 +309,10 @@ public class InHotTask extends AbstractAcsTask {
|
||||
json.put("create_name", currentUsername);
|
||||
json.put("create_time", DateUtil.now());
|
||||
//根据类型获取对应的任务优先级
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag","3").addParam("task_type",json.getString("task_type")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)){
|
||||
JSONObject priority_jo = WQL.getWO("PDA_COOLIN").addParam("flag", "3").addParam("task_type", json.getString("task_type")).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(priority_jo)) {
|
||||
json.put("priority", "1");
|
||||
}else {
|
||||
} else {
|
||||
json.put("priority", priority_jo.getString("value"));
|
||||
}
|
||||
json.put("acs_task_type", "8");
|
||||
|
||||
@@ -58,4 +58,6 @@ public interface RawAssistIStorService {
|
||||
|
||||
JSONObject autoDis(JSONObject whereJson);
|
||||
|
||||
JSONObject autoDisMove(JSONObject whereJson);
|
||||
|
||||
}
|
||||
|
||||
@@ -1093,6 +1093,300 @@ public class RawAssistIStorServiceImpl implements RawAssistIStorService {
|
||||
return struct_jo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject autoDisMove(JSONObject whereJson) {
|
||||
/*
|
||||
* 分配逻辑:
|
||||
* 1、先查找该木箱内属于什么物料、订单,定位到具体的块、排,查看是否存在空位
|
||||
* a、存在的话,优先放在这一块这一排中(遍历)
|
||||
* b、不存在则根据该订单物料大概数量、选择数量相近的一个空巷道
|
||||
* 1)存在空巷道
|
||||
* 2)不存在,则找一个双通有空位置、数量相近的巷道
|
||||
* */
|
||||
|
||||
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
|
||||
String box_no = whereJson.getString("box_no");
|
||||
|
||||
String sect_id = whereJson.getString("sect_id");
|
||||
|
||||
String col_num = whereJson.getString("layer_num"); // 转库时用
|
||||
|
||||
JSONObject sub_jo = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + box_no + "' AND status < 3").uniqueResult(0);
|
||||
|
||||
String material_code = sub_jo.getString("product_name");
|
||||
|
||||
String sale_order_name = sub_jo.getString("sale_order_name");
|
||||
|
||||
HashMap<String, String> row_map = new HashMap<>();
|
||||
row_map.put("material_code", material_code);
|
||||
row_map.put("sale_order_name", sale_order_name);
|
||||
row_map.put("col_num", col_num);
|
||||
row_map.put("sect_id", sect_id);
|
||||
row_map.put("flag", "11");
|
||||
//查询到当前可用的巷道
|
||||
JSONArray rowArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
|
||||
for (int i = 0; i < rowArr.size(); i++) {
|
||||
JSONObject row_jo = rowArr.getJSONObject(i);
|
||||
|
||||
String block_num = row_jo.getString("block_num");
|
||||
String row_num = row_jo.getString("row_num");
|
||||
String placement_type = row_jo.getString("placement_type");
|
||||
|
||||
// 判断此排是否有除:入库锁、移入锁以外的锁
|
||||
JSONArray isLock = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(isLock)) {
|
||||
if (placement_type.equals("02")) {
|
||||
// 左通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
break;
|
||||
} else if (placement_type.equals("03")) {
|
||||
// 右通
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
break;
|
||||
} else {
|
||||
// 双通
|
||||
|
||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
||||
JSONObject jsonDescBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonDescStruct = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonDescBox)) {
|
||||
String out_order_seq = jsonDescBox.getString("out_order_seq");
|
||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
||||
jsonDescStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct)) {
|
||||
struct_jo = jsonDescStruct;
|
||||
break;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonAscStruct = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonAscBox)) {
|
||||
String out_order_seq2 = jsonAscBox.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
} else {
|
||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
||||
jsonAscStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "'AND placement_type = '" + placement_type + "' AND row_num = '" + row_num + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct)) {
|
||||
struct_jo = jsonAscStruct;
|
||||
break;
|
||||
} else {
|
||||
// 说明这排有任务在执行,新开一排
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
||||
plan_rows = new JSONArray();
|
||||
}
|
||||
//查询该销售订单及行号有多少个生成状态的箱子
|
||||
row_map.put("flag", "27");
|
||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(box_rows)) {
|
||||
box_rows = new JSONArray();
|
||||
}
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num2 = empty_row.getString("block_num");
|
||||
String row_num2 = empty_row.getString("row_num");
|
||||
String placement_type2 = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("02")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
break;
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num2 + "' AND row_num = '" + row_num2 + "' AND placement_type = '" + placement_type2 + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
||||
|
||||
for (int j = 0; j < haveArr.size(); j++) {
|
||||
JSONObject have_row = haveArr.getJSONObject(j);
|
||||
|
||||
String block_num3 = have_row.getString("block_num");
|
||||
String row_num3 = have_row.getString("row_num");
|
||||
|
||||
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(isLock2)) {
|
||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
||||
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonDescStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
||||
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
||||
struct_jo = jsonDescStruct2;
|
||||
break;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonAscStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
||||
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
} else {
|
||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
||||
struct_jo = jsonAscStruct2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(rowArr) || ObjectUtil.isEmpty(struct_jo)) {
|
||||
//如果不存在相同订单物料的巷道 或者未找到相同物料订单号巷道中的货位 则
|
||||
|
||||
//根据分切计划查询该订单物料大概还有多少未入
|
||||
row_map.put("flag", "12");
|
||||
JSONArray plan_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(plan_rows)) {
|
||||
plan_rows = new JSONArray();
|
||||
}
|
||||
//查询该销售订单及行号有多少个生成状态的箱子
|
||||
row_map.put("flag", "27");
|
||||
JSONArray box_rows = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParamMap(row_map).process().getResultJSONArray(0);
|
||||
if (ObjectUtil.isEmpty(box_rows)) {
|
||||
box_rows = new JSONArray();
|
||||
}
|
||||
int box_num = (int) Math.ceil(plan_rows.size() / 2) + box_rows.size();
|
||||
|
||||
//查询数量与订单物料箱子数量相近的一排
|
||||
JSONObject empty_row = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "13").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num),block_num,row_num").process().uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(empty_row)) {
|
||||
String block_num = empty_row.getString("block_num");
|
||||
String row_num = empty_row.getString("row_num");
|
||||
String placement_type = empty_row.getString("placement_type");
|
||||
|
||||
if (placement_type.equals("02")) {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "' AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
struct_jo = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num + "' AND row_num = '" + row_num + "' AND placement_type = '" + placement_type + "'AND is_delete = '0' AND is_used = '1' AND lock_type = '1' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
} else {
|
||||
|
||||
//如果查询不到空的一排,则查询有空位双通的一排
|
||||
JSONArray haveArr = WQL.getWO("QST_IVT_RAWASSISTISTOR").addParam("col_num", col_num).addParam("sect_id", sect_id).addParam("flag", "14").addParam("sql_str", " ORDER BY abs(" + box_num + "-a.struct_num)").process().getResultJSONArray(0);
|
||||
for (int j = 0; j < haveArr.size(); j++) {
|
||||
JSONObject have_row = haveArr.getJSONObject(j);
|
||||
|
||||
String block_num3 = have_row.getString("block_num");
|
||||
String row_num3 = have_row.getString("row_num");
|
||||
|
||||
JSONArray isLock2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type not in ('1','2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1'").getResultJSONArray(0);
|
||||
|
||||
if (ObjectUtil.isEmpty(isLock2)) {
|
||||
// 先倒序找到第一个木箱、判断上一个是否有货位
|
||||
JSONObject jsonDescBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonDescStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonDescBox2)) {
|
||||
String out_order_seq = jsonDescBox2.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
} else {
|
||||
// 先倒序找到第一个入库锁或者移库锁、判断上一个是否有货位
|
||||
JSONObject jsonDescEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq DESC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescEmpStruct)) {
|
||||
String out_order_seq = jsonDescEmpStruct.getString("out_order_seq");
|
||||
jsonDescStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq > '" + out_order_seq + "' order by out_order_seq ASC").uniqueResult(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonDescStruct2)) {
|
||||
struct_jo = jsonDescStruct2;
|
||||
break;
|
||||
} else {
|
||||
// 没有就正序找到第一个物料、判断上一个是否有货位
|
||||
JSONObject jsonAscBox2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') <> '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
JSONObject jsonAscStruct2 = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(jsonAscBox2)) {
|
||||
String out_order_seq2 = jsonAscBox2.getString("out_order_seq");
|
||||
// 上一个货位顺序号
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
} else {
|
||||
JSONObject jsonAscEmpStruct = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type in ('2','7') AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' order by out_order_seq ASC").uniqueResult(0);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonAscEmpStruct)) {
|
||||
String out_order_seq2 = jsonAscEmpStruct.getString("out_order_seq");
|
||||
jsonAscStruct2 = WQLObject.getWQLObject("st_ivt_structattr").query("lock_type = '1' AND block_num = '" + block_num3 + "' AND row_num = '" + row_num3 + "' AND is_delete = '0' AND is_used = '1' AND IFNULL(storagevehicle_code,'') = '' and out_order_seq < '" + out_order_seq2 + "' order by out_order_seq DESC").uniqueResult(0);
|
||||
}
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonAscStruct2)) {
|
||||
struct_jo = jsonAscStruct2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(struct_jo)) {
|
||||
throw new BadRequestException("未查询到可用的仓位!");
|
||||
}
|
||||
return struct_jo;
|
||||
}
|
||||
|
||||
public JSONObject queryEmpStruct(JSONObject whereJson) {
|
||||
JSONObject struct_jo = new JSONObject();
|
||||
String sect_id = whereJson.getString("sect_id");
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
输入.stor_id TYPEAS s_string
|
||||
输入.sap_pcsn TYPEAS s_string
|
||||
输入.pcsn TYPEAS s_string
|
||||
输入.col_num TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
输入.bill_type TYPEAS s_string
|
||||
输入.box_no TYPEAS s_string
|
||||
@@ -452,6 +453,9 @@
|
||||
ENDOPTION
|
||||
OPTION 输入.sale_order_name <> ""
|
||||
sub.sale_order_name = 输入.sale_order_name
|
||||
ENDOPTION
|
||||
OPTION 输入.col_num <> ""
|
||||
sa2.layer_num = 输入.col_num
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
sa2.block_num,sa2.row_num,sa2.placement_type
|
||||
@@ -498,6 +502,11 @@
|
||||
sa.is_delete = '0'
|
||||
AND is_used = '1'
|
||||
AND sa.sect_id = 输入.sect_id
|
||||
|
||||
OPTION 输入.col_num <> ""
|
||||
sa.layer_num = 输入.col_num
|
||||
ENDOPTION
|
||||
|
||||
GROUP BY
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
@@ -553,6 +562,10 @@
|
||||
AND is_used = '1'
|
||||
AND placement_type = '01'
|
||||
AND sa.sect_id = 输入.sect_id
|
||||
|
||||
OPTION 输入.col_num <> ""
|
||||
sa.layer_num = 输入.col_num
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
sa.block_num,
|
||||
sa.row_num,
|
||||
|
||||
@@ -3396,12 +3396,15 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
public void createMove(JSONObject whereJson) {
|
||||
//任务表
|
||||
WQLObject wo_Task = WQLObject.getWQLObject("SCH_BASE_Task");
|
||||
WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
|
||||
JSONArray jsonAllBlockPoint = whereJson.getJSONArray("jsonAllBlockPoint");
|
||||
|
||||
for (int i = 0; i < jsonAllBlockPoint.size(); i++) {
|
||||
JSONObject json = jsonAllBlockPoint.getJSONObject(i);
|
||||
|
||||
JSONObject jsonAttr = attrTab.query("struct_code = '" + json.getString("struct_code") + "'").uniqueResult(0);
|
||||
|
||||
JSONObject mapParam = new JSONObject();// 生成移库单传入参数
|
||||
JSONArray table = new JSONArray(); // 明细参数
|
||||
mapParam.put("bill_status", "10");
|
||||
@@ -3417,7 +3420,8 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
|
||||
JSONObject moveParam = new JSONObject();
|
||||
moveParam.put("box_no", json.getString("storagevehicle_code"));
|
||||
moveParam.put("sect_id", RegionTypeEnum.ZZ01.getId());
|
||||
JSONObject jsonMove = rawAssistIStorService.autoDis(moveParam);
|
||||
moveParam.put("layer_num", jsonAttr.getString("layer_num"));
|
||||
JSONObject jsonMove = rawAssistIStorService.autoDisMove(moveParam);
|
||||
// 查询移出货位的库存物料
|
||||
JSONObject jsonMoveIvt = WQL.getWO("ST_OUTIVT03")
|
||||
.addParam("flag", "6")
|
||||
|
||||
@@ -257,6 +257,8 @@
|
||||
AND attr.out_order_seq > 输入.out_order_seq
|
||||
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
|
||||
|
||||
ORDER BY out_order_seq DESC
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -274,6 +276,8 @@
|
||||
AND attr.out_order_seq < 输入.out_order_seq
|
||||
AND IFNULL( attr.storagevehicle_code, '' ) <> ''
|
||||
|
||||
ORDER BY out_order_seq
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
Reference in New Issue
Block a user