opt:优化出库逻辑增加平库判断
This commit is contained in:
@@ -96,7 +96,6 @@ public class BsrealStorattrServiceImpl extends ServiceImpl<BsrealStorattrMapper,
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
//TODO
|
||||
dto.setSyscompanyid(9L);
|
||||
dto.setSysdeptid(9L);
|
||||
dto.setSysownerid(9L);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.bigscreen_manage.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import org.nl.common.annotation.Mock;
|
||||
import org.nl.wms.bigscreen_manage.service.DisScreenService;
|
||||
import org.nl.wms.bigscreen_manage.service.dto.DistributionModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.nl.wms.bigscreen_manage.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.nl.common.annotation.Mock;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.bigscreen_manage.service.DisScreenService;
|
||||
import org.nl.wms.bigscreen_manage.service.dto.DistributionModel;
|
||||
@@ -14,6 +15,7 @@ public class DisScreenServiceImpl implements DisScreenService {
|
||||
private ConcurrentHashMap<String,DistributionModel> modelMap = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
@Mock
|
||||
public DistributionModel getData(String curSect) {
|
||||
return modelMap.get(curSect);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
unitCode,
|
||||
unit,
|
||||
trackNo
|
||||
FROM V_UC_CGRK06
|
||||
FROM v_uc_cgrk06
|
||||
WHERE billid = #{bill_id}
|
||||
</select>
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
modifyDate,
|
||||
status,
|
||||
red
|
||||
FROM V_UC_CGRK06
|
||||
FROM v_uc_cgrk06
|
||||
WHERE billid = #{bill_id}
|
||||
GROUP BY billid
|
||||
</select>
|
||||
|
||||
@@ -159,7 +159,9 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
final List<IOStorInvDis> invDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
|
||||
.eq(IOStorInvDis::getSect_code, sectCode)
|
||||
.eq(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("生成"))
|
||||
.eq(IOStorInvDis::getHand_type, Boolean.getBoolean(IOSEnum.HAND_TYPE.code("手动搬运"))));
|
||||
.isNull(IOStorInvDis::getTask_id)
|
||||
);
|
||||
// .eq(IOStorInvDis::getHand_type, Boolean.getBoolean(IOSEnum.HAND_TYPE.code("手动搬运")))
|
||||
final ArrayList<OutBoundDis> result = new ArrayList<>();
|
||||
for (IOStorInvDis source : invDis) {
|
||||
OutBoundDis target = new OutBoundDis();
|
||||
@@ -244,7 +246,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
//主单
|
||||
final IOStorInv ioStorInv = new IOStorInv();
|
||||
ioStorInv.setIostorinv_id(IdUtil.getStringId());
|
||||
ioStorInv.setBill_code(CodeUtil.getNewCode("IN_STORE_CODE"));
|
||||
ioStorInv.setBill_code(CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||
ioStorInv.setIo_type(IOSEnum.IO_TYPE.code("出库"));
|
||||
ioStorInv.setBill_type(IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
ioStorInv.setBiz_date(DateUtil.today());
|
||||
@@ -263,6 +265,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
ioStorInvMapper.insert(ioStorInv);
|
||||
//明细
|
||||
int seq = 1;
|
||||
//TODO:需要校验库存够不够
|
||||
for (String materialCode : finalOutMaterials.keySet()) {
|
||||
BigDecimal qty = param.getOutMaterials().get(materialCode);
|
||||
final IOStorInvDtl ioStorInvDtl = new IOStorInvDtl();
|
||||
@@ -599,6 +602,10 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
|
||||
@Override
|
||||
public void outDisFinish(OutBoundDis outBoundDis) {
|
||||
final IOStorInvDis ioStorInvDis = ioStorInvDisMapper.selectById(outBoundDis.getIostorinvdisId());
|
||||
if (ioStorInvDis==null){
|
||||
throw new BadRequestException("出库确认异常,当前出库明细在系统中不存在");
|
||||
}
|
||||
iOutBillService.disFinish(Arrays.asList(ioStorInvDis));
|
||||
//平库出库的话需要调拨到目标参考
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class PdaIosOutController {
|
||||
|
||||
@PostMapping("/assignOutDis")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> assignOutDis(OutBoundDis outBoundDis) {
|
||||
public ResponseEntity<Object> assignOutDis(@RequestBody OutBoundDis outBoundDis) {
|
||||
pdaIosOutService.outDisFinish(outBoundDis);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package org.nl.wms.pm_manage.demand.listenerHandler;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
|
||||
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
|
||||
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
|
||||
import org.nl.wms.pm_manage.listener.core.BaseFormListenerHandler;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -13,12 +19,25 @@ import org.springframework.stereotype.Component;
|
||||
public class DemandFormListenerHandler extends BaseFormListenerHandler<DemandListenerParams> {
|
||||
@Autowired
|
||||
IPmDemandService iPmDemandService;
|
||||
@Autowired
|
||||
IPmStockReturnService iPmStockReturnService;
|
||||
@Override
|
||||
public void onApplicationEvent(DemandListenerParams params) {
|
||||
iPmDemandService.update(new LambdaUpdateWrapper<PmDemand>()
|
||||
.set(PmDemand::getAssign_qty,params.getQty())
|
||||
.set(PmDemand::getStatus, DemandStatus.DORETURN.getValue())
|
||||
.set(PmDemand::getStatus, DemandStatus.FINISH.getValue())
|
||||
.eq(PmDemand::getId,params.getBillCode())
|
||||
);
|
||||
PmDemand one = iPmDemandService.getOne(new LambdaQueryWrapper<PmDemand>()
|
||||
.eq(PmDemand::getId, params.getBillCode()));
|
||||
if (one!=null){
|
||||
final PmStockReturn stockReturn = new PmStockReturn();
|
||||
stockReturn.setCreate_time(DateUtil.now());
|
||||
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("调拨出库"));
|
||||
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode());
|
||||
stockReturn.setRequest_data(JSON.toJSONString(one));
|
||||
iPmStockReturnService.save(stockReturn);
|
||||
}
|
||||
//需求单昨晚,执行调拨流程
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public enum DemandStatus {
|
||||
RUN("20","执行"),
|
||||
DORETURN("50","待回传"),
|
||||
RETURN_FAIL("70","回传失败"),
|
||||
FINISH("80","回传完成"),
|
||||
FINISH("80","完成"),
|
||||
CANCEL("90","取消"),
|
||||
;
|
||||
private String value;
|
||||
|
||||
@@ -92,6 +92,11 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
|
||||
@Override
|
||||
public void batchCreate(List<PmDemandParam> param) {
|
||||
final List<String> collect = param.stream().map(PmDemandParam::getId).collect(Collectors.toList());
|
||||
final List<PmDemand> pmDemands = this.listByIds(collect);
|
||||
if (!CollectionUtils.isEmpty(pmDemands)){
|
||||
throw new BadRequestException("MES推送需求单失败,需求单已存在");
|
||||
}
|
||||
for (PmDemandParam pmDemandParam : param) {
|
||||
this.create(pmDemandParam);
|
||||
}
|
||||
@@ -214,7 +219,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
JSONObject billParam = new JSONObject();
|
||||
billParam.put("stor_code", inventoryDis.getString("horseCode"));
|
||||
billParam.put("biz_date", DateUtil.today());
|
||||
billParam.put("bill_type", IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
billParam.put("bill_type", IOSEnum.BILL_TYPE.code("调拨出库"));
|
||||
billParam.put("remark", "需求单下推生成");
|
||||
|
||||
List<JSONObject> tableData = new ArrayList<>();
|
||||
@@ -238,6 +243,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
||||
detailRow.put("source_bill_type", "pm_demand");
|
||||
detailRow.put("source_billdtl_id", demand.getId());
|
||||
detailRow.put("remark", "关联工单:" + demand.getWorkOrder());
|
||||
detailRow.put("load_port", demand.getTargetArea());
|
||||
tableData.add(detailRow);
|
||||
}
|
||||
billParam.put("tableData", tableData);
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum IOSEnum {
|
||||
BILL_STATUS(MapOf.of("生成","10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||
|
||||
// 入库业务类型
|
||||
BILL_TYPE(MapOf.of("生产入库","0001", "采购入库", "0005", "手工入库", "0009","销售出库","1001","生产出库","1005", "手工出库", "1009")),
|
||||
BILL_TYPE(MapOf.of("生产入库","0001", "采购入库", "0005", "手工入库", "0009","销售出库","1001","生产出库","1005","调拨出库","1004", "手工出库", "1009")),
|
||||
|
||||
//入库分配明细状态
|
||||
INBILL_DIS_STATUS(MapOf.of("未生成", "00", "生成", "01", "执行中", "02", "完成", "99")),
|
||||
|
||||
@@ -85,6 +85,10 @@ public class IOStorInvDtl implements Serializable {
|
||||
* 来源单编号
|
||||
*/
|
||||
private String source_bill_code;
|
||||
/**
|
||||
* 来源单指定上料口
|
||||
*/
|
||||
private String source_load_port;
|
||||
|
||||
/**
|
||||
* 来源单表名
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
qty_unit_name,
|
||||
source_bill_code,
|
||||
source_bill_type,
|
||||
source_load_port,
|
||||
source_billdtl_id,
|
||||
plan_qty,
|
||||
remark,
|
||||
@@ -33,6 +34,7 @@
|
||||
#{item.qty_unit_name},
|
||||
#{item.source_bill_code},
|
||||
#{item.source_bill_type},
|
||||
#{item.source_load_port},
|
||||
#{item.source_billdtl_id},
|
||||
#{item.plan_qty},
|
||||
#{item.remark},
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.nl.wms.basedata_manage.service.dto.*;
|
||||
import org.nl.wms.pm_manage.demand.listenerHandler.DemandListenerParams;
|
||||
import org.nl.wms.pm_manage.listener.PmManageEvent;
|
||||
import org.nl.wms.sch_manage.enums.TaskStatus;
|
||||
import org.nl.wms.sch_manage.service.ISchBasePointService;
|
||||
import org.nl.wms.sch_manage.service.ISchBaseTaskService;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBasePoint;
|
||||
import org.nl.wms.sch_manage.service.dao.SchBaseTask;
|
||||
@@ -41,6 +42,7 @@ import org.nl.wms.warehouse_manage.enums.IOSConstant;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.AddInvParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutDisParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutDisReverseParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutFinishParam;
|
||||
@@ -111,6 +113,8 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
@Autowired
|
||||
private MdPbStoragevehicleextMapper mdPbStoragevehicleextMapper;
|
||||
@Autowired
|
||||
private ISchBasePointService iSchBasePointService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -327,6 +331,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
detail.setSource_bill_type(row.getString("source_bill_type"));
|
||||
detail.setSource_billdtl_id(row.getString("source_billdtl_id"));
|
||||
detail.setPlan_qty(planQty);
|
||||
detail.setSource_load_port(row.getString("load_port"));
|
||||
detail.setRemark(row.getString("remark"));
|
||||
detail.setAssign_qty(BigDecimal.ZERO);
|
||||
detail.setUnassign_qty(planQty);
|
||||
@@ -373,7 +378,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
if (ObjectUtil.isEmpty(dtls)) {
|
||||
throw new BadRequestException("当前订单无可分配出库明细");
|
||||
}
|
||||
|
||||
List<Sectattr> collect = iSectattrService.getSectType()
|
||||
.getOrDefault(IOSEnum.ST_SECT_TYPE.code("平库"),Collections.emptyList());
|
||||
final List<String> flatWarehouse = collect.stream().map(Sectattr::getSect_code).collect(Collectors.toList());
|
||||
for (int i = 0; i < dtls.size(); i++) {
|
||||
IOStorInvDtlDto dtl = dtls.get(i);
|
||||
BigDecimal unassign_qty = dtl.getUnassign_qty();
|
||||
@@ -417,16 +424,24 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInvDis.setQty_unit_id(outAllocation.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(outAllocation.getQty_unit_name());
|
||||
ioStorInvDis.setWork_status(IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
ioStorInvDis.setPlan_qty(outAllocation.getFrozen_qty());
|
||||
//锁定货位
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", outAllocation.getStruct_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());
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
//五期特殊处理:平库则取source_load_port,需求单的
|
||||
Boolean flat = flatWarehouse.contains(outAllocation.getStruct_code());
|
||||
if (flat){
|
||||
ioStorInvDis.setPoint_code(dtl.getSource_load_port());
|
||||
}else {
|
||||
JSONObject lock_map = new JSONObject();
|
||||
lock_map.put("struct_code", outAllocation.getStruct_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());
|
||||
lock_map.put("lock_type", IOSEnum.LOCK_TYPE.code("出库锁"));
|
||||
iStructattrService.updateStatusByCode("0",lock_map);
|
||||
}
|
||||
ioStorInvDis.setWork_status(flat?
|
||||
IOSEnum.INBILL_DIS_STATUS.code("生成")
|
||||
:IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
//更新组盘表冻结数量状态
|
||||
iMdPbGroupPlateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getFrozen_qty, outAllocation.getFrozen_qty())
|
||||
@@ -753,6 +768,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
BigDecimal allocation_canuse_qty = BigDecimal.ZERO;
|
||||
List<OutDisParam> outDisParams = new ArrayList<>();
|
||||
List<IOStorInvDis> invDis = new ArrayList<>();
|
||||
List<String> structs = new ArrayList<>();
|
||||
for (int i = 0; i < rows.size(); i++){
|
||||
JSONObject ivt = rows.getJSONObject(i);
|
||||
//库存可用
|
||||
@@ -781,6 +797,12 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
ioStorInvDis.setIs_issued(BaseDataEnum.IS_YES_NOT.code("否"));
|
||||
ioStorInvDis.setQty_unit_id(dtl.getQty_unit_id());
|
||||
ioStorInvDis.setQty_unit_name(dtl.getQty_unit_name());
|
||||
//五期特殊处理:平库则取source_load_port,需求单的
|
||||
if (flat){
|
||||
ioStorInvDis.setPoint_code(dtl.getSource_load_port());
|
||||
}else {
|
||||
structs.add(ivt.getString("struct_code"));
|
||||
}
|
||||
ioStorInvDis.setWork_status(flat?
|
||||
IOSEnum.INBILL_DIS_STATUS.code("生成")
|
||||
:IOSEnum.INBILL_DIS_STATUS.code("未生成"));
|
||||
@@ -797,15 +819,15 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
.pcsn(ivt.getString("pcsn"))
|
||||
.frozenQty(change_qty).build());
|
||||
}
|
||||
//锁定货位.生成分配明细,更新库存 加冻结减可用,锁定货位
|
||||
final Set<String> structs = invDis.stream().map(IOStorInvDis::getStruct_code).collect(Collectors.toSet());
|
||||
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getInv_id,ioStorInv.getIostorinv_id())
|
||||
.set(Structattr::getInv_code,ioStorInv.getBill_code())
|
||||
.set(Structattr::getInv_type,ioStorInv.getBill_type())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("出库锁"))
|
||||
.in(Structattr::getStruct_code,structs)
|
||||
);
|
||||
//锁定货位,平库不锁定
|
||||
if (!CollectionUtils.isEmpty(structs)){
|
||||
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getInv_id,ioStorInv.getIostorinv_id())
|
||||
.set(Structattr::getInv_code,ioStorInv.getBill_code())
|
||||
.set(Structattr::getInv_type,ioStorInv.getBill_type())
|
||||
.set(Structattr::getLock_type, IOSEnum.LOCK_TYPE.code("出库锁"))
|
||||
.in(Structattr::getStruct_code,structs));
|
||||
}
|
||||
iStInventoryService.changeInventory(InventoryChangeType.OUT_DIS, outDisParams);
|
||||
ioStorInvDisMapper.batchSave(invDis);
|
||||
//更新详情
|
||||
@@ -1093,61 +1115,93 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void taskFinish(SchBaseTask task) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
List<IOStorInvDis> disList = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getTask_id, task.getTask_id())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(disList)) {
|
||||
throw new BadRequestException("未找到任务对应的分配明细");
|
||||
}
|
||||
|
||||
//完成任务,解锁仓位绑定载具号
|
||||
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
|
||||
.set(Structattr::getInv_id,null)
|
||||
.set(Structattr::getInv_code,null)
|
||||
.set(Structattr::getInv_type,null)
|
||||
.set(Structattr::getStoragevehicle_code,null)
|
||||
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
|
||||
.eq(Structattr::getStruct_code,task.getPoint_code1()));
|
||||
disFinish(disList);
|
||||
}
|
||||
@Override
|
||||
@Transactional
|
||||
//TODO:调拨还是直接出库
|
||||
public void disFinish(List<IOStorInvDis> disList) {
|
||||
// 完成当前任务对应的所有分配明细
|
||||
List<OutFinishParam> outFinsParams = new ArrayList<>();
|
||||
for (IOStorInvDis ioStorInvDis : disList) {
|
||||
ioStorInvDisMapper.update(ioStorInvDis,new LambdaUpdateWrapper<>(IOStorInvDis.class)
|
||||
.set(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
.eq(IOStorInvDis::getIostorinvdis_id,ioStorInvDis.getIostorinvdis_id()));
|
||||
outFinsParams.add(OutFinishParam.builder()
|
||||
.storagevehicleCode(ioStorInvDis.getStoragevehicle_code())
|
||||
.changeQty(ioStorInvDis.getPlan_qty())
|
||||
.pcsn(ioStorInvDis.getPcsn())
|
||||
.materialCode(ioStorInvDis.getMaterial_code())
|
||||
.build());
|
||||
|
||||
}
|
||||
IOStorInvDis item = disList.get(0);
|
||||
//解锁库位
|
||||
JSONObject finish_map = new JSONObject();
|
||||
finish_map.put("struct_code", item.getStruct_code());
|
||||
finish_map.put("storagevehicle_code",null);
|
||||
finish_map.put("inv_type", null);
|
||||
finish_map.put("inv_id", null);
|
||||
finish_map.put("inv_code", null);
|
||||
iStructattrService.updateStatusByCode("1",finish_map);
|
||||
//库存变动:根据冻结数更新物料库存
|
||||
StructattrChangeDto changeDto = StructattrChangeDto.builder()
|
||||
.inv(item.getIostorinv_id())
|
||||
.storagevehicleCode(item.getStoragevehicle_code())
|
||||
.structCode(item.getStruct_code()).taskType(item.getStruct_code())
|
||||
.inBound(false).build();
|
||||
iStructattrService.changeStruct(changeDto);
|
||||
iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS, outFinsParams);
|
||||
IOStorInvDis item = disList.get(0);
|
||||
// 查询该明细下是否还有未完成的分配明细
|
||||
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
|
||||
.eq(IOStorInvDis::getIostorinvdtl_id,item.getIostorinvdtl_id())
|
||||
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
|
||||
);
|
||||
//如果是调拨出库直接库存变更,如果是AGV的则需要走个入库
|
||||
// 明细
|
||||
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(item.getIostorinvdtl_id());
|
||||
if (ObjectUtil.isEmpty(ioStorInvDtl)){
|
||||
throw new BadRequestException("未找到明细");
|
||||
}
|
||||
final IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDtl.getIostorinv_id());
|
||||
if (ioStorInv.getBill_type().equals(IOSEnum.BILL_TYPE.code("调拨出库"))){
|
||||
List<AddInvParam> addInvParams = new ArrayList<>();
|
||||
for (IOStorInvDis invDis : disList) {
|
||||
if (invDis.getTask_id() == null && !StringUtils.isEmpty(invDis.getPoint_code())){
|
||||
final SchBasePoint one = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>()
|
||||
.eq(SchBasePoint::getPoint_code, invDis.getPoint_code()));
|
||||
if (one ==null){
|
||||
throw new BadRequestException("明细完成失败,当前点位未配置所属库区");
|
||||
}
|
||||
String regionCode = one.getRegion_code();
|
||||
//更新库存,查询托盘
|
||||
final Structattr targetAttr = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getSect_code, regionCode));
|
||||
if (targetAttr ==null ||StringUtils.isEmpty(targetAttr.getStoragevehicle_code())){
|
||||
throw new BadRequestException("明细完成失败,当前调拨目标区域不存在"+invDis.getPoint_code());
|
||||
}
|
||||
AddInvParam addParam = new AddInvParam();
|
||||
addParam.setPcsn(invDis.getPcsn());
|
||||
addParam.setMaterialCode(invDis.getMaterial_code());
|
||||
addParam.setStoragevehicleCode(targetAttr.getStoragevehicle_code());
|
||||
addParam.setUnitName(invDis.getQty_unit_name());
|
||||
addParam.setUnitId(invDis.getQty_unit_id());
|
||||
addParam.setQty(invDis.getPlan_qty());
|
||||
addInvParams.add(addParam);
|
||||
}
|
||||
}
|
||||
iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
|
||||
//生成调拨入库单据
|
||||
}
|
||||
// 如果分配明细全部完成则更新明细表状态
|
||||
if (countDis == 0){
|
||||
// 更新明细表状态
|
||||
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
ioStorInvDtlMapper.updateById(ioStorInvDtl);
|
||||
eventPublisher.publishEvent(new PmManageEvent(ioStorInvDtl.getSource_bill_type()
|
||||
//TODO:这里不区分,后续在smart中区分,需求单出库才走这个
|
||||
eventPublisher.publishEvent(
|
||||
new PmManageEvent(ioStorInvDtl.getSource_bill_type()
|
||||
,new DemandListenerParams(ioStorInvDtl.getSource_bill_code(),ioStorInvDtl.getAssign_qty(),ioStorInvDtl.getMaterial_code())));
|
||||
|
||||
// 查看明细是否全部完成
|
||||
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
|
||||
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
|
||||
@@ -1165,6 +1219,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ public class AddInvParam implements InventoryParam {
|
||||
private String extCode;
|
||||
private String extType;
|
||||
private String unitName;
|
||||
private String unitId;
|
||||
private String remark;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.utils.IdUtil;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.wms.pm_manage.SourceBillTypeEnum;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.InventoryParam;
|
||||
@@ -25,6 +27,8 @@ import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS;
|
||||
|
||||
/**
|
||||
* 库存查询服务
|
||||
*/
|
||||
@@ -59,13 +63,30 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
}
|
||||
GroupPlate groupPlate = iMdPbGroupplateService.getOne(query);
|
||||
if (groupPlate == null){
|
||||
throw new BadRequestException("库存增加失败,当前库存不存在");
|
||||
GroupPlate groupDao = GroupPlate.builder()
|
||||
.group_id(IdUtil.getStringId())
|
||||
.material_code(invParam.getMaterialCode())
|
||||
.storagevehicle_code(invParam.getStoragevehicleCode())
|
||||
.pcsn(invParam.getPcsn())
|
||||
//TODO:先给默认个
|
||||
.qty_unit_id(invParam.getUnitId())
|
||||
.qty_unit_name(invParam.getUnitName())
|
||||
.qty(invParam.getQty())
|
||||
.status(GROUP_PLATE_STATUS.code("入库"))
|
||||
.ext_code(invParam.getExtCode())
|
||||
.ext_type(invParam.getExtType())
|
||||
.create_id(SecurityUtils.getCurrentUserId())
|
||||
.create_name(SecurityUtils.getCurrentNickName())
|
||||
.create_time(DateUtil.now())
|
||||
.build();
|
||||
iMdPbGroupplateService.save(groupDao);
|
||||
}else {
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getQty,groupPlate.getQty().add(invParam.getQty()))
|
||||
.set(GroupPlate::getRemark,invParam.getRemark())
|
||||
.set(GroupPlate::getUpdate_time,DateUtil.now())
|
||||
.eq(GroupPlate::getGroup_id,groupPlate.getGroup_id()));
|
||||
}
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getQty,groupPlate.getQty().add(invParam.getQty()))
|
||||
.set(GroupPlate::getRemark,invParam.getRemark())
|
||||
.set(GroupPlate::getUpdate_time,DateUtil.now())
|
||||
.eq(GroupPlate::getGroup_id,groupPlate.getGroup_id()));
|
||||
}
|
||||
break;
|
||||
case "SubInvParam":
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
server:
|
||||
port: 8011
|
||||
#配置数据源
|
||||
#rabbitmq配置
|
||||
spring:
|
||||
rabbitmq:
|
||||
addresses: 127.0.0.1
|
||||
username: guest
|
||||
password: guest
|
||||
virtual-host: dev
|
||||
publisher-confirm-type: correlated
|
||||
listener:
|
||||
simple:
|
||||
acknowledge-mode: auto
|
||||
retry:
|
||||
enabled: true
|
||||
max-attempts: 2
|
||||
initial-interval: 2000
|
||||
multiplier: 1.0
|
||||
max-interval: 5000
|
||||
default-requeue-rejected: false
|
||||
#配置数据源
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
allow-circular-references: true
|
||||
@@ -34,9 +51,9 @@ spring:
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:wms_nlwq}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:wms_standardv2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:wms_standardv2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
password: ${DB_PWD:5XXX/3GEgdUnRZd4cbVnDL6BA6P9YToc}
|
||||
druid:
|
||||
# 基础连接池配置
|
||||
initial-size: 15
|
||||
@@ -57,13 +74,13 @@ spring:
|
||||
|
||||
# 监控统计(连接池层面的监控)
|
||||
filters:
|
||||
DruidFilter,stat # 修正:stat是监控统计,wall是SQL防火墙
|
||||
DruidFilter,stat # 修正:stat是监控统计,wall是SQL防火墙
|
||||
log-abandoned: false
|
||||
eas:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${EAS_DB_HOST:localhost}:${EAS_DB_PORT:3306}/${EAS_DB_NAME:eas_db}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:wms_standardv2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${EAS_DB_USER:root}
|
||||
password: ${EAS_DB_PWD:123456}
|
||||
password: ${DB_PWD:5XXX/3GEgdUnRZd4cbVnDL6BA6P9YToc}
|
||||
druid:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
@@ -157,4 +174,10 @@ sa-token:
|
||||
is-print: false
|
||||
lucene:
|
||||
index:
|
||||
path: D:\lms\lucene\index
|
||||
path: D:\lms\lucene\index
|
||||
eas:
|
||||
webservice:
|
||||
wsdl: http://192.168.100.100:8080/ormrpc/services/WSNLWQFacade?wsdl
|
||||
namespace: http://ws.eas.kingdee.com/
|
||||
inbound:
|
||||
liku-codes: LK01
|
||||
|
||||
@@ -52,3 +52,6 @@ CREATE TABLE `sys_mock_config` (
|
||||
|
||||
ALTER TABLE `st_ivt_iostorinvdis`
|
||||
ADD COLUMN `hand_type` tinyint(1) NULL DEFAULT 0 COMMENT '出库类型:0自动搬运1手动搬运' AFTER `point_code`;
|
||||
ALTER TABLE `st_ivt_iostorinvdtl`
|
||||
DROP COLUMN `source_load_port`,
|
||||
ADD COLUMN `source_load_port` varchar(255) NULL COMMENT '来源单指定上料口' AFTER `material_code`;
|
||||
|
||||
Reference in New Issue
Block a user