fix:优化出库逻辑
This commit is contained in:
@@ -321,7 +321,9 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
|
||||
@Override
|
||||
public List<StrategyStructMaterialVO> outBoundSectDiv(StrategyStructParam param) {
|
||||
//只校验仓库,库区
|
||||
Assert.noNullElements(new Object[]{param.getSect_code()},"请求参数不能为空");
|
||||
if (StringUtils.isEmpty(param.getSect_code())){
|
||||
throw new BadRequestException("分配失败,未选择出库库区");
|
||||
}
|
||||
StSectStrategy one = iStSectStrategyService.getOne(new LambdaQueryWrapper<StSectStrategy>()
|
||||
.eq(StSectStrategy::getSect_code, param.getSect_code())
|
||||
.eq(StSectStrategy::getStrategy_type, StatusEnum.STRATEGY_TYPE.code("出库")));
|
||||
|
||||
@@ -43,7 +43,7 @@ public class FIFORuleHandler extends Decisioner<StrategyStructMaterialVO, Strate
|
||||
StrategyMater strategyMater = maters.get(0);
|
||||
BigDecimal planQty = strategyMater.getQty();
|
||||
List<StructattrVechielDto> vechielDtos =
|
||||
iStructattrService.collectVechicle(MapOf.of("material_id", strategyMater.getMaterial_id()
|
||||
iStructattrService.collectVechicle(MapOf.of("material_code", strategyMater.getMaterial_code()
|
||||
, "pcsn", strategyMater.getPcsn()
|
||||
, "sect_code", param.getSect_code()
|
||||
, "plan_qty", planQty
|
||||
|
||||
@@ -42,7 +42,7 @@ public class EasApi {
|
||||
//保存回传单
|
||||
PmStockReturn stockReturn = new PmStockReturn();
|
||||
stockReturn.setRequest_Id(receiveOutRequest.getBillno());
|
||||
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("生产领料"));
|
||||
stockReturn.setRequest_type(IOSEnum.BILL_TYPE.code("生产出库"));
|
||||
stockReturn.setStatus(StockReturnStatusEnum.TODO.getCode()); // 0-处理中
|
||||
stockReturn.setCreate_time(DateUtil.now());
|
||||
stockReturn.setRequest_data(req.toJSONString());
|
||||
|
||||
@@ -67,6 +67,7 @@ public class PdaIosOutController {
|
||||
|
||||
@PostMapping("/assignOutDis")
|
||||
@SaIgnore
|
||||
@Log("平库出库明细确认")
|
||||
public ResponseEntity<Object> assignOutDis(@RequestBody OutBoundDis outBoundDis) {
|
||||
pdaIosOutService.outDisFinish(outBoundDis);
|
||||
return ResponseData.build();
|
||||
|
||||
@@ -304,7 +304,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchasemstMapper, Purchase
|
||||
row.put("source_bill_code", purchase.getBill_id());
|
||||
row.put("source_bill_type", SourceBillTypeEnum.PM_PURCHASE.getBillType());
|
||||
row.put("source_billdtl_id", detail.getItem_no());
|
||||
row.put("callback_strategy", "DealPurchaseRecBillCallback");
|
||||
row.put("callback_strategy", "dealPurchaseRecBillCallback");
|
||||
row.put("remark", "关联采购单:" + purchase.getOrder_no());
|
||||
tableData.add(row);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SchBasePointController {
|
||||
.isNull(SchBasePoint::getVehicle_code));
|
||||
List<Map> result = new ArrayList<>();
|
||||
for (SchBasePoint point : points) {
|
||||
result.add(MapOf.of("value",point.getVehicle_code(),"label",point.getVehicle_code()));
|
||||
result.add(MapOf.of("value",point.getPoint_code(),"label",point.getPoint_name()));
|
||||
}
|
||||
return ResponseData.build(result, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public enum IOSEnum {
|
||||
BILL_STATUS(MapOf.of("生成","10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||
|
||||
// 入库业务类型
|
||||
BILL_TYPE(MapOf.of("生产入库","0001", "采购入库", "0005","生产领料", "0006", "手工入库", "0009","销售出库","1001","生产出库","1005","调拨出库","1004", "手工出库", "1009","库存调拨", "2001")),
|
||||
BILL_TYPE(MapOf.of("生产入库","0001", "采购入库", "103", "调拨入库", "107", "其他入库", "109", "销售出库","102","生产出库","1005","调拨出库","106", "其他出库", "108","库存调拨", "2001")),
|
||||
|
||||
//入库分配明细状态
|
||||
INBILL_DIS_STATUS(MapOf.of("未生成", "00", "生成", "01", "执行中", "02", "完成", "99")),
|
||||
|
||||
@@ -6,8 +6,12 @@ import org.nl.common.base.ResponseData;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillCancelReq;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillDivReq;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillManualDivReq;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillOneCancelReq;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -36,6 +40,12 @@ public class OutBillController {
|
||||
public ResponseEntity<Object> getCanuseIvt(@RequestParam Map whereJson, PageQuery page) {
|
||||
return ResponseData.build(iOutBillService.getCanuseIvt(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
@GetMapping("/getStructIvt")
|
||||
@Log("查询可分配库存")
|
||||
public ResponseEntity<Object> getStructIvt(@RequestParam Map whereJson) {
|
||||
return ResponseData.build(iOutBillService.queryAvailableInv(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Log("修改出库单")
|
||||
@@ -50,7 +60,6 @@ public class OutBillController {
|
||||
iOutBillService.deleteAll(ids);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@PostMapping()
|
||||
@Log("新增出库单")
|
||||
public ResponseEntity<Object> insertDtl(@RequestBody JSONObject whereJson) {
|
||||
@@ -69,52 +78,34 @@ public class OutBillController {
|
||||
public ResponseEntity<Object> getOutBillDis(@RequestParam Map whereJson) {
|
||||
return ResponseData.build(iOutBillService.getOutBillDis(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/allDiv")
|
||||
@Log("出库单全部分配")
|
||||
public ResponseEntity<Object> allDiv(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.allDiv(whereJson);
|
||||
public ResponseEntity<Object> allDiv(@RequestBody OutBillDivReq req) {
|
||||
iOutBillService.doDiv(req, false);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@PostMapping("/allCancel")
|
||||
@Log("出库单全部取消")
|
||||
public ResponseEntity<Object> allCancel(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.allCancel(whereJson);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@PostMapping("/autoDiv")
|
||||
@Log("出库单自动分配")
|
||||
public ResponseEntity<Object> autoDiv(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.autoDiv(whereJson);
|
||||
public ResponseEntity<Object> autoDiv(@RequestBody OutBillDivReq req) {
|
||||
iOutBillService.doDiv(req, true);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@PostMapping("/autoCancel")
|
||||
@Log("出库单自动取消分配")
|
||||
public ResponseEntity<Object> autoCancel(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.autoCancel(whereJson);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@GetMapping("/getStructIvt")
|
||||
@Log("查询可分配库存")
|
||||
public ResponseEntity<Object> getStructIvt(@RequestParam Map whereJson) {
|
||||
return ResponseData.build(iOutBillService.queryAvailableInv(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/manualDiv")
|
||||
@Log("出库单手动分配")
|
||||
public ResponseEntity<Object> manualDiv(@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.manualDiv(whereJson);
|
||||
public ResponseEntity<Object> manualDiv(@RequestBody OutBillManualDivReq req) {
|
||||
iOutBillService.manualDiv(req);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@PostMapping("/oneCancel")
|
||||
@Log("出库单取消分配")
|
||||
public ResponseEntity<Object> oneCancel (@RequestBody JSONObject whereJson) {
|
||||
iOutBillService.oneCancel(whereJson);
|
||||
@PostMapping("/allCancel")
|
||||
@Log("出库单全部取消")
|
||||
public ResponseEntity<Object> allCancel(@RequestBody OutBillCancelReq req) {
|
||||
iOutBillService.doCancel(req.getIostorinv_id(), null);
|
||||
return ResponseData.build();
|
||||
}
|
||||
@PostMapping("/autoCancel")
|
||||
@Log("出库单自动取消分配")
|
||||
public ResponseEntity<Object> autoCancel(@RequestBody OutBillDivReq req) {
|
||||
iOutBillService.doCancel(req.getIostorinv_id(), req.getIostorinvdtl_id());
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ 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.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDtlDto;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillCancelReq;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillDivReq;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillManualDivReq;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.OutBillOneCancelReq;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -83,32 +87,9 @@ public interface IOutBillService extends IService<IOStorInv> {
|
||||
*/
|
||||
List<IOStorInvDisDto> getOutBillDis(Map whereJson);
|
||||
|
||||
/**
|
||||
* 全部分配,对同一出库单明细进行分配
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void allDiv(JSONObject whereJson);
|
||||
void doDiv(OutBillDivReq req, boolean singleDtl);
|
||||
void doCancel(String iostorinvId, String iostorinvdtlId);
|
||||
|
||||
/**
|
||||
* 全部取消
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void allCancel(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
*
|
||||
* 自动分配 单条出库单明细
|
||||
* @param whereJson
|
||||
*/
|
||||
void autoDiv(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 自动取消分配 单条出库单明细
|
||||
* @param whereJson
|
||||
*/
|
||||
void autoCancel(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 查询可用库存
|
||||
@@ -122,14 +103,8 @@ public interface IOutBillService extends IService<IOStorInv> {
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void manualDiv(JSONObject whereJson);
|
||||
void manualDiv(OutBillManualDivReq req);
|
||||
|
||||
/**
|
||||
* 出库单取消分配
|
||||
*
|
||||
* @param whereJson /
|
||||
*/
|
||||
void oneCancel(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 设置全部站点
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.wms.warehouse_manage.inAndOut.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 出库单全部取消请求参数
|
||||
*
|
||||
* @author dsh
|
||||
* 2026/7/22
|
||||
*/
|
||||
@Data
|
||||
public class OutBillCancelReq {
|
||||
|
||||
/**
|
||||
* 出入库单标识
|
||||
*/
|
||||
private String iostorinv_id;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.wms.warehouse_manage.inAndOut.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 出库分配请求参数
|
||||
*
|
||||
* @author dsh
|
||||
* 2026/7/22
|
||||
*/
|
||||
@Data
|
||||
public class OutBillDivReq {
|
||||
|
||||
/**
|
||||
* 出入库单标识
|
||||
*/
|
||||
private String iostorinv_id;
|
||||
|
||||
/**
|
||||
* 出入库单明细标识
|
||||
*/
|
||||
private String iostorinvdtl_id;
|
||||
|
||||
/**
|
||||
* 库区编码
|
||||
*/
|
||||
private String sect_code;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package org.nl.wms.warehouse_manage.inAndOut.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出库单手工分配请求参数
|
||||
*
|
||||
* @author dsh
|
||||
* 2026/7/22
|
||||
*/
|
||||
@Data
|
||||
public class OutBillManualDivReq {
|
||||
|
||||
private Row row;
|
||||
|
||||
private List<Item> rows;
|
||||
|
||||
@Data
|
||||
public static class Row {
|
||||
/**
|
||||
* 出入库单标识
|
||||
*/
|
||||
private String iostorinv_id;
|
||||
|
||||
/**
|
||||
* 出入库单明细标识
|
||||
*/
|
||||
private String iostorinvdtl_id;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Item {
|
||||
private String sect_id;
|
||||
private String pcsn;
|
||||
private String sect_name;
|
||||
private String sect_code;
|
||||
private String struct_id;
|
||||
private String struct_name;
|
||||
private String struct_code;
|
||||
private String storagevehicle_code;
|
||||
private String material_code;
|
||||
private BigDecimal change_qty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.nl.wms.warehouse_manage.inAndOut.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 出库单单条取消分配请求参数
|
||||
*
|
||||
* @author dsh
|
||||
* 2026/7/22
|
||||
*/
|
||||
@Data
|
||||
public class OutBillOneCancelReq {
|
||||
|
||||
/**
|
||||
* 出入库单标识
|
||||
*/
|
||||
private String iostorinv_id;
|
||||
|
||||
/**
|
||||
* 出入库单明细标识
|
||||
*/
|
||||
private String iostorinvdtl_id;
|
||||
|
||||
/**
|
||||
* 出入库单分配标识
|
||||
*/
|
||||
private String iostorinvdis_id;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -131,7 +131,6 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
break;
|
||||
case "OutDisParam":
|
||||
final List<OutDisParam> outDisParams = (List<OutDisParam>) params;
|
||||
List<StIvtStructivtflow> recordsOutDis = new ArrayList<>();
|
||||
for (OutDisParam outDisParam : outDisParams) {
|
||||
LambdaQueryWrapper<GroupPlate> query = new QueryWrapper<GroupPlate>().lambda()
|
||||
.eq(GroupPlate::getStoragevehicle_code, outDisParam.getStoragevehicleCode())
|
||||
@@ -149,26 +148,10 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
}
|
||||
final BigDecimal frozenQty = groupPlate.getFrozen_qty().add(outDisParam.getFrozenQty());
|
||||
iMdPbGroupplateService.update(new LambdaUpdateWrapper<GroupPlate>()
|
||||
.set(GroupPlate::getQty, qty)
|
||||
.set(GroupPlate::getFrozen_qty,frozenQty)
|
||||
.set(GroupPlate::getUpdate_time,DateUtil.now())
|
||||
.eq(GroupPlate::getGroup_id,groupPlate.getGroup_id()));
|
||||
StIvtStructivtflow stIvtStructivtflow = new StIvtStructivtflow();
|
||||
stIvtStructivtflow.setId(IdUtil.getStringId());
|
||||
stIvtStructivtflow.setUpdate_time(DateUtil.now());
|
||||
stIvtStructivtflow.setChange_qty(BigDecimal.ZERO);
|
||||
stIvtStructivtflow.setQty(qty);
|
||||
stIvtStructivtflow.setFrozen_qty(frozenQty);
|
||||
stIvtStructivtflow.setVehicle_code(outDisParam.getStoragevehicleCode());
|
||||
stIvtStructivtflow.setStor_code(outDisParam.getStorCode());
|
||||
stIvtStructivtflow.setSect_code(outDisParam.getSectCode());
|
||||
stIvtStructivtflow.setStruct_code(outDisParam.getStructCode());
|
||||
stIvtStructivtflow.setPcsn(groupPlate.getPcsn());
|
||||
stIvtStructivtflow.setGrowth(false);
|
||||
stIvtStructivtflow.setMaterial_id(groupPlate.getMaterial_code());
|
||||
recordsOutDis.add(stIvtStructivtflow);
|
||||
}
|
||||
stIvtStructivtflowService.saveBatch(recordsOutDis);
|
||||
break;
|
||||
case "OutFinishParam":
|
||||
final List<OutFinishParam> outFinishParams = (List<OutFinishParam>) params;
|
||||
@@ -183,6 +166,7 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
}
|
||||
GroupPlate groupPlate = iMdPbGroupplateService.getOne(queryWrapper);
|
||||
groupPlate.setFrozen_qty(groupPlate.getFrozen_qty().subtract(outFinishParam.getChangeQty()));
|
||||
groupPlate.setQty(groupPlate.getQty().subtract(outFinishParam.getChangeQty()));
|
||||
groupPlate.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
groupPlate.setUpdate_time(DateUtil.now());
|
||||
@@ -220,11 +204,10 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
throw new BadRequestException("当前物料在组盘"+param.getStoragevehicleCode()+"库存中不存在");
|
||||
}
|
||||
groupPlate.setFrozen_qty(groupPlate.getFrozen_qty().subtract(param.getChangeQty()));
|
||||
groupPlate.setQty(groupPlate.getQty().add(param.getChangeQty()));
|
||||
groupPlate.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
groupPlate.setUpdate_time(DateUtil.now());
|
||||
System.out.println("========="+groupPlate.getFrozen_qty()+"=========");
|
||||
System.out.println("========="+groupPlate.getFrozen_qty()+"_"+groupPlate.getQty()+"=========");
|
||||
iMdPbGroupplateService.updateById(groupPlate);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -49,16 +49,12 @@ public class DealPurchaseRecBillCallback implements CallbackStrategy {
|
||||
List<EasAuditRequestDto.EasAuditEntryDto> entryList = new ArrayList<>();
|
||||
Purchasedtl purchasedtl = purchasedtlService.getOne(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, orderCode)
|
||||
// .eq(Purchasedtl::getSku_code, param.getMaterial_code())
|
||||
.eq(Purchasedtl::getItem_no, param.getSource_billdtl_id()));
|
||||
|
||||
purchasedtl.setInstock_qty(param.getPlan_qty().add(purchasedtl.getInstock_qty()));
|
||||
purchasedtlService.updateById(purchasedtl);
|
||||
|
||||
|
||||
List<Purchasedtl> list = purchasedtlService.list(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, orderCode));
|
||||
boolean flag = list.stream().anyMatch(i -> i.getQty().compareTo(i.getInstock_qty()) != 0);
|
||||
boolean flag = list.stream().anyMatch(i -> i.getQty().compareTo(i.getInstock_qty())>0);
|
||||
if (!flag){
|
||||
//全部相等则单据完成
|
||||
purchaseService.lambdaUpdate()
|
||||
|
||||
Reference in New Issue
Block a user