opt:优化回传

This commit is contained in:
zhangzq
2026-09-30 16:32:42 +08:00
parent 2930ac5db0
commit 96ff7a58fb
18 changed files with 164 additions and 30 deletions

View File

@@ -0,0 +1,30 @@
package org.nl.wms.basedata_manage.service.dto;
import lombok.Data;
/**
* 外部系统拉取物料信息
*/
@Data
public class MaterialInfoSyncQuery {
/**
* 上次同步到的物料标识。有值时查询该标识之后的数据;为空时全表查询。
*/
private String lastMaterialId;
/**
* 物料编码。有值时按编码查询具体物料。
*/
private String materialCode;
/**
* 页码,从 0 开始
*/
private Integer page;
/**
* 每页条数
*/
private Integer size;
}

View File

@@ -91,14 +91,14 @@ public class InboundPdaController {
}
@PostMapping("/usualInbound")
@Log("平库入库")
@Log("EAS单据平库入库")
@SaIgnore
public ResponseEntity usualInbound(@RequestBody UsualInboundDto usualInboundDto) {
inboundPdaService.usualInbound(usualInboundDto);
return ResponseData.build();
}
@PostMapping("/returnInbound")
@Log("退料入库")
@Log("MES生产退料入库")
@SaIgnore
public ResponseEntity usualInbound(@RequestBody ReturnInboundDto returnInboundDto) {
inboundPdaService.returnInbound(returnInboundDto);

View File

@@ -10,5 +10,7 @@ public class GroupPlateInboundDto {
private String vehicle_code;
private String sect_code;
private String point_code;
private String sourceBillId;
private String sourceBillTpye;
private List<GroupPlate> groupPlateList;
}

View File

@@ -58,8 +58,7 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS;
import static org.nl.wms.warehouse_manage.enums.IOSEnum.LOCK_TYPE;
import static org.nl.wms.warehouse_manage.enums.IOSEnum.*;
@Slf4j
@Service
@@ -246,7 +245,13 @@ public class InboundPdaServiceImpl implements InboundPdaService {
@Override
public void usualInbound(UsualInboundDto usualInboundDto) {
log.info("PDA提交平库入库 参数:{}", JSON.toJSONString(usualInboundDto));
final Purchasemst purchasemst = purchaseService.getById(usualInboundDto.getBill_id());
if (purchasemst==null){
throw new BadRequestException("入库失败关联的EAS单据"+usualInboundDto.getBill_id()+"不存在");
}
if (StringUtils.isEmpty(purchasemst.getOrder_type())||StringUtils.isEmpty(purchasemst.getOrder_no())){
throw new BadRequestException("入库失败关联的EAS单据"+usualInboundDto.getBill_id()+"单据编号跟类型不存在");
}
// 查询库区
Sectattr sectDao = iSectattrService.findByCode(usualInboundDto.getSect_code());
//获取库位
@@ -285,8 +290,8 @@ public class InboundPdaServiceImpl implements InboundPdaService {
addParam.setStoragevehicleCode(groupPlate.getStoragevehicle_code());
addParam.setUnitName(groupPlate.getQty_unit_name());
addParam.setUnitId(groupPlate.getQty_unit_id());
addParam.setExtCode(groupPlate.getExt_code());
addParam.setExtType(groupPlate.getExt_type());
addParam.setExtCode(purchasemst.getOrder_no());
addParam.setExtType(purchasemst.getOrder_type());
addParam.setSectCode(usualInboundDto.getSect_code());
addParam.setStructCode(structattr.getStruct_code());
addParam.setStorCode(structattr.getStor_code());
@@ -306,8 +311,8 @@ public class InboundPdaServiceImpl implements InboundPdaService {
.qty_unit_name(unitDao.getUnit_name())
.qty(item.getQty())
.status(GROUP_PLATE_STATUS.code("组盘"))
.ext_code(usualInboundDto.getBill_id())
.ext_type(SourceBillTypeEnum.PM_PURCHASE.getBillType())
.ext_code(purchasemst.getOrder_no())
.ext_type(purchasemst.getOrder_type())
.ext_dtl_code(item.getItem_no())
.create_id(SecurityUtils.getCurrentUserId())
.create_name(SecurityUtils.getCurrentNickName())
@@ -326,12 +331,17 @@ public class InboundPdaServiceImpl implements InboundPdaService {
groupPlateInboundDto.setSect_code(sectDao.getSect_code());
groupPlateInboundDto.setVehicle_code(storagevehicleCode);
groupPlateInboundDto.setGroupPlateList(gpList);
groupPlateInboundDto.setSourceBillId(purchasemst.getOrder_no());
groupPlateInboundDto.setSourceBillTpye(purchasemst.getOrder_no());
this.submitGroupPlateInbound(groupPlateInboundDto, false);
}
@Override
@Transactional
public void submitGroupPlateInbound(GroupPlateInboundDto groupPlateInboundDto, Boolean subTask) {
if (StringUtils.isEmpty(groupPlateInboundDto.getSourceBillTpye())){
throw new BadRequestException("提交入库异常,入库单据类型未指定");
}
// 查询组盘明细
List<GroupPlate> plateDaoList;
if (groupPlateInboundDto.getGroupPlateList().isEmpty()){
@@ -360,7 +370,7 @@ public class InboundPdaServiceImpl implements InboundPdaService {
jsonMst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
jsonMst.put("total_qty", total_qty);
jsonMst.put("detail_count", 1);
jsonMst.put("bill_type", IOSEnum.BILL_TYPE.code("采购入库"));
jsonMst.put("bill_type", groupPlateInboundDto.getSourceBillTpye());
jsonMst.put("biz_date", DateUtil.now());
// 组织明细数据
ArrayList<HashMap> tableData = new ArrayList<>();
@@ -601,8 +611,8 @@ public class InboundPdaServiceImpl implements InboundPdaService {
addParam.setStoragevehicleCode(groupPlate.getStoragevehicle_code());
addParam.setUnitName(groupPlate.getQty_unit_name());
addParam.setUnitId(groupPlate.getQty_unit_id());
addParam.setExtCode(groupPlate.getExt_code());
addParam.setExtType(groupPlate.getExt_type());
addParam.setExtCode(returnInboundDto.getBill_id());
addParam.setExtType(BILL_TYPE.code("MES生产退货入库"));
addParam.setSectCode(returnInboundDto.getSect_code());
addParam.setStructCode(structattr.getStruct_code());
addParam.setStorCode(structattr.getStor_code());
@@ -623,7 +633,7 @@ public class InboundPdaServiceImpl implements InboundPdaService {
.qty(item.getQty())
.status(GROUP_PLATE_STATUS.code("组盘"))
.ext_code(returnInboundDto.getBill_id())
.ext_type(SourceBillTypeEnum.PM_RETURN.getBillType())
.ext_type(BILL_TYPE.code("MES生产退货入库"))
.ext_dtl_code(item.getItem_no())
.create_id(SecurityUtils.getCurrentUserId())
.create_name(SecurityUtils.getCurrentNickName())
@@ -670,7 +680,7 @@ public class InboundPdaServiceImpl implements InboundPdaService {
jsonMst.put("bill_status", IOSEnum.BILL_STATUS.code("生成"));
jsonMst.put("total_qty", total_qty);
jsonMst.put("detail_count", 1);
jsonMst.put("bill_type", IOSEnum.BILL_TYPE.code("采购入库"));
jsonMst.put("bill_type", IOSEnum.BILL_TYPE.code("MES生产退货入库"));
jsonMst.put("biz_date", DateUtil.now());
// 组织明细数据
ArrayList<HashMap> tableData = new ArrayList<>();

View File

@@ -12,7 +12,7 @@ public enum SourceBillTypeEnum {
PM_DEMADN("pm_demand","出库需求单"),
PM_PURCHASE("pm_purchase","采购入库单"),
PM_RECEIVING("p_receiving","生产入库"),
PM_RETURN("pm_return","退料入库"),
PM_RETURN("pm_return","生产退料入库"),
UNDEFINE("","未定义"),
;
/**

View File

@@ -28,7 +28,7 @@ public enum IOSEnum {
BILL_STATUS(MapOf.of("生成","10", "分配中", "20", "分配完", "30", "完成", "99")),
// 入库业务类型
BILL_TYPE(MapOf.of("生产入库","0001", "采购入库", "103", "调拨入库", "107", "其他入库", "109", "销售出库","102","生产出库","1005","调拨出库","106", "其他出库", "108","库存调拨", "2001")),
BILL_TYPE(MapOf.of("生产入库","0001", "采购入库", "103", "退货入库", "104","MES生产退货入库", "1004", "调拨入库", "107", "其他入库", "109", "销售出库","102","生产出库","1005","调拨出库","106", "其他出库", "108","库存调拨", "2001")),
//入库分配明细状态
INBILL_DIS_STATUS(MapOf.of("未生成", "00", "生成", "01", "执行中", "02", "完成", "99")),

View File

@@ -686,6 +686,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
@Override
public void disFinish(List<IOStorInvDis> disList) {
String iostorinvId = disList.get(0).getIostorinv_id();
final IOStorInv ioStorInv = ioStorInvMapper.selectById(iostorinvId);
String storagevehicleCode = disList.get(0).getStoragevehicle_code();
String structCode = disList.get(0).getStruct_code();
//解锁库位
@@ -715,6 +716,8 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
addParam.setUnitName(invDis.getQty_unit_name());
addParam.setUnitId(invDis.getQty_unit_id());
addParam.setQty(invDis.getPlan_qty());
addParam.setExtCode(ioStorInv.getBill_code());
addParam.setExtType(ioStorInv.getBill_type());
addParam.setSectCode(invDis.getSect_code());
addParam.setStructCode(invDis.getStruct_code());
addInvParams.add(addParam);

View File

@@ -0,0 +1,28 @@
package org.nl.wms.warehouse_manage.inventory.core.param.impl;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.nl.wms.warehouse_manage.inventory.core.param.InventoryParam;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class OutFinishParamForce implements InventoryParam {
private String storagevehicleCode;
private String materialCode;
private String storCode;
private String sectCode;
private String structCode;
private String pcsn;
private BigDecimal changeQty;
@Override
public OutFinishParamForce validation() {
return this;
}
}

View File

@@ -306,6 +306,7 @@ public class StInventoryServiceImpl implements IStInventoryService {
record.setQty(groupPlate.getQty());
record.setChange_qty(invParam.getQty());
record.setSource_form_id(invParam.getExtCode());
record.setSource_form_type(invParam.getExtType());
record.setUnit_id(invParam.getUnitId());
record.setStruct_code(invParam.getStructCode());
record.setStor_code(invParam.getStorCode());

View File

@@ -23,6 +23,9 @@ public class PmStockReturn implements Serializable {
@TableField("request_Id")
private String request_Id;
@TableField("bill_code")
private String bill_code;
private String request_type;
private String error_msg;

View File

@@ -15,6 +15,7 @@ import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
import org.nl.wms.warehouse_manage.stockReturn.service.enums.StockReturnStatusEnum;
import org.nl.wms.warehouse_manage.stockReturn.service.mapper.PmStockReturnMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
@@ -41,6 +42,9 @@ public class PmStockReturnServiceImpl extends ServiceImpl<PmStockReturnMapper, P
if (StringUtils.hasText(requestId == null ? null : String.valueOf(requestId))) {
wrapper.lambda().like(PmStockReturn::getRequest_Id, requestId);
}
if (!ObjectUtils.isEmpty(whereJson.get("request_Id"))) {
wrapper.lambda().like(PmStockReturn::getRequest_Id, requestId);
}
Object requestType = whereJson.get("request_type");
if (StringUtils.hasText(requestType == null ? null : String.valueOf(requestType))) {
wrapper.lambda().eq(PmStockReturn::getRequest_type, requestType);

View File

@@ -13,8 +13,10 @@ import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
import org.nl.wms.warehouse_manage.stockReturn.service.dao.PmStockReturn;
@@ -42,6 +44,8 @@ public class DealLLCKBillCallBack implements CallbackStrategy {
@Autowired
private ISchBaseRegionService iSchBaseRegionService;
@Autowired
private IOStorInvMapper ioStorInvMapper;
@Autowired
private MesApi mesApi;
@Override
@@ -62,6 +66,7 @@ public class DealLLCKBillCallBack implements CallbackStrategy {
}
one.setAssign_qty(param.getAssign_qty());
if (one.getAssign_qty().intValue()>=one.getQty().intValue()){
final IOStorInv ioStorInv = ioStorInvMapper.selectById(param.getIostorinv_id());
one.setStatus(DemandStatus.FINISH.getValue());
final String now = DateUtil.now();
JSONObject callbackData = new JSONObject();
@@ -88,8 +93,9 @@ public class DealLLCKBillCallBack implements CallbackStrategy {
data.put("entrys", entrys);
callbackData.put("data", data);
PmStockReturn stockReturn = new PmStockReturn();
stockReturn.setRequest_Id(param.getIostorinv_id());
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("库存调拨"));
stockReturn.setRequest_Id(orderCode);
stockReturn.setBill_code(ioStorInv.getBill_code());
stockReturn.setRequest_type(ioStorInv.getBill_type());
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
stockReturn.setCreate_time(now);
stockReturn.setRequest_data(callbackData.toString());

View File

@@ -18,9 +18,11 @@ import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
@@ -61,6 +63,8 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
@Autowired
private IStInventoryService iStInventoryService;
@Autowired
private IOStorInvMapper ioStorInvMapper;
@Autowired
private MesApi mesApi;
@Override
@@ -82,6 +86,8 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
if (targetAttr ==null ||StringUtils.isEmpty(targetAttr.getStoragevehicle_code())){
throw new BadRequestException("调拨失败,当前调拨目标区域缺少仓库熟悉"+targetAttr.getStruct_code());
}
final IOStorInv ioStorInv = ioStorInvMapper.selectById(param.getIostorinv_id());
List<AddInvParam> addInvParams = new ArrayList<>();
AddInvParam addParam = new AddInvParam();
addParam.setPcsn(StringUtils.isEmpty(param.getPcsn())?"1":param.getPcsn());
@@ -90,6 +96,8 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
addParam.setStructCode(targetAttr.getStruct_code());
addParam.setSectCode(targetAttr.getSect_code());
addParam.setStorCode(targetAttr.getStor_code());
addParam.setExtCode(ioStorInv.getBill_code());
addParam.setExtType(ioStorInv.getBill_type());
addParam.setUnitName(param.getQty_unit_name());
addParam.setUnitId(param.getQty_unit_id());
addParam.setQty(param.getAssign_qty());
@@ -132,8 +140,10 @@ public class DealLLDBBillPmDeamndCallBack implements CallbackStrategy {
data.put("entrys", entrys);
callbackData.put("data", data);
PmStockReturn stockReturn = new PmStockReturn();
stockReturn.setRequest_Id(orderCode);
stockReturn.setBill_code(ioStorInv.getBill_code());
stockReturn.setRequest_Id(param.getIostorinv_id());
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("库存调拨"));
stockReturn.setRequest_type(ioStorInv.getBill_type());
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
stockReturn.setCreate_time(now);
stockReturn.setRequest_data(callbackData.toString());

View File

@@ -17,8 +17,10 @@ import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
import org.nl.wms.sch_manage.service.ISchBaseRegionService;
import org.nl.wms.sch_manage.service.dao.SchBaseRegion;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
@@ -57,6 +59,8 @@ public class DealLLDBBillPmDeamndPlatingCallBack implements CallbackStrategy {
@Autowired
private IStInventoryService iStInventoryService;
@Autowired
private IOStorInvMapper ioStorInvMapper;
@Autowired
private MesApi mesApi;
@Override
@@ -78,6 +82,8 @@ public class DealLLDBBillPmDeamndPlatingCallBack implements CallbackStrategy {
if (targetAttr ==null ||StringUtils.isEmpty(targetAttr.getStoragevehicle_code())){
throw new BadRequestException("调拨失败,当前调拨目标区域缺少仓库熟悉"+targetAttr.getStruct_code());
}
final IOStorInv ioStorInv = ioStorInvMapper.selectById(param.getIostorinv_id());
List<AddInvParam> addInvParams = new ArrayList<>();
AddInvParam addParam = new AddInvParam();
addParam.setPcsn(StringUtils.isEmpty(param.getPcsn())?"1":param.getPcsn());
@@ -88,6 +94,8 @@ public class DealLLDBBillPmDeamndPlatingCallBack implements CallbackStrategy {
addParam.setStorCode(targetAttr.getStor_code());
addParam.setUnitName(param.getQty_unit_name());
addParam.setUnitId(param.getQty_unit_id());
addParam.setExtCode(ioStorInv.getBill_code());
addParam.setExtType(ioStorInv.getBill_type());
addParam.setQty(param.getAssign_qty());
addInvParams.add(addParam);
iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
@@ -128,8 +136,9 @@ public class DealLLDBBillPmDeamndPlatingCallBack implements CallbackStrategy {
data.put("entrys", entrys);
callbackData.put("data", data);
PmStockReturn stockReturn = new PmStockReturn();
stockReturn.setRequest_Id(param.getIostorinv_id());
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("库存调拨"));
stockReturn.setRequest_Id(orderCode);
stockReturn.setRequest_Id(ioStorInv.getBill_code());
stockReturn.setRequest_type(ioStorInv.getBill_type());
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
stockReturn.setCreate_time(now);
stockReturn.setRequest_data(callbackData.toString());

View File

@@ -6,6 +6,8 @@ import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
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;
@@ -16,6 +18,8 @@ import org.nl.wms.welding_manage.service.work_order.dao.WorkOrderDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 生产入库回传
*/
@@ -26,6 +30,8 @@ public class DealManufactureRecBillCallback implements CallbackStrategy {
private IWorkOrderService iWorkOrderService;
@Autowired
private IPmStockReturnService iPmStockReturnService;
@Resource
private IOStorInvMapper ioStorInvMapper;
@Override
@@ -36,6 +42,9 @@ public class DealManufactureRecBillCallback implements CallbackStrategy {
if (workOrder == null){
throw new BadRequestException("工单不存在");
}
final IOStorInv ioStorInv = ioStorInvMapper.selectById(param.getIostorinv_id());
//组织报文信息
// 组织报文信息
JSONObject callbackData = new JSONObject();
@@ -60,7 +69,9 @@ public class DealManufactureRecBillCallback implements CallbackStrategy {
// 记录回传日志 - 发送前
PmStockReturn stockReturn = new PmStockReturn();
stockReturn.setRequest_Id(workOrder.getOrder_id());
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("生产入库"));
stockReturn.setBill_code(ioStorInv.getBill_code());
stockReturn.setRequest_Id(workOrder.getOrder_id());
stockReturn.setRequest_type(ioStorInv.getBill_type());
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
stockReturn.setCreate_time(DateUtil.now());
stockReturn.setRequest_data(callbackData.toString());

View File

@@ -13,8 +13,11 @@ import org.nl.wms.pm_manage.purchase.service.PurchasedtlService;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
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;
@@ -39,7 +42,7 @@ public class DealPurchaseRecBillCallback implements CallbackStrategy {
@Autowired
private PurchasedtlService purchasedtlService;
@Autowired
private IOStorInvDtlMapper ioStorInvDtlMapper;
private IOStorInvMapper ioStorInvMapper;
@Override
@@ -50,6 +53,7 @@ public class DealPurchaseRecBillCallback implements CallbackStrategy {
if (PurchaseBillStatus.COMPLETED.getCode().equals(purchasemst.getBill_status())){
throw new BadRequestException("重复入库!");
}
Boolean isReturn = IOSEnum.BILL_TYPE.code("退货入库").equals(purchasemst.getOrder_type());
List<EasAuditRequestDto.EasAuditEntryDto> entryList = new ArrayList<>();
Purchasedtl purchasedtl = purchasedtlService.getOne(new LambdaQueryWrapper<Purchasedtl>()
.eq(Purchasedtl::getBill_id, orderCode)
@@ -64,6 +68,8 @@ public class DealPurchaseRecBillCallback implements CallbackStrategy {
boolean flag = list.stream().anyMatch(i -> i.getQty().compareTo(i.getInstock_qty())>0);
if (!flag){
//全部相等则单据完成
final IOStorInv ioStorInv = ioStorInvMapper.selectById(param.getIostorinv_id());
purchaseService.lambdaUpdate()
.set(Purchasemst::getBill_status, PurchaseBillStatus.COMPLETED.getCode())
.set(Purchasemst::getModify_date, DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"))
@@ -73,7 +79,11 @@ public class DealPurchaseRecBillCallback implements CallbackStrategy {
for (Purchasedtl dtl : list) {
EasAuditRequestDto.EasAuditEntryDto easAuditEntryDto = new EasAuditRequestDto.EasAuditEntryDto();
easAuditEntryDto.setSeq(Integer.parseInt(dtl.getItem_no()));
easAuditEntryDto.setQty(dtl.getQty());
if (isReturn){
easAuditEntryDto.setQty(dtl.getQty().negate());
}else {
easAuditEntryDto.setQty(dtl.getQty());
}
easAuditEntryDto.setEntryId(dtl.getEntry_id());
entryList.add(easAuditEntryDto);
}
@@ -89,6 +99,7 @@ public class DealPurchaseRecBillCallback implements CallbackStrategy {
final PmStockReturn stockReturn = new PmStockReturn();
stockReturn.setRequest_Id(orderCode);
stockReturn.setBill_code(ioStorInv.getBill_code());
stockReturn.setCreate_time(DateUtil.now());
stockReturn.setRequest_type(purchasemst.getOrder_type());
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode());

View File

@@ -10,8 +10,10 @@ import org.nl.wms.ext_manage.util.ErpUtil;
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInv;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvMapper;
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;
@@ -34,12 +36,13 @@ public class DealReturnBillCallback implements CallbackStrategy {
@Autowired
private IPmReturnService pmReturnService;
@Autowired
private IOStorInvDtlMapper ioStorInvDtlMapper;
private IOStorInvMapper ioStorInvMapper;
@Override
public void buildCallback(IOStorInvDtl param) {
final String orderCode = param.getSource_bill_code();
PmReturn pmReturn = pmReturnService.getOne(new LambdaQueryWrapper<PmReturn>()
.eq(PmReturn::getOrder_code, orderCode));
List<EasAuditRequestDto.EasAuditEntryDto> entryList = new ArrayList<>();
@@ -47,6 +50,8 @@ public class DealReturnBillCallback implements CallbackStrategy {
boolean flag = pmReturn.getAssign_qty().compareTo(pmReturn.getQty()) >= 0;
if (flag){
//单据完成
final IOStorInv ioStorInv = ioStorInvMapper.selectById(param.getIostorinv_id());
pmReturnService.lambdaUpdate()
.set(PmReturn::getAssign_qty, pmReturn.getAssign_qty())
.set(PmReturn::getUpdate_time, DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"))
@@ -82,7 +87,8 @@ public class DealReturnBillCallback implements CallbackStrategy {
//保存回传单
PmStockReturn stockReturn = new PmStockReturn();
stockReturn.setRequest_Id(pmReturn.getId());
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("库存调拨"));
stockReturn.setBill_code(ioStorInv.getBill_code());
stockReturn.setRequest_type(ioStorInv.getBill_type());
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
stockReturn.setCreate_time(DateUtil.now());
stockReturn.setRequest_data(root.toJSONString());

View File

@@ -50,11 +50,11 @@ spring:
datasource:
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:172.30.15.33}:${DB_PORT:3306}/${DB_NAME:wms_nlwq}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3307}/${DB_NAME:wms_nlwq1}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
# url: jdbc:mysql://${DB_HOST:172.30.15.33}:${DB_PORT:3306}/${DB_NAME:wms_nlwq_dev}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
username: ${DB_USER:root}
password: ${DB_PWD:shnl*123}
# password: ${DB_PWD:123456}
# password: ${DB_PWD:shnl*123}
password: ${DB_PWD:123456}
druid:
# 基础连接池配置
initial-size: 15