|
|
|
|
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
@@ -16,6 +17,7 @@ import org.nl.common.exception.BadRequestException;
|
|
|
|
|
import org.nl.common.utils.CodeUtil;
|
|
|
|
|
import org.nl.common.utils.IdUtil;
|
|
|
|
|
import org.nl.common.utils.SecurityUtils;
|
|
|
|
|
import org.nl.config.SpringContextHolder;
|
|
|
|
|
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
|
|
|
|
import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
|
|
|
|
|
import org.nl.wms.basedata_manage.service.IStructattrService;
|
|
|
|
|
@@ -23,6 +25,10 @@ import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
|
|
|
|
|
import org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo;
|
|
|
|
|
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
|
|
|
|
import org.nl.wms.basedata_manage.service.dao.mapper.MdPbStoragevehicleinfoMapper;
|
|
|
|
|
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
|
|
|
|
import org.nl.wms.sch_manage.service.dao.mapper.SchBasePointMapper;
|
|
|
|
|
import org.nl.wms.sch_manage.service.util.AbstractTask;
|
|
|
|
|
import org.nl.wms.sch_manage.service.util.tasks.StInTask;
|
|
|
|
|
import org.nl.wms.warehouse_management.service.IRawAssistIStorService;
|
|
|
|
|
import org.nl.wms.warehouse_management.service.dao.GroupPlate;
|
|
|
|
|
import org.nl.wms.warehouse_management.service.dao.IOStorInv;
|
|
|
|
|
@@ -69,6 +75,9 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
@Resource
|
|
|
|
|
private MdPbStoragevehicleinfoMapper mdPbStoragevehicleinfoMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private SchBasePointMapper schBasePointMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private GroupPlateMapper groupPlateMapper;
|
|
|
|
|
|
|
|
|
|
@@ -170,7 +179,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
ioStorInvDtl.put("bill_status","10");
|
|
|
|
|
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
|
|
|
|
ioStorInvDtl.put("assign_qty",row.get("qty"));
|
|
|
|
|
ioStorInvDtl.put("assign_qty","0");
|
|
|
|
|
ioStorInvDtl.put("unassign_qty",row.get("plan_qty"));
|
|
|
|
|
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
|
|
|
|
total_qty += Double.parseDouble(row.get("qty").toString());
|
|
|
|
|
|
|
|
|
|
@@ -366,10 +376,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void divStruct(Map whereJson) {
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
|
|
|
|
String nickName = SecurityUtils.getCurrentNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
String sect_id = "";
|
|
|
|
|
String sect_code = "";
|
|
|
|
|
String sect_name = "";
|
|
|
|
|
@@ -380,26 +388,16 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
JSONObject whereJson2 = JSONObject.parseObject(JSON.toJSONString(whereJson));
|
|
|
|
|
HashMap<String, String> map = rows.get(0);
|
|
|
|
|
|
|
|
|
|
//判断该载具是否已经分配货位或者起点
|
|
|
|
|
//判断该分配明细是否已经分配货位
|
|
|
|
|
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
|
|
|
|
.isNull(IOStorInvDis::getStruct_code));
|
|
|
|
|
.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code,""));
|
|
|
|
|
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
|
|
|
|
throw new BadRequestException("该明细已经分配过货位,无法继续分配!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String point_code = map.get("point_code");
|
|
|
|
|
// if (StrUtil.isNotEmpty(point_code)) {
|
|
|
|
|
// HashMap<String, String> point_map = new HashMap<>();
|
|
|
|
|
// PointDto pointDto = pointService.findByCode(point_code);
|
|
|
|
|
// point_map.put("point_code", pointDto.getPoint_code());
|
|
|
|
|
// point_map.put("point_id", pointDto.getPoint_id() + "");
|
|
|
|
|
// point_map.put("point_name", pointDto.getPoint_name());
|
|
|
|
|
// WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(point_map, "iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
Boolean checked = whereJson2.getBoolean("checked");
|
|
|
|
|
//是否分配货位
|
|
|
|
|
//是否自动分配仓位
|
|
|
|
|
if (ObjectUtil.isNotEmpty(checked) && checked) {
|
|
|
|
|
JSONObject jo_form = new JSONObject();
|
|
|
|
|
Structattr struct = new Structattr();
|
|
|
|
|
@@ -433,33 +431,6 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
structattr.getZdepth().compareTo(mdPbStoragevehicleinfo.getVehicle_long()) <0){
|
|
|
|
|
throw new BadRequestException("载具不符合,请检查!");
|
|
|
|
|
}
|
|
|
|
|
// // 校验仓位是否满足此木箱高度
|
|
|
|
|
// JSONObject jsonSub = WQLObject.getWQLObject("pdm_bi_subpackagerelation").query("package_box_sn = '" + map.get("box_no") + "'").uniqueResult(0);
|
|
|
|
|
// double box_high = jsonSub.getDoubleValue("box_high");
|
|
|
|
|
//
|
|
|
|
|
// JSONObject jsonAttr = WQLObject.getWQLObject("st_ivt_structattr").query("struct_code = '" + map.get("struct_code") + "'").uniqueResult(0);
|
|
|
|
|
//
|
|
|
|
|
// // 入库木箱下限
|
|
|
|
|
// String in_download_box_high = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_download_box_high").getValue();
|
|
|
|
|
// // 入库木箱上线
|
|
|
|
|
// String in_up_box_high = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("in_up_box_high").getValue();
|
|
|
|
|
//
|
|
|
|
|
// if (Double.parseDouble(in_download_box_high) < box_high && box_high <= Double.parseDouble(in_up_box_high)) {
|
|
|
|
|
// if (StrUtil.equals(jsonAttr.getString("layer_num"), "3")) {
|
|
|
|
|
// if (box_high > jsonAttr.getDoubleValue("height")) {
|
|
|
|
|
// throw new BadRequestException("木箱高度不符,请检查!");
|
|
|
|
|
// }
|
|
|
|
|
// } else if (StrUtil.equals(jsonAttr.getString("layer_num"), "1")) {
|
|
|
|
|
// if (box_high > Double.parseDouble(in_download_box_high)) {
|
|
|
|
|
// throw new BadRequestException("木箱高度不符,请检查!");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (box_high > Double.parseDouble(in_up_box_high)) {
|
|
|
|
|
// throw new BadRequestException("木箱高度不符,请检查!");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
sect_id = map.get("sect_id");
|
|
|
|
|
sect_code = map.get("sect_code");
|
|
|
|
|
sect_name = map.get("sect_name");
|
|
|
|
|
@@ -467,7 +438,7 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
struct_code = map.get("struct_code");
|
|
|
|
|
struct_name = map.get("struct_name");
|
|
|
|
|
}
|
|
|
|
|
HashMap<String, String> dis_map = new HashMap();
|
|
|
|
|
JSONObject dis_map = new JSONObject();
|
|
|
|
|
dis_map.put("sect_id", sect_id);
|
|
|
|
|
dis_map.put("sect_code", sect_code);
|
|
|
|
|
dis_map.put("sect_name", sect_name);
|
|
|
|
|
@@ -476,107 +447,43 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
dis_map.put("struct_name", struct_name);
|
|
|
|
|
|
|
|
|
|
//锁定货位
|
|
|
|
|
// JSONObject lock_map = new JSONObject();
|
|
|
|
|
// lock_map.put("end_point", struct_code);
|
|
|
|
|
// //查询主表信息
|
|
|
|
|
// JSONObject mst = WQLObject.getWQLObject("st_ivt_iostorinv").query("iostorinv_id = '" + map.get("iostorinv_id") + "'").uniqueResult(0);
|
|
|
|
|
// lock_map.put("inv_type", mst.get("bill_type"));
|
|
|
|
|
// lock_map.put("inv_id", mst.get("iostorinv_id"));
|
|
|
|
|
// lock_map.put("inv_code", mst.get("bill_code"));
|
|
|
|
|
// inbillService.operatePoint("0", lock_map);
|
|
|
|
|
//
|
|
|
|
|
// //判断起点是否不为空
|
|
|
|
|
// JSONObject ios_dis = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'").uniqueResult(0);
|
|
|
|
|
//
|
|
|
|
|
// JSONObject sect_jo = WQLObject.getWQLObject("st_ivt_sectattr").query("sect_id ='" + sect_id + "'").uniqueResult(0);
|
|
|
|
|
// boolean is_virtual = false;
|
|
|
|
|
// if ("09".equals(sect_jo.getString("sect_type_attr"))) {
|
|
|
|
|
// is_virtual = true;
|
|
|
|
|
// String task_id = cn.hutool.core.util.IdUtil.getSnowflake(1, 1).nextId() + "";
|
|
|
|
|
// dis_map.put("task_id", task_id);
|
|
|
|
|
// dis_map.put("work_status", "01");
|
|
|
|
|
// }
|
|
|
|
|
// if (StrUtil.isNotEmpty(ios_dis.getString("point_id")) && !is_virtual) {
|
|
|
|
|
// //创建任务并下发
|
|
|
|
|
// InTask task = new InTask();
|
|
|
|
|
// JSONObject task_form = new JSONObject();
|
|
|
|
|
// task_form.put("task_type", "010501");
|
|
|
|
|
// task_form.put("start_device_code", map.get("point_code"));
|
|
|
|
|
// task_form.put("next_device_code", struct_code);
|
|
|
|
|
// task_form.put("vehicle_code", map.get("box_no"));
|
|
|
|
|
// task_form.put("storagevehicle_type", map.get("storagevehicle_type"));
|
|
|
|
|
// String task_id = task.createTask(task_form);
|
|
|
|
|
// // 下发
|
|
|
|
|
// task.immediateNotifyAcs(task_id);
|
|
|
|
|
// /* if (whereJson.containsKey("auto_issue")) {
|
|
|
|
|
// }*/
|
|
|
|
|
// dis_map.put("task_id", task_id);
|
|
|
|
|
// dis_map.put("work_status", "01");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// WQLObject.getWQLObject("ST_IVT_IOStorInvDis").update(dis_map, "iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'");
|
|
|
|
|
//
|
|
|
|
|
// //修改库存
|
|
|
|
|
// //直接取出入库分配表的库存
|
|
|
|
|
// JSONArray dis_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDis").query("iostorinv_id = '" + map.get("iostorinv_id") + "' AND box_no = '" + map.get("box_no") + "'").getResultJSONArray(0);
|
|
|
|
|
// JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + map.get("iostorinv_id") + "'").uniqueResult(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_jo.getString("bill_type"));
|
|
|
|
|
// i_form.put("quality_scode", "01");
|
|
|
|
|
// 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_jo.getString("qty_unit_id"));
|
|
|
|
|
// i_form.put("qty_unit_name", dis_jo.getString("qty_unit_name"));
|
|
|
|
|
// storPublicService.IOStor(i_form, "31");
|
|
|
|
|
//
|
|
|
|
|
// JSONObject dtl_jo = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinvdtl_id = '" + dis_jo.getString("iostorinvdtl_id") + "'").uniqueResult(0);
|
|
|
|
|
// if (StrUtil.isNotEmpty(ios_dis.getString("point_id")) || is_virtual) {
|
|
|
|
|
// 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) AND (point_id = '' OR point_id is null)").getResultJSONArray(0);
|
|
|
|
|
// if (disdiv_rows.size() == 0) {
|
|
|
|
|
// dtl_jo.put("bill_status", "40");
|
|
|
|
|
// WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
|
|
|
|
|
// //判断主表下的明细是否都为40
|
|
|
|
|
// JSONArray dtl_rows = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").query("iostorinv_id = '" + dis_jo.getString("iostorinv_id") + "' AND bill_status < '40'").getResultJSONArray(0);
|
|
|
|
|
// if (dtl_rows.size() == 0) {
|
|
|
|
|
// mst_jo.put("bill_status", "40");
|
|
|
|
|
// mst_jo.put("dis_optid", currentUserId);
|
|
|
|
|
// mst_jo.put("dis_optname", nickName);
|
|
|
|
|
// mst_jo.put("dis_time", now);
|
|
|
|
|
// WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
|
|
|
|
// } else {
|
|
|
|
|
// mst_jo.put("bill_status", "30");
|
|
|
|
|
// mst_jo.put("dis_optid", currentUserId);
|
|
|
|
|
// mst_jo.put("dis_optname", nickName);
|
|
|
|
|
// mst_jo.put("dis_time", now);
|
|
|
|
|
// WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// dtl_jo.put("bill_status", "30");
|
|
|
|
|
// WQLObject.getWQLObject("ST_IVT_IOStorInvDtl").update(dtl_jo);
|
|
|
|
|
// mst_jo.put("bill_status", "30");
|
|
|
|
|
// mst_jo.put("dis_optid", currentUserId);
|
|
|
|
|
// mst_jo.put("dis_optname", nickName);
|
|
|
|
|
// mst_jo.put("dis_time", now);
|
|
|
|
|
// WQLObject.getWQLObject("ST_IVT_IOStorInv").update(mst_jo);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// //如果是虚拟区,直接更新完成分配任务
|
|
|
|
|
// if (is_virtual) {
|
|
|
|
|
// JSONObject dis_form = new JSONObject();
|
|
|
|
|
// dis_form.put("task_id", dis_map.get("task_id"));
|
|
|
|
|
// inbillService.confirmDis(dis_form);
|
|
|
|
|
// }
|
|
|
|
|
IOStorInv ioStorInv = ioStorInvMapper.selectById(map.get("iostorinv_id"));
|
|
|
|
|
JSONObject lock_map = new JSONObject();
|
|
|
|
|
lock_map.put("struct_code", struct_code);
|
|
|
|
|
lock_map.put("inv_id", ioStorInv.getIostorinv_id());
|
|
|
|
|
lock_map.put("inv_code", ioStorInv.getBill_code());
|
|
|
|
|
lock_map.put("inv_type", ioStorInv.getBill_type());
|
|
|
|
|
iStructattrService.updateStatusByCode("0",lock_map);
|
|
|
|
|
|
|
|
|
|
// 修改分配明细表
|
|
|
|
|
ioStorInvDisMapper.update(dis_map.toJavaObject(IOStorInvDis.class),new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getSect_id,dis_map.getString("sect_id"))
|
|
|
|
|
.set(IOStorInvDis::getSect_code,dis_map.getString("sect_code"))
|
|
|
|
|
.set(IOStorInvDis::getSect_name,dis_map.getString("sect_name"))
|
|
|
|
|
.set(IOStorInvDis::getStruct_id,dis_map.getString("struct_id"))
|
|
|
|
|
.set(IOStorInvDis::getStruct_code,dis_map.getString("struct_code"))
|
|
|
|
|
.set(IOStorInvDis::getStruct_name,dis_map.getString("struct_name"))
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//维护单据明细表里 分配数量
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
jsonObject.put("iostorinvdtl_id",map.get("iostorinvdtl_id"));
|
|
|
|
|
jsonObject.put("bill_status","30");
|
|
|
|
|
jsonObject.put("assign_qty",map.get("plan_qty"));
|
|
|
|
|
jsonObject.put("unassign_qty","0");
|
|
|
|
|
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
|
|
|
|
|
|
|
|
|
//根据单据标识判断分配明细是否都已经分配完成
|
|
|
|
|
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id,map.get("iostorinv_id"))
|
|
|
|
|
.isNull(IOStorInvDis::getStruct_code).or().eq(IOStorInvDis::getStruct_code,""));
|
|
|
|
|
|
|
|
|
|
// 根据分配货位情况 更新主表单据状态
|
|
|
|
|
IOStorInv ios = new IOStorInv();
|
|
|
|
|
ios.setIostorinv_id(map.get("iostorinv_id"));
|
|
|
|
|
ios.setBill_status(disCount>0 ? "20" : "30");
|
|
|
|
|
ioStorInvMapper.updateById(ios);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -585,13 +492,89 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void unDivStruct(Map whereJson) {
|
|
|
|
|
|
|
|
|
|
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableMater");
|
|
|
|
|
HashMap<String, String> jo = rows.get(0);
|
|
|
|
|
|
|
|
|
|
//解锁原货位点位
|
|
|
|
|
JSONObject unlock_map = new JSONObject();
|
|
|
|
|
unlock_map.put("struct_code", jo.get("struct_code"));
|
|
|
|
|
unlock_map.put("inv_type", null);
|
|
|
|
|
unlock_map.put("inv_id", null);
|
|
|
|
|
unlock_map.put("inv_code", null);
|
|
|
|
|
iStructattrService.updateStatusByCode("2",unlock_map);
|
|
|
|
|
|
|
|
|
|
// 修改分配明细表
|
|
|
|
|
ioStorInvDisMapper.update(new IOStorInvDis(),new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getSect_id,null)
|
|
|
|
|
.set(IOStorInvDis::getSect_code,null)
|
|
|
|
|
.set(IOStorInvDis::getSect_name,null)
|
|
|
|
|
.set(IOStorInvDis::getStruct_id,null)
|
|
|
|
|
.set(IOStorInvDis::getStruct_code,null)
|
|
|
|
|
.set(IOStorInvDis::getStruct_name,null)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id,jo.get("iostorinvdis_id"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//维护单据明细表里 分配数量
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
jsonObject.put("iostorinvdtl_id",jo.get("iostorinvdtl_id"));
|
|
|
|
|
jsonObject.put("bill_status","10");
|
|
|
|
|
jsonObject.put("assign_qty","0");
|
|
|
|
|
jsonObject.put("unassign_qty",jo.get("plan_qty"));
|
|
|
|
|
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
|
|
|
|
|
|
|
|
|
//根据单据标识判断分配明细是否都已经分配完成
|
|
|
|
|
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id,jo.get("iostorinv_id"))
|
|
|
|
|
.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,""));
|
|
|
|
|
|
|
|
|
|
// 根据分配货位情况 更新主表单据状态
|
|
|
|
|
IOStorInv ios = new IOStorInv();
|
|
|
|
|
ios.setIostorinv_id(jo.get("iostorinv_id"));
|
|
|
|
|
ios.setBill_status(disCount>0 ? "20" : "10");
|
|
|
|
|
ioStorInvMapper.updateById(ios);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void divPoint(Map whereJson) {
|
|
|
|
|
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableMater");
|
|
|
|
|
String point_code = (String) whereJson.get("point_code");
|
|
|
|
|
HashMap<String, String> map = rows.get(0);
|
|
|
|
|
|
|
|
|
|
//判断是否已经分配好货位
|
|
|
|
|
IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectOne(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id,map.get("iostorinvdis_id"))
|
|
|
|
|
.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,""));
|
|
|
|
|
if (ObjectUtil.isEmpty(ioStorInvDis)){
|
|
|
|
|
throw new BadRequestException("该明细还没分配货位,请先分配货位");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//创建任务
|
|
|
|
|
JSONObject task_form = new JSONObject();
|
|
|
|
|
task_form.put("task_type", "STInTask");
|
|
|
|
|
task_form.put("TaskCode",CodeUtil.getNewCode("TASK_CODE"));
|
|
|
|
|
task_form.put("PickingLocation", point_code);
|
|
|
|
|
task_form.put("PlacedLocation", ioStorInvDis.getStruct_code());
|
|
|
|
|
task_form.put("vehicle_code", map.get("storagevehicle_code"));
|
|
|
|
|
GroupPlate groupPlate = groupPlateMapper.selectOne(new LambdaQueryWrapper<>(GroupPlate.class)
|
|
|
|
|
.eq(GroupPlate::getStoragevehicle_code,map.get("storagevehicle_code"))
|
|
|
|
|
);
|
|
|
|
|
task_form.put("group_id", groupPlate.getGroup_id());
|
|
|
|
|
|
|
|
|
|
StInTask stInTask = SpringContextHolder.getBean("STInTask");
|
|
|
|
|
|
|
|
|
|
String task_id = stInTask.create(task_form);
|
|
|
|
|
|
|
|
|
|
//分配明细表更新任务相关数据
|
|
|
|
|
IOStorInvDis dis = new IOStorInvDis();
|
|
|
|
|
dis.setIostorinvdis_id(map.get("iostorinvdis_id"));
|
|
|
|
|
dis.setWork_status("01");
|
|
|
|
|
dis.setTask_id(task_id);
|
|
|
|
|
dis.setPoint_code(point_code);
|
|
|
|
|
ioStorInvDisMapper.updateById(dis);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -620,7 +603,31 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void confirm(Map whereJson) {
|
|
|
|
|
IOStorInv ioStorInv = ioStorInvMapper.selectOne(new LambdaQueryWrapper<>(IOStorInv.class)
|
|
|
|
|
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(ioStorInv) && !"20".equals(ioStorInv.getBill_status()) && !"30".equals(ioStorInv.getBill_status())){
|
|
|
|
|
throw new BadRequestException("主表状态必须为分配中、分配完!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 分配明细中 任务状态必须全部完成
|
|
|
|
|
int count = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id,whereJson.get("iostorinv_id"))
|
|
|
|
|
.lt(IOStorInvDis::getWork_status,"99")
|
|
|
|
|
);
|
|
|
|
|
if (count > 0){
|
|
|
|
|
throw new BadRequestException("存在未完成的作业");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//将明细全部变成99
|
|
|
|
|
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
|
|
|
|
.set(IOStorInvDtl::getBill_status,"99")
|
|
|
|
|
.eq(IOStorInvDtl::getIostorinv_id,whereJson.get("iostorinv_id"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -632,8 +639,8 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
@Override
|
|
|
|
|
public List<IOStorInvDisDto> getDisDtl(Map whereJson) {
|
|
|
|
|
//查询该明细下的所有入库分配载具明细
|
|
|
|
|
String iostorinv_id = (String) whereJson.get("iostorinv_id");
|
|
|
|
|
return ioStorInvDisMapper.queryInBillDisDtlByIosId(iostorinv_id);
|
|
|
|
|
String iostorinvdtl_id = (String) whereJson.get("iostorinvdtl_id");
|
|
|
|
|
return ioStorInvDisMapper.queryInBillDisDtlByIosId(iostorinvdtl_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -645,25 +652,25 @@ public class RawAssistIStorServiceImpl extends ServiceImpl<IOStorInvMapper, IOSt
|
|
|
|
|
public Structattr autoDis(JSONObject whereJson) {
|
|
|
|
|
String sect_id = whereJson.getString("sect_id");
|
|
|
|
|
String storagevehicle_code = whereJson.getString("storagevehicle_code");
|
|
|
|
|
// 过滤没有任务的仓位号
|
|
|
|
|
// 查询没有任务的仓位号
|
|
|
|
|
List<Structattr> structattrList = iStructattrService.list(new LambdaQueryWrapper<>(Structattr.class)
|
|
|
|
|
.eq(Structattr::getSect_id,sect_id)
|
|
|
|
|
.eq(Structattr::getLock_type,"00")
|
|
|
|
|
);
|
|
|
|
|
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
|
|
|
|
|
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code,storagevehicle_code)
|
|
|
|
|
);
|
|
|
|
|
if (ObjectUtil.isEmpty(structattrList)){
|
|
|
|
|
throw new BadRequestException("该库区没有仓位");
|
|
|
|
|
}
|
|
|
|
|
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
|
|
|
|
|
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code,storagevehicle_code)
|
|
|
|
|
);
|
|
|
|
|
if (ObjectUtil.isEmpty(mdPbStoragevehicleinfo)){
|
|
|
|
|
throw new BadRequestException("没有该载具号信息");
|
|
|
|
|
}
|
|
|
|
|
// 过滤掉不满足载具长宽高的仓位
|
|
|
|
|
Structattr structattr = structattrList.stream().filter(st ->
|
|
|
|
|
st.getWidth().compareTo(mdPbStoragevehicleinfo.getVehicle_width()) <0 &&
|
|
|
|
|
st.getHeight().compareTo(mdPbStoragevehicleinfo.getVehicle_height()) <0 &&
|
|
|
|
|
st.getZdepth().compareTo(mdPbStoragevehicleinfo.getVehicle_long()) <0
|
|
|
|
|
st.getWidth().compareTo(mdPbStoragevehicleinfo.getVehicle_width()) >=0 &&
|
|
|
|
|
st.getHeight().compareTo(mdPbStoragevehicleinfo.getVehicle_height()) >=0 &&
|
|
|
|
|
st.getZdepth().compareTo(mdPbStoragevehicleinfo.getVehicle_long()) >=0
|
|
|
|
|
).findAny().get();
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(structattr)){
|
|
|
|
|
|