Commit f2b5e8207be22aded23d38f11c6f143793b1ddba

Authored by 杨鸣坤
1 parent 7a90bc7c

楚江ERP:补货单生成订货单

... ... @@ -38,6 +38,11 @@ public class PurchaseOrderInfo extends BaseEntity implements BaseDto {
38 38 private String contractId;
39 39
40 40 /**
  41 + * 补货单ID
  42 + */
  43 + private String replenishmentOrderId;
  44 +
  45 + /**
41 46 * 合同类型
42 47 */
43 48 @TableField(exist = false)
... ...
... ... @@ -14,7 +14,9 @@ import com.lframework.starter.web.core.components.resp.PageResult;
14 14 import com.lframework.starter.web.core.utils.OpLogUtil;
15 15 import com.lframework.starter.common.utils.StringUtil;
16 16 import com.lframework.starter.common.exceptions.impl.DefaultClientException;
  17 +
17 18 import java.io.Serializable;
  19 +
18 20 import com.lframework.starter.web.core.utils.IdUtil;
19 21 import com.lframework.starter.common.utils.ObjectUtil;
20 22 import com.lframework.starter.web.core.annotations.oplog.OpLog;
... ... @@ -136,6 +138,9 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
136 138 if (!StringUtil.isBlank(vo.getContractId())) {
137 139 data.setContractId(vo.getContractId());
138 140 }
  141 + if (!StringUtils.isBlank(vo.getReplenishmentOrderId())) {
  142 + data.setReplenishmentOrderId(vo.getReplenishmentOrderId());
  143 + }
139 144 if (!StringUtil.isBlank(vo.getOrderNo())) {
140 145 data.setOrderNo(vo.getOrderNo());
141 146 }
... ... @@ -432,8 +437,8 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
432 437 /**
433 438 * 更新规格变更状态
434 439 *
435   - * @param id 主键ID
436   - * @param status 状态
  440 + * @param id 主键ID
  441 + * @param status 状态
437 442 */
438 443 @Override
439 444 public void updateSpecChangeStatus(String id, String status) {
... ...
... ... @@ -20,12 +20,16 @@ import com.lframework.starter.web.core.utils.OpLogUtil;
20 20 import com.lframework.starter.web.core.utils.PageHelperUtil;
21 21 import com.lframework.starter.web.core.utils.PageResultUtil;
22 22 import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
  23 +import com.lframework.xingyun.sc.entity.PurchaseOrderInfo;
23 24 import com.lframework.xingyun.sc.entity.ReplenishmentOrder;
24 25 import com.lframework.xingyun.sc.entity.ReplenishmentOrderLine;
25 26 import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
26 27 import com.lframework.xingyun.sc.mappers.ReplenishmentOrderMapper;
  28 +import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
27 29 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderLineService;
28 30 import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
  31 +import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderInfoVo;
  32 +import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo;
29 33 import com.lframework.xingyun.sc.vo.purchase.*;
30 34 import org.apache.commons.collections4.CollectionUtils;
31 35 import org.apache.commons.lang3.StringUtils;
... ... @@ -36,6 +40,7 @@ import org.springframework.transaction.annotation.Transactional;
36 40
37 41 import javax.annotation.Resource;
38 42 import java.io.Serializable;
  43 +import java.math.BigDecimal;
39 44 import java.util.ArrayList;
40 45 import java.util.List;
41 46 import java.util.stream.Collectors;
... ... @@ -51,6 +56,8 @@ public class ReplenishmentOrderServiceImpl extends BaseMpServiceImpl<Replenishme
51 56 private FlowInstanceWrapperService flowInstanceWrapperService;
52 57 @Resource
53 58 private FlowTaskWrapperMapper flowTaskWrapperMapper;
  59 + @Resource
  60 + private PurchaseOrderInfoService purchaseOrderInfoService;
54 61
55 62 @Override
56 63 public PageResult<ReplenishmentOrder> query(Integer pageIndex, Integer pageSize, QueryReplenishmentOrderVo vo) {
... ... @@ -254,6 +261,67 @@ public class ReplenishmentOrderServiceImpl extends BaseMpServiceImpl<Replenishme
254 261
255 262 OpLogUtil.setVariable("id", vo.getId());
256 263 OpLogUtil.setExtra(data);
  264 +
  265 + // 2025年11月28日14:07:43 逻辑调整,补货单填写完补货时间,生成订货单
  266 + createPurchaseOrder(vo.getId());
  267 + }
  268 +
  269 + private void createPurchaseOrder(String id) {
  270 + ReplenishmentOrder data = getBaseMapper().selectById(id);
  271 + Wrapper<ReplenishmentOrderLine> lineWrapper = Wrappers.lambdaQuery(ReplenishmentOrderLine.class)
  272 + .eq(ReplenishmentOrderLine::getReplenishmentOrderId, id)
  273 + .orderByAsc(ReplenishmentOrderLine::getShowOrder);
  274 + List<ReplenishmentOrderLine> replenishmentOrderLineList = replenishmentOrderLineService.list(lineWrapper);
  275 + PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(data.getPurchaseOrderId());
  276 +
  277 + CreatePurchaseOrderInfoVo vo = new CreatePurchaseOrderInfoVo();
  278 + vo.setContractId(purchaseOrderInfo.getContractId());
  279 + vo.setReplenishmentOrderId(id);
  280 + vo.setOrderNo(purchaseOrderInfo.getOrderNo());
  281 + vo.setOrderDate(purchaseOrderInfo.getOrderDate());
  282 + vo.setSupplyUnit(purchaseOrderInfo.getSupplyUnit());
  283 + vo.setSettlementTerms(purchaseOrderInfo.getSettlementTerms());
  284 + vo.setDeliveryMethod(purchaseOrderInfo.getDeliveryMethod());
  285 + vo.setContractCreateById(purchaseOrderInfo.getContractCreateById());
  286 + vo.setDeptId(purchaseOrderInfo.getDeptId());
  287 + vo.setWorkshopId(purchaseOrderInfo.getWorkshopId());
  288 + vo.setExecutionStandard(purchaseOrderInfo.getExecutionStandard());
  289 + vo.setExecutionStandardRemarks(purchaseOrderInfo.getExecutionStandardRemarks());
  290 + vo.setPieceWeightHeader(purchaseOrderInfo.getPieceWeightHeader());
  291 + vo.setTolerance(purchaseOrderInfo.getTolerance());
  292 + vo.setPerformance(purchaseOrderInfo.getPerformance());
  293 + vo.setElement(purchaseOrderInfo.getElement());
  294 + vo.setPackaging(purchaseOrderInfo.getPackaging());
  295 + vo.setRemarks(purchaseOrderInfo.getRemarks());
  296 + vo.setType("PRODUCTION");
  297 + vo.setExamineStatus("AUDIT");
  298 +
  299 + List<CreatePurchaseOrderLineVo> lineVoList = new ArrayList<>(replenishmentOrderLineList.size());
  300 + BigDecimal totalQuantity = new BigDecimal(0);
  301 + for (ReplenishmentOrderLine replenishmentOrderLine : replenishmentOrderLineList) {
  302 + CreatePurchaseOrderLineVo createPurchaseOrderLineVo = new CreatePurchaseOrderLineVo();
  303 + createPurchaseOrderLineVo.setBrand(replenishmentOrderLine.getBrand());
  304 + createPurchaseOrderLineVo.setThickness(replenishmentOrderLine.getThickness());
  305 + createPurchaseOrderLineVo.setThicknessTolPos(replenishmentOrderLine.getThicknessTolPos());
  306 + createPurchaseOrderLineVo.setThicknessTolNeg(replenishmentOrderLine.getThicknessTolNeg());
  307 + createPurchaseOrderLineVo.setWidth(replenishmentOrderLine.getWidth());
  308 + createPurchaseOrderLineVo.setWidthTolPos(replenishmentOrderLine.getWidthTolPos());
  309 + createPurchaseOrderLineVo.setWidthTolNeg(replenishmentOrderLine.getWidthTolNeg());
  310 + createPurchaseOrderLineVo.setLength(replenishmentOrderLine.getLength());
  311 + createPurchaseOrderLineVo.setLengthTolPos(replenishmentOrderLine.getLengthTolPos());
  312 + createPurchaseOrderLineVo.setLengthTolNeg(replenishmentOrderLine.getLengthTolNeg());
  313 + createPurchaseOrderLineVo.setStatus(replenishmentOrderLine.getStatus());
  314 + createPurchaseOrderLineVo.setQuantity(replenishmentOrderLine.getSupplementaryQuantity());
  315 + createPurchaseOrderLineVo.setDeliveryDate(replenishmentOrderLine.getConfirmedDeliveryDate());
  316 + createPurchaseOrderLineVo.setShowOrder(replenishmentOrderLine.getShowOrder());
  317 + lineVoList.add(createPurchaseOrderLineVo);
  318 +
  319 + totalQuantity = totalQuantity.add(replenishmentOrderLine.getSupplementaryQuantity());
  320 + }
  321 +
  322 + vo.setTotalQuantity(totalQuantity);
  323 + vo.setCreatePurchaseOrderLineVoList(lineVoList);
  324 + purchaseOrderInfoService.create(vo);
257 325 }
258 326
259 327 @Override
... ...
... ... @@ -20,8 +20,6 @@ import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
20 20 import com.lframework.xingyun.sc.mappers.ShipmentsPlanDetailMapper;
21 21 import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
22 22 import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
23   -import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderLineService;
24   -import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
25 23 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
26 24 import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanService;
27 25 import com.lframework.xingyun.sc.utils.CommonUtil;
... ... @@ -53,10 +51,6 @@ public class ShipmentsPlanDetailServiceImpl extends BaseMpServiceImpl<ShipmentsP
53 51 private WorkshopService workshopService;
54 52 @Resource
55 53 private PurchaseOrderInfoService purchaseOrderInfoService;
56   - @Resource
57   - private ReplenishmentOrderLineService replenishmentOrderLineService;
58   - @Resource
59   - private ReplenishmentOrderService replenishmentOrderService;
60 54
61 55
62 56 @Override
... ...
... ... @@ -23,6 +23,12 @@ public class CreatePurchaseOrderInfoVo implements BaseVo, Serializable {
23 23 private String contractId;
24 24
25 25 /**
  26 + * 补货单ID
  27 + */
  28 + @ApiModelProperty("补货单ID")
  29 + private String replenishmentOrderId;
  30 +
  31 + /**
26 32 * 订单编号
27 33 */
28 34 @ApiModelProperty("订单编号")
... ...
... ... @@ -5,6 +5,7 @@
5 5 <resultMap id="PurchaseOrderInfo" type="com.lframework.xingyun.sc.entity.PurchaseOrderInfo">
6 6 <id column="id" property="id"/>
7 7 <result column="contract_id" property="contractId"/>
  8 + <result column="replenishment_order_id" property="replenishmentOrderId"/>
8 9 <result column="order_no" property="orderNo"/>
9 10 <result column="supply_unit" property="supplyUnit"/>
10 11 <result column="ordering_unit" property="orderingUnit"/>
... ... @@ -52,6 +53,7 @@
52 53 SELECT
53 54 tb.id,
54 55 tb.contract_id,
  56 + tb.replenishment_order_id,
55 57 tb.order_no,
56 58 tb.supply_unit,
57 59 tb.ordering_unit,
... ...