|
|
|
|
@@ -112,7 +112,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
String[] s = pcsn.split(" ");
|
|
|
|
|
String pcsn_in = String.join("','", Arrays.asList(s));
|
|
|
|
|
|
|
|
|
|
map.put("pcsn_in", "('"+pcsn_in+"')");
|
|
|
|
|
map.put("pcsn_in", "('" + pcsn_in + "')");
|
|
|
|
|
} else {
|
|
|
|
|
map.put("pcsn", "%" + pcsn + "%");
|
|
|
|
|
}
|
|
|
|
|
@@ -127,12 +127,12 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
if (!StrUtil.isEmpty(end_time)) {
|
|
|
|
|
map.put("end_time", end_time);
|
|
|
|
|
}
|
|
|
|
|
return ioStorInvMapper.queryAllByPage(new Page<>(page.getPage()+1, page.getSize()), map);
|
|
|
|
|
return ioStorInvMapper.queryAllByPage(new Page<>(page.getPage() + 1, page.getSize()), map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<GroupPlateDto> getBillDtl(Map whereJson, PageQuery page) {
|
|
|
|
|
return ioStorInvMapper.getGroupPlate(new Page<>(page.getPage()+1,page.getSize()),whereJson);
|
|
|
|
|
return ioStorInvMapper.getGroupPlate(new Page<>(page.getPage() + 1, page.getSize()), whereJson);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -142,6 +142,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
String nickName = SecurityUtils.getCurrentNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
BigDecimal total_qty = new BigDecimal(BigInteger.ZERO);
|
|
|
|
|
int row_size = 0;
|
|
|
|
|
JSONObject io_mst = new JSONObject();
|
|
|
|
|
String iostorinv_id = IdUtil.getStringId();
|
|
|
|
|
String bill_code = CodeUtil.getNewCode("IN_STORE_CODE");
|
|
|
|
|
@@ -156,7 +157,6 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
io_mst.put("stor_id", whereJson.get("stor_id"));
|
|
|
|
|
io_mst.put("stor_code", stor_code);
|
|
|
|
|
io_mst.put("stor_name", stor_name);
|
|
|
|
|
io_mst.put("detail_count", rows.size());
|
|
|
|
|
io_mst.put("remark", whereJson.get("remark"));
|
|
|
|
|
io_mst.put("bill_status", whereJson.get("bill_status"));
|
|
|
|
|
io_mst.put("create_mode", IOSEnum.CREATE_MODE.code("PC产生"));
|
|
|
|
|
@@ -174,35 +174,51 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
for (int i = 0; i < rows.size(); i++) {
|
|
|
|
|
HashMap<String, Object> row = rows.get(i);
|
|
|
|
|
JSONObject ioStorInvDtl = new JSONObject();
|
|
|
|
|
ioStorInvDtl.putAll(row);
|
|
|
|
|
ioStorInvDtl.put("iostorinvdtl_id",IdUtil.getStringId());
|
|
|
|
|
ioStorInvDtl.put("iostorinv_id",iostorinv_id);
|
|
|
|
|
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
|
|
|
|
ioStorInvDtl.put("material_id",row.get("material_id"));
|
|
|
|
|
ioStorInvDtl.put("material_code",row.get("material_code"));
|
|
|
|
|
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
|
|
|
|
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
|
|
|
|
ioStorInvDtl.put("source_bill_type",row.get("ext_type"));
|
|
|
|
|
ioStorInvDtl.put("source_bill_code",row.get("ext_code"));
|
|
|
|
|
ioStorInvDtl.put("assign_qty","0");
|
|
|
|
|
ioStorInvDtl.put("unassign_qty",row.get("qty"));
|
|
|
|
|
ioStorInvDtl.put("plan_qty",row.get("qty"));
|
|
|
|
|
Double qty = new Double(String.valueOf(row.get("qty")));
|
|
|
|
|
total_qty = total_qty.add(new BigDecimal(qty));
|
|
|
|
|
//判断是否存在相同批次、相同物料的物料明细存在
|
|
|
|
|
IOStorInvDtl dtl_dto = ioStorInvDtlMapper.selectOne(new LambdaQueryWrapper<IOStorInvDtl>()
|
|
|
|
|
.eq(IOStorInvDtl::getMaterial_code, row.get("material_code"))
|
|
|
|
|
.eq(IOStorInvDtl::getPcsn, row.get("pcsn"))
|
|
|
|
|
.eq(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("生成"))
|
|
|
|
|
.eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
|
|
|
|
|
if (ObjectUtil.isEmpty(dtl_dto)) {
|
|
|
|
|
ioStorInvDtl.putAll(row);
|
|
|
|
|
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
|
|
|
|
|
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
|
|
|
|
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
|
|
|
|
ioStorInvDtl.put("material_id", row.get("material_id"));
|
|
|
|
|
ioStorInvDtl.put("material_code", row.get("material_code"));
|
|
|
|
|
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
|
|
|
|
|
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_name", row.get("qty_unit_name"));
|
|
|
|
|
ioStorInvDtl.put("source_bill_type", row.get("ext_type"));
|
|
|
|
|
ioStorInvDtl.put("source_bill_code", row.get("ext_code"));
|
|
|
|
|
ioStorInvDtl.put("assign_qty", "0");
|
|
|
|
|
ioStorInvDtl.put("unassign_qty", row.get("qty"));
|
|
|
|
|
ioStorInvDtl.put("plan_qty", row.get("qty"));
|
|
|
|
|
Double qty = new Double(String.valueOf(row.get("qty")));
|
|
|
|
|
total_qty = total_qty.add(new BigDecimal(qty));
|
|
|
|
|
|
|
|
|
|
//判断该载具编号是否已经存在库内
|
|
|
|
|
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
|
|
|
|
if (ObjectUtil.isNotEmpty(structattr)) {
|
|
|
|
|
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
|
|
|
|
|
//判断该载具编号是否已经存在库内
|
|
|
|
|
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code, row.get("storagevehicle_code")));
|
|
|
|
|
if (ObjectUtil.isNotEmpty(structattr)) {
|
|
|
|
|
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
|
|
|
|
|
}
|
|
|
|
|
IOStorInvDtl invDtl = ioStorInvDtl.toJavaObject(IOStorInvDtl.class);
|
|
|
|
|
ioStorInvDtlMapper.insert(invDtl);
|
|
|
|
|
row_size++;
|
|
|
|
|
} else {
|
|
|
|
|
Double qty = new Double(String.valueOf(row.get("qty")));
|
|
|
|
|
dtl_dto.setUnassign_qty(dtl_dto.getUnassign_qty().add(new BigDecimal(qty)));
|
|
|
|
|
dtl_dto.setPlan_qty(dtl_dto.getPlan_qty().add(new BigDecimal(qty)));
|
|
|
|
|
total_qty = total_qty.add(new BigDecimal(qty));
|
|
|
|
|
ioStorInvDtlMapper.updateById(dtl_dto);
|
|
|
|
|
}
|
|
|
|
|
IOStorInvDtl invDtl = ioStorInvDtl.toJavaObject(IOStorInvDtl.class);
|
|
|
|
|
ioStorInvDtlMapper.insert(invDtl);
|
|
|
|
|
|
|
|
|
|
JSONObject dis = new JSONObject();
|
|
|
|
|
dis.put("iostorinvdis_id", IdUtil.getStringId());
|
|
|
|
|
dis.put("iostorinv_id", iostorinv_id);
|
|
|
|
|
dis.put("iostorinvdtl_id", ioStorInvDtl.getString("iostorinvdtl_id"));
|
|
|
|
|
dis.put("iostorinvdtl_id", ObjectUtil.isEmpty(dtl_dto) ? ioStorInvDtl.getString("iostorinvdtl_id") : dtl_dto.getIostorinvdtl_id());
|
|
|
|
|
dis.put("seq_no", 1);
|
|
|
|
|
dis.put("material_id", row.get("material_id"));
|
|
|
|
|
dis.put("material_code", row.get("material_code"));
|
|
|
|
|
@@ -216,6 +232,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
ioStorInvDisMapper.insert(dis.toJavaObject(IOStorInvDis.class));
|
|
|
|
|
}
|
|
|
|
|
io_mst.put("total_qty", total_qty);
|
|
|
|
|
io_mst.put("detail_count", row_size);
|
|
|
|
|
ioStorInvMapper.insert(io_mst.toJavaObject(IOStorInv.class));
|
|
|
|
|
return iostorinv_id;
|
|
|
|
|
}
|
|
|
|
|
@@ -255,45 +272,45 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
|
|
|
|
|
JSONObject iostorinv_json = new JSONObject();
|
|
|
|
|
iostorinv_json.put("iostorinv_id",iostorinv_id);
|
|
|
|
|
iostorinv_json.put("stor_id",whereJson.get("stor_id"));
|
|
|
|
|
iostorinv_json.put("stor_code",whereJson.get("stor_code"));
|
|
|
|
|
iostorinv_json.put("stor_name",whereJson.get("stor_name"));
|
|
|
|
|
iostorinv_json.put("total_qty",whereJson.get("total_qty"));
|
|
|
|
|
iostorinv_json.put("detail_count",whereJson.get("detail_count"));
|
|
|
|
|
iostorinv_json.put("biz_date",whereJson.get("biz_date"));
|
|
|
|
|
iostorinv_json.put("bill_type",whereJson.get("bill_type"));
|
|
|
|
|
iostorinv_json.put("remark",whereJson.get("remark"));
|
|
|
|
|
iostorinv_json.put("update_optid",currentUserId);
|
|
|
|
|
iostorinv_json.put("update_optname",nickName);
|
|
|
|
|
iostorinv_json.put("update_time",now);
|
|
|
|
|
iostorinv_json.put("iostorinv_id", iostorinv_id);
|
|
|
|
|
iostorinv_json.put("stor_id", whereJson.get("stor_id"));
|
|
|
|
|
iostorinv_json.put("stor_code", whereJson.get("stor_code"));
|
|
|
|
|
iostorinv_json.put("stor_name", whereJson.get("stor_name"));
|
|
|
|
|
iostorinv_json.put("total_qty", whereJson.get("total_qty"));
|
|
|
|
|
iostorinv_json.put("detail_count", whereJson.get("detail_count"));
|
|
|
|
|
iostorinv_json.put("biz_date", whereJson.get("biz_date"));
|
|
|
|
|
iostorinv_json.put("bill_type", whereJson.get("bill_type"));
|
|
|
|
|
iostorinv_json.put("remark", whereJson.get("remark"));
|
|
|
|
|
iostorinv_json.put("update_optid", currentUserId);
|
|
|
|
|
iostorinv_json.put("update_optname", nickName);
|
|
|
|
|
iostorinv_json.put("update_time", now);
|
|
|
|
|
|
|
|
|
|
ioStorInvMapper.updateById(iostorinv_json.toJavaObject(IOStorInv.class));
|
|
|
|
|
|
|
|
|
|
//先删除该单据下的所有明细
|
|
|
|
|
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id,iostorinv_id));
|
|
|
|
|
ioStorInvDtlMapper.delete(new LambdaQueryWrapper<>(IOStorInvDtl.class).eq(IOStorInvDtl::getIostorinv_id, iostorinv_id));
|
|
|
|
|
|
|
|
|
|
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id,iostorinv_id));
|
|
|
|
|
ioStorInvDisMapper.delete(new LambdaQueryWrapper<>(IOStorInvDis.class).eq(IOStorInvDis::getIostorinv_id, iostorinv_id));
|
|
|
|
|
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableData");
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < rows.size(); i++) {
|
|
|
|
|
HashMap<String, Object> row = rows.get(i);
|
|
|
|
|
JSONObject ioStorInvDtl = new JSONObject();
|
|
|
|
|
ioStorInvDtl.putAll(row);
|
|
|
|
|
ioStorInvDtl.put("iostorinvdtl_id",IdUtil.getStringId());
|
|
|
|
|
ioStorInvDtl.put("iostorinv_id",iostorinv_id);
|
|
|
|
|
ioStorInvDtl.put("seq_no",(i + 1)+"");
|
|
|
|
|
ioStorInvDtl.put("material_id",row.get("material_id"));
|
|
|
|
|
ioStorInvDtl.put("Pcsn",row.get("pcsn"));
|
|
|
|
|
ioStorInvDtl.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_id",row.get("qty_unit_id"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_name",row.get("qty_unit_name"));
|
|
|
|
|
ioStorInvDtl.put("assign_qty",0);
|
|
|
|
|
ioStorInvDtl.put("plan_qty",row.get("plan_qty"));
|
|
|
|
|
ioStorInvDtl.put("unassign_qty",row.get("qty"));
|
|
|
|
|
ioStorInvDtl.put("iostorinvdtl_id", IdUtil.getStringId());
|
|
|
|
|
ioStorInvDtl.put("iostorinv_id", iostorinv_id);
|
|
|
|
|
ioStorInvDtl.put("seq_no", (i + 1) + "");
|
|
|
|
|
ioStorInvDtl.put("material_id", row.get("material_id"));
|
|
|
|
|
ioStorInvDtl.put("Pcsn", row.get("pcsn"));
|
|
|
|
|
ioStorInvDtl.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_id", row.get("qty_unit_id"));
|
|
|
|
|
ioStorInvDtl.put("qty_unit_name", row.get("qty_unit_name"));
|
|
|
|
|
ioStorInvDtl.put("assign_qty", 0);
|
|
|
|
|
ioStorInvDtl.put("plan_qty", row.get("plan_qty"));
|
|
|
|
|
ioStorInvDtl.put("unassign_qty", row.get("qty"));
|
|
|
|
|
|
|
|
|
|
//判断该载具编号是否已经存在库内
|
|
|
|
|
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code,row.get("storagevehicle_code")));
|
|
|
|
|
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<>(Structattr.class).eq(Structattr::getStoragevehicle_code, row.get("storagevehicle_code")));
|
|
|
|
|
if (ObjectUtil.isNotEmpty(structattr)) {
|
|
|
|
|
throw new BadRequestException("载具编码:" + row.get("storagevehicle_code") + "已存在库内,请对数据进行核实!");
|
|
|
|
|
}
|
|
|
|
|
@@ -326,18 +343,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void divStruct(JSONObject param) {
|
|
|
|
|
Assert.noNullElements(new Object[]{param.getString("stor_code"),param.getString("sect_code")},"参数异常");
|
|
|
|
|
ArrayList<HashMap> rows = (ArrayList<HashMap>) param.get("tableMater");
|
|
|
|
|
Assert.noNullElements(new Object[]{param.getString("stor_code"), param.getString("sect_code")}, "参数异常");
|
|
|
|
|
JSONObject mst = JSONObject.parseObject(JSON.toJSONString(param));
|
|
|
|
|
HashMap<String, String> map = rows.get(0);
|
|
|
|
|
String iostorinvId = map.get("iostorinv_id");
|
|
|
|
|
String storagevehicleCode = map.get("storagevehicle_code");
|
|
|
|
|
JSONObject map = param.getJSONObject("dis_row");
|
|
|
|
|
String iostorinvId = map.getString("iostorinv_id");
|
|
|
|
|
String storagevehicleCode = map.getString("storagevehicle_code");
|
|
|
|
|
//判断该分配明细是否已经分配货位
|
|
|
|
|
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id, iostorinvId)
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code, storagevehicleCode)
|
|
|
|
|
.isNull(IOStorInvDis::getStruct_code));
|
|
|
|
|
if (CollectionUtils.isEmpty(disList)){
|
|
|
|
|
if (CollectionUtils.isEmpty(disList)) {
|
|
|
|
|
throw new BadRequestException("当前明细已经分配过库位");
|
|
|
|
|
}
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
|
|
|
|
@@ -377,18 +393,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
struct_id = struct.getStruct_id();
|
|
|
|
|
struct_code = struct.getStruct_code();
|
|
|
|
|
struct_name = struct.getStruct_name();
|
|
|
|
|
} else
|
|
|
|
|
{
|
|
|
|
|
Structattr structattr = iStructattrService.findById(map.get("struct_id"));
|
|
|
|
|
} else {
|
|
|
|
|
Structattr structattr = iStructattrService.findById(map.getString("struct_id"));
|
|
|
|
|
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
|
|
|
|
|
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, map.get("storagevehicle_code"))
|
|
|
|
|
);
|
|
|
|
|
sect_id = map.get("sect_id");
|
|
|
|
|
sect_code = map.get("sect_code");
|
|
|
|
|
sect_name = map.get("sect_name");
|
|
|
|
|
struct_id = map.get("struct_id");
|
|
|
|
|
struct_code = map.get("struct_code");
|
|
|
|
|
struct_name = map.get("struct_name");
|
|
|
|
|
sect_id = map.getString("sect_id");
|
|
|
|
|
sect_code = map.getString("sect_code");
|
|
|
|
|
sect_name = map.getString("sect_name");
|
|
|
|
|
struct_id = map.getString("struct_id");
|
|
|
|
|
struct_code = map.getString("struct_code");
|
|
|
|
|
struct_name = map.getString("struct_name");
|
|
|
|
|
}
|
|
|
|
|
JSONObject dis_map = new JSONObject();
|
|
|
|
|
dis_map.put("sect_id", sect_id);
|
|
|
|
|
@@ -405,31 +420,31 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
lock_map.put("inv_code", ioStorInv.getBill_code());
|
|
|
|
|
lock_map.put("inv_type", ioStorInv.getBill_type());
|
|
|
|
|
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("入库锁"));
|
|
|
|
|
iStructattrService.updateStatusByCode("0",lock_map);
|
|
|
|
|
iStructattrService.updateStatusByCode("0", lock_map);
|
|
|
|
|
//更新组盘表状态
|
|
|
|
|
mdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
|
|
|
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
|
|
|
|
.eq(GroupPlate::getStoragevehicle_code, map.get("storagevehicle_code"))
|
|
|
|
|
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
|
|
|
|
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘")));
|
|
|
|
|
// 更新分配明细表
|
|
|
|
|
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::getIostorinv_id,iostorinvId)
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code,storagevehicleCode)
|
|
|
|
|
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::getIostorinv_id, iostorinvId)
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code, storagevehicleCode)
|
|
|
|
|
);
|
|
|
|
|
//维护单据明细表里分配数量
|
|
|
|
|
List<String> dtlCollect = disList.stream().map(IOStorInvDis::getIostorinvdtl_id).collect(Collectors.toList());
|
|
|
|
|
List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<IOStorInvDtl>().in(IOStorInvDtl::getIostorinvdtl_id, dtlCollect));
|
|
|
|
|
for (IOStorInvDtl dtl : dtls) {
|
|
|
|
|
int disQtySum = disList.stream().filter(dis -> dis.getIostorinvdtl_id().equals(dtl.getIostorinvdtl_id())).mapToInt(value -> value.getPlan_qty().intValue()).sum();
|
|
|
|
|
dtl.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
|
|
|
|
dtl.setAssign_qty(BigDecimal.valueOf(disQtySum));
|
|
|
|
|
dtl.setUnassign_qty(BigDecimal.valueOf(0));
|
|
|
|
|
dtl.setAssign_qty(dtl.getAssign_qty().add(BigDecimal.valueOf(disQtySum)));
|
|
|
|
|
dtl.setUnassign_qty(dtl.getPlan_qty().subtract(dtl.getAssign_qty()));
|
|
|
|
|
dtl.setBill_status(dtl.getUnassign_qty().compareTo(BigDecimal.valueOf(0)) > 0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("分配完"));
|
|
|
|
|
ioStorInvDtlMapper.updateById(dtl);
|
|
|
|
|
}
|
|
|
|
|
//根据单据标识判断分配明细是否都已经分配完成
|
|
|
|
|
@@ -449,14 +464,12 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void unDivStruct(Map whereJson) {
|
|
|
|
|
public void unDivStruct(JSONObject whereJson) {
|
|
|
|
|
|
|
|
|
|
String currentUserId = SecurityUtils.getCurrentUserId();
|
|
|
|
|
String nickName = SecurityUtils.getCurrentNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
|
|
|
|
|
ArrayList<HashMap> rows = (ArrayList<HashMap>) whereJson.get("tableMater");
|
|
|
|
|
HashMap<String, String> jo = rows.get(0);
|
|
|
|
|
JSONObject jo = whereJson.getJSONObject("dis_row");
|
|
|
|
|
|
|
|
|
|
//解锁原货位点位
|
|
|
|
|
JSONObject unlock_map = new JSONObject();
|
|
|
|
|
@@ -464,40 +477,51 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
unlock_map.put("inv_type", null);
|
|
|
|
|
unlock_map.put("inv_id", null);
|
|
|
|
|
unlock_map.put("inv_code", null);
|
|
|
|
|
iStructattrService.updateStatusByCode("2",unlock_map);
|
|
|
|
|
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::getIostorinv_id,jo.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code,jo.get("storagevehicle_code"))
|
|
|
|
|
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::getIostorinv_id, jo.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code, jo.get("storagevehicle_code"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
//维护单据明细表里 分配数量
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
|
|
jsonObject.put("iostorinvdtl_id",jo.get("iostorinvdtl_id"));
|
|
|
|
|
jsonObject.put("bill_status",IOSEnum.BILL_STATUS.code("生成"));
|
|
|
|
|
jsonObject.put("assign_qty","0");
|
|
|
|
|
jsonObject.put("unassign_qty",jo.get("plan_qty"));
|
|
|
|
|
ioStorInvDtlMapper.updateById(jsonObject.toJavaObject(IOStorInvDtl.class));
|
|
|
|
|
//更新组盘表状态
|
|
|
|
|
mdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
|
|
|
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("组盘"))
|
|
|
|
|
.eq(GroupPlate::getStoragevehicle_code, jo.get("storagevehicle_code"))
|
|
|
|
|
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
|
|
|
|
|
|
|
|
|
|
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>().eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code, jo.get("storagevehicle_code")));
|
|
|
|
|
//维护单据明细表里分配数量
|
|
|
|
|
List<String> dtlCollect = disList.stream().map(IOStorInvDis::getIostorinvdtl_id).collect(Collectors.toList());
|
|
|
|
|
List<IOStorInvDtl> dtls = ioStorInvDtlMapper.selectList(new LambdaQueryWrapper<IOStorInvDtl>().in(IOStorInvDtl::getIostorinvdtl_id, dtlCollect));
|
|
|
|
|
for (IOStorInvDtl dtl : dtls) {
|
|
|
|
|
int disQtySum = disList.stream().filter(dis -> dis.getIostorinvdtl_id().equals(dtl.getIostorinvdtl_id())).mapToInt(value -> value.getPlan_qty().intValue()).sum();
|
|
|
|
|
dtl.setAssign_qty(dtl.getAssign_qty().subtract(BigDecimal.valueOf(disQtySum)));
|
|
|
|
|
dtl.setUnassign_qty(dtl.getPlan_qty().subtract(dtl.getAssign_qty()));
|
|
|
|
|
dtl.setBill_status(dtl.getUnassign_qty().compareTo(dtl.getPlan_qty()) == 0 ? IOSEnum.BILL_STATUS.code("生成") : IOSEnum.BILL_STATUS.code("分配中"));
|
|
|
|
|
ioStorInvDtlMapper.updateById(dtl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据单据标识判断分配明细是否都已经分配完成
|
|
|
|
|
int disCount = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id,jo.get("iostorinv_id"))
|
|
|
|
|
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id, jo.get("iostorinv_id"))
|
|
|
|
|
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code, "")));
|
|
|
|
|
|
|
|
|
|
// 根据分配货位情况 更新主表单据状态
|
|
|
|
|
IOStorInv ios = new IOStorInv();
|
|
|
|
|
ios.setIostorinv_id(jo.get("iostorinv_id"));
|
|
|
|
|
ios.setIostorinv_id(jo.getString("iostorinv_id"));
|
|
|
|
|
ios.setUpdate_optid(currentUserId);
|
|
|
|
|
ios.setUpdate_optname(nickName);
|
|
|
|
|
ios.setUpdate_time(now);
|
|
|
|
|
ios.setBill_status(disCount>0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成"));
|
|
|
|
|
ios.setBill_status(disCount > 0 ? IOSEnum.BILL_STATUS.code("分配中") : IOSEnum.BILL_STATUS.code("生成"));
|
|
|
|
|
ioStorInvMapper.updateById(ios);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -510,10 +534,10 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
|
|
|
|
|
//判断是否已经分配好货位
|
|
|
|
|
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id,map.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code,map.get("storagevehicle_code"))
|
|
|
|
|
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code,"")));
|
|
|
|
|
if (CollectionUtils.isEmpty(ioStorInvDis)){
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code, map.get("storagevehicle_code"))
|
|
|
|
|
.and(wrapper -> wrapper.isNotNull(IOStorInvDis::getStruct_code).or().ne(IOStorInvDis::getStruct_code, "")));
|
|
|
|
|
if (CollectionUtils.isEmpty(ioStorInvDis)) {
|
|
|
|
|
throw new BadRequestException("该明细还没分配货位,请先分配货位");
|
|
|
|
|
}
|
|
|
|
|
//创建任务
|
|
|
|
|
@@ -535,14 +559,14 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
dis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("是"));
|
|
|
|
|
dis.setPoint_code(point_code);
|
|
|
|
|
//更新详情数据
|
|
|
|
|
ioStorInvDisMapper.update(dis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
|
|
|
|
.set(IOStorInvDis::getTask_id,task_id)
|
|
|
|
|
.set(IOStorInvDis::getIs_issued,BaseDataEnum.IS_YES_NOT.code("是"))
|
|
|
|
|
.set(IOStorInvDis::getPoint_code,point_code)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id,map.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code,map.get("storagevehicle_code"))
|
|
|
|
|
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成")));
|
|
|
|
|
ioStorInvDisMapper.update(dis, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
|
|
|
|
.set(IOStorInvDis::getTask_id, task_id)
|
|
|
|
|
.set(IOStorInvDis::getIs_issued, BaseDataEnum.IS_YES_NOT.code("是"))
|
|
|
|
|
.set(IOStorInvDis::getPoint_code, point_code)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id, map.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getStoragevehicle_code, map.get("storagevehicle_code"))
|
|
|
|
|
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -554,27 +578,27 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
|
|
|
|
|
IOStorInv ioStorInv = ioStorInvMapper.selectOne(new LambdaQueryWrapper<>(IOStorInv.class)
|
|
|
|
|
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInv::getIostorinv_id, whereJson.get("iostorinv_id"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(ioStorInv) && !IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())){
|
|
|
|
|
if (ObjectUtil.isNotEmpty(ioStorInv) && !IOSEnum.BILL_STATUS.code("分配完").equals(ioStorInv.getBill_status())) {
|
|
|
|
|
throw new BadRequestException("主表状态必须为分配完!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//解锁原货位点位
|
|
|
|
|
List<IOStorInvDis> storInvDisList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id,whereJson.get("iostorinv_id"))
|
|
|
|
|
.eq(IOStorInvDis::getIostorinv_id, whereJson.get("iostorinv_id"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for (IOStorInvDis ioStorInvDis: storInvDisList){
|
|
|
|
|
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())){
|
|
|
|
|
for (IOStorInvDis ioStorInvDis : storInvDisList) {
|
|
|
|
|
if (StrUtil.isNotBlank(ioStorInvDis.getStruct_code())) {
|
|
|
|
|
JSONObject finish_map = new JSONObject();
|
|
|
|
|
finish_map.put("struct_code",ioStorInvDis.getStruct_code());
|
|
|
|
|
finish_map.put("storagevehicle_code",ioStorInvDis.getStoragevehicle_code());
|
|
|
|
|
finish_map.put("struct_code", ioStorInvDis.getStruct_code());
|
|
|
|
|
finish_map.put("storagevehicle_code", ioStorInvDis.getStoragevehicle_code());
|
|
|
|
|
finish_map.put("inv_type", null);
|
|
|
|
|
finish_map.put("inv_id", null);
|
|
|
|
|
finish_map.put("inv_code", null);
|
|
|
|
|
iStructattrService.updateStatusByCode("1",finish_map);
|
|
|
|
|
iStructattrService.updateStatusByCode("1", finish_map);
|
|
|
|
|
|
|
|
|
|
//修改库存
|
|
|
|
|
List<JSONObject> updateIvtList = new ArrayList<>();
|
|
|
|
|
@@ -591,35 +615,35 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新详情数据
|
|
|
|
|
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInvDis::getReal_qty,ioStorInvDis.getPlan_qty())
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id())
|
|
|
|
|
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
|
|
|
|
ioStorInvDisMapper.update(ioStorInvDis, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInvDis::getReal_qty, ioStorInvDis.getPlan_qty())
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id, ioStorInvDis.getIostorinvdis_id())
|
|
|
|
|
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
ioStorInvDtlMapper.update(new IOStorInvDtl(),new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
|
|
|
|
.set(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInvDtl::getReal_qty,ioStorInvDis.getPlan_qty())
|
|
|
|
|
.eq(IOStorInvDtl::getIostorinvdtl_id,ioStorInvDis.getIostorinvdtl_id())
|
|
|
|
|
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
ioStorInvDtlMapper.update(new IOStorInvDtl(), new LambdaUpdateWrapper<>(IOStorInvDtl.class)
|
|
|
|
|
.set(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInvDtl::getReal_qty, ioStorInvDis.getPlan_qty())
|
|
|
|
|
.eq(IOStorInvDtl::getIostorinvdtl_id, ioStorInvDis.getIostorinvdtl_id())
|
|
|
|
|
.ne(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
);
|
|
|
|
|
//更新组盘记录表
|
|
|
|
|
mdPbGroupplateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
|
|
|
|
|
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
|
|
|
|
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
|
|
|
|
|
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
|
|
|
|
|
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
|
|
|
|
|
mdPbGroupplateService.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
|
|
|
|
|
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
|
|
|
|
|
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
|
|
|
|
|
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
|
|
|
|
|
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//更新主表状态
|
|
|
|
|
ioStorInvMapper.update(ioStorInv,new LambdaUpdateWrapper<>(IOStorInv.class)
|
|
|
|
|
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInv::getConfirm_optid,currentUserId)
|
|
|
|
|
.set(IOStorInv::getConfirm_optname,nickName)
|
|
|
|
|
.set(IOStorInv::getConfirm_time,now)
|
|
|
|
|
.eq(IOStorInv::getIostorinv_id,whereJson.get("iostorinv_id"))
|
|
|
|
|
ioStorInvMapper.update(ioStorInv, new LambdaUpdateWrapper<>(IOStorInv.class)
|
|
|
|
|
.set(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInv::getConfirm_optid, currentUserId)
|
|
|
|
|
.set(IOStorInv::getConfirm_optname, nickName)
|
|
|
|
|
.set(IOStorInv::getConfirm_time, now)
|
|
|
|
|
.eq(IOStorInv::getIostorinv_id, whereJson.get("iostorinv_id"))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
@@ -631,9 +655,9 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
String nickName = SecurityUtils.getCurrentNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.eq(IOStorInvDis::getTask_id,task.getTask_id())
|
|
|
|
|
.eq(IOStorInvDis::getTask_id, task.getTask_id())
|
|
|
|
|
);
|
|
|
|
|
if (CollectionUtils.isEmpty(ioStorInvDis)){
|
|
|
|
|
if (CollectionUtils.isEmpty(ioStorInvDis)) {
|
|
|
|
|
throw new BadRequestException("未找到任务对应的分配明细");
|
|
|
|
|
}
|
|
|
|
|
String iostorinvId = ioStorInvDis.get(0).getIostorinv_id();
|
|
|
|
|
@@ -646,7 +670,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
finish_map.put("inv_type", null);
|
|
|
|
|
finish_map.put("inv_id", null);
|
|
|
|
|
finish_map.put("inv_code", null);
|
|
|
|
|
iStructattrService.updateStatusByCode("1",finish_map);
|
|
|
|
|
iStructattrService.updateStatusByCode("1", finish_map);
|
|
|
|
|
//库存变动
|
|
|
|
|
StructattrChangeDto changeDto = StructattrChangeDto.builder()
|
|
|
|
|
.inv(iostorinvId)
|
|
|
|
|
@@ -656,11 +680,11 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
// 完成当前分配明细
|
|
|
|
|
Map<String, BigDecimal> dtlMap = new HashMap<>();
|
|
|
|
|
for (IOStorInvDis item : ioStorInvDis) {
|
|
|
|
|
ioStorInvDisMapper.update(item,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInvDis::getReal_qty,item.getPlan_qty())
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id,item.getIostorinvdis_id()));
|
|
|
|
|
dtlMap.put(item.getIostorinvdtl_id(),item.getPlan_qty());
|
|
|
|
|
ioStorInvDisMapper.update(item, new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
|
|
|
|
.set(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInvDis::getReal_qty, item.getPlan_qty())
|
|
|
|
|
.eq(IOStorInvDis::getIostorinvdis_id, item.getIostorinvdis_id()));
|
|
|
|
|
dtlMap.put(item.getIostorinvdtl_id(), item.getPlan_qty());
|
|
|
|
|
}
|
|
|
|
|
//更新明细
|
|
|
|
|
for (String dtl_id : dtlMap.keySet()) {
|
|
|
|
|
@@ -673,17 +697,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
// 查看明细是否全部完成
|
|
|
|
|
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
|
|
|
|
.eq(IOStorInvDtl::getIostorinv_id, iostorinvId)
|
|
|
|
|
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
.ne(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
);
|
|
|
|
|
// 如果明细全部完成则更新主表状态
|
|
|
|
|
if (countDtl == 0){
|
|
|
|
|
if (countDtl == 0) {
|
|
|
|
|
//更新主表状态
|
|
|
|
|
ioStorInvMapper.update(new IOStorInv(),new LambdaUpdateWrapper<>(IOStorInv.class)
|
|
|
|
|
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInv::getConfirm_optid,currentUserId)
|
|
|
|
|
.set(IOStorInv::getConfirm_optname,nickName)
|
|
|
|
|
.set(IOStorInv::getConfirm_time,now)
|
|
|
|
|
.eq(IOStorInv::getIostorinv_id,iostorinvId)
|
|
|
|
|
ioStorInvMapper.update(new IOStorInv(), new LambdaUpdateWrapper<>(IOStorInv.class)
|
|
|
|
|
.set(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
|
|
|
|
|
.set(IOStorInv::getConfirm_optid, currentUserId)
|
|
|
|
|
.set(IOStorInv::getConfirm_optname, nickName)
|
|
|
|
|
.set(IOStorInv::getConfirm_time, now)
|
|
|
|
|
.eq(IOStorInv::getIostorinv_id, iostorinvId)
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -702,17 +726,17 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
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,IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
|
|
|
.and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code,""))
|
|
|
|
|
.eq(Structattr::getSect_id, sect_id)
|
|
|
|
|
.eq(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("未锁定"))
|
|
|
|
|
.and(wrapper -> wrapper.isNull(Structattr::getStoragevehicle_code).or().eq(Structattr::getStoragevehicle_code, ""))
|
|
|
|
|
);
|
|
|
|
|
if (ObjectUtil.isEmpty(structattrList)){
|
|
|
|
|
if (ObjectUtil.isEmpty(structattrList)) {
|
|
|
|
|
throw new BadRequestException("该库区没有仓位");
|
|
|
|
|
}
|
|
|
|
|
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = mdPbStoragevehicleinfoMapper.selectOne(new LambdaQueryWrapper<>(MdPbStoragevehicleinfo.class)
|
|
|
|
|
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code,storagevehicle_code)
|
|
|
|
|
.eq(MdPbStoragevehicleinfo::getStoragevehicle_code, storagevehicle_code)
|
|
|
|
|
);
|
|
|
|
|
if (ObjectUtil.isEmpty(mdPbStoragevehicleinfo)){
|
|
|
|
|
if (ObjectUtil.isEmpty(mdPbStoragevehicleinfo)) {
|
|
|
|
|
throw new BadRequestException("没有该载具号信息");
|
|
|
|
|
}
|
|
|
|
|
// 过滤掉不满足载具长宽高的仓位
|
|
|
|
|
@@ -722,7 +746,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
|
|
|
|
|
st.getZdepth() >= 0
|
|
|
|
|
).findAny().get();
|
|
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(structattr)){
|
|
|
|
|
if (ObjectUtil.isEmpty(structattr)) {
|
|
|
|
|
throw new BadRequestException("未找到满足的仓位");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|