yzc 2 år sedan
förälder
incheckning
cc3bca3d73

+ 41 - 0
hx-purchase/src/main/java/com/fjhx/purchase/entity/deliver/DeliverGoodsPo.java

@@ -0,0 +1,41 @@
+package com.fjhx.purchase.entity.deliver;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 发货
+ * </p>
+ *
+ * @author 
+ * @since 2023-04-13
+ */
+@Getter
+@Setter
+@TableName("deliver_goods")
+public class DeliverGoodsPo extends BasePo {
+
+    /**
+     * 物流公司编号
+     */
+    private String logisticsCompanyCode;
+
+    /**
+     * 物流单号
+     */
+    private String code;
+
+    /**
+     * 采购单号
+     */
+    private Long purchaseId;
+
+    /**
+     * 状态 0未到货 1到货
+     */
+    private Integer status;
+
+}

+ 9 - 0
hx-purchase/src/main/java/com/fjhx/purchase/service/WdlyService.java

@@ -1,8 +1,17 @@
 package com.fjhx.purchase.service;
 
+import com.fjhx.purchase.entity.deliver.DeliverGoodsPo;
+
 public interface WdlyService {
     /**
      * 修改发货记录为到货
      */
     void updateDeliverGoodsStatus(Long id);
+
+    /**
+     * 获取发货信息
+     *
+     * @return
+     */
+    DeliverGoodsPo getDeliverGoodsInfo(Long id);
 }

+ 16 - 7
hx-purchase/src/main/java/com/fjhx/purchase/service/arrival/impl/ArrivalServiceImpl.java

@@ -19,6 +19,7 @@ import com.fjhx.purchase.entity.arrival.dto.ArrivalSelectDto;
 import com.fjhx.purchase.entity.arrival.po.Arrival;
 import com.fjhx.purchase.entity.arrival.po.ArrivalDetail;
 import com.fjhx.purchase.entity.arrival.vo.ArrivalVo;
+import com.fjhx.purchase.entity.deliver.DeliverGoodsPo;
 import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.entity.purchase.po.PurchaseDetail;
 import com.fjhx.purchase.entity.subscribe.po.Subscribe;
@@ -37,6 +38,7 @@ import com.fjhx.wms.entity.stock.po.StockWait;
 import com.fjhx.wms.entity.stock.po.StockWaitDetails;
 import com.fjhx.wms.service.stock.StockWaitDetailsService;
 import com.fjhx.wms.service.stock.StockWaitService;
+import com.obs.services.internal.ServiceException;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -152,21 +154,29 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
     @DSTransactional
     @Override
     public void addByWdly(Arrival arrival) {
-
         arrival.setCode(CodeEnum.ARRIVAL.getCode());
         this.save(arrival);
 
         //修改采购状态
-        Purchase purchase = new Purchase();
-        purchase.setArrivalStatus(arrival.getArrivalStatus());
-        purchase.setId(arrival.getPurchaseId());
-        purchaseService.updateById(purchase);
+//        Purchase purchase = new Purchase();
+//        purchase.setArrivalStatus(arrival.getArrivalStatus());
+//        purchase.setId(arrival.getPurchaseId());
+//        purchaseService.updateById(purchase);
 
         //创建待入库记录
         String victoriatouristJson = arrival.getVictoriatouristJson();
         JSONObject json = JSONObject.parseObject(victoriatouristJson);
+        Long deliverGoodsId = json.getLong("deliverGoodsId");
+
+        if(ObjectUtil.isEmpty(deliverGoodsId)){
+            throw new ServiceException("发货id不能为空");
+        }
+
+        //查询发货信息 获取 采购id
+        DeliverGoodsPo deliverGoodsInfo = wdlyService.getDeliverGoodsInfo(deliverGoodsId);
+
         //去申购单取入库仓库id
-        PurchaseDetail one = purchaseDetailService.getOne(q -> q.eq(PurchaseDetail::getPurchaseId, arrival.getPurchaseId()));
+        PurchaseDetail one = purchaseDetailService.getOne(q -> q.eq(PurchaseDetail::getPurchaseId, deliverGoodsInfo.getPurchaseId()));
         Long subscribeDetailId = one.getSubscribeDetailId();
         SubscribeDetail byId = subscribeDetailService.getById(subscribeDetailId);
         Subscribe byId1 = subscribeService.getById(byId.getSubscribeId());
@@ -181,7 +191,6 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
         CompanyInfo logisticsCompanyCode = companyInfoService.getOne(q -> q.eq(CompanyInfo::getCode, json.getString("logisticsCompanyCode")));
         json.put("logisticsCompanyName",logisticsCompanyCode.getName());
         //修改发货记录的状态为到货
-        Long deliverGoodsId = json.getLong("deliverGoodsId");
         wdlyService.updateDeliverGoodsStatus(deliverGoodsId);
 
         //----------

+ 1 - 1
hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlowByWdly.java

@@ -99,7 +99,7 @@ public class PurchaseFlowByWdly extends FlowDelegate {
             JSONObject json1 = JSONObject.parseObject(victoriatouristJson1);
             json1.put("receiptWarehouseId",receiptWarehouseId);
             purchase.setVictoriatouristJson(json1.toJSONString());
-            purchaseService.save(purchase);
+            purchaseService.updateById(purchase);
         }
         DynamicDataSourceContextHolder.poll();
         return purchase.getId();

+ 1 - 1
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/po/SupplierInfo.java

@@ -26,7 +26,7 @@ public class SupplierInfo extends BasePo {
     /**
      * 供应商类型 1贸易商 2工厂
      */
-    private Integer type;
+    private String type;
 
     /**
      * 供应商名称

+ 1 - 1
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/entity/order/po/OrderInfo.java

@@ -23,7 +23,7 @@ public class OrderInfo extends BasePo {
     /**
      * 订单类型(1线上 2线下 3京东订单 4补偿 5补发 6线下退换货 7采购退货)
      */
-    private Integer type;
+    private String type;
 
     /**
      * 客户id

+ 13 - 3
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/WdlyServiceImpl.java

@@ -1,20 +1,30 @@
 package com.fjhx.victoriatourist.service;
 
-import cn.hutool.extra.spring.SpringUtil;
+import cn.hutool.core.bean.BeanUtil;
+import com.fjhx.purchase.entity.deliver.DeliverGoodsPo;
 import com.fjhx.purchase.service.WdlyService;
 import com.fjhx.victoriatourist.entity.deliver.po.DeliverGoods;
 import com.fjhx.victoriatourist.service.deliver.DeliverGoodsService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 @Service
 public class WdlyServiceImpl implements WdlyService {
+    @Autowired
+    DeliverGoodsService deliverGoodsService;
+
     /**更新发货记录的状态为到货*/
     @Override
     public void updateDeliverGoodsStatus(Long id) {
-        DeliverGoodsService deliverGoodsService = SpringUtil.getBean(DeliverGoodsService.class);
-
         DeliverGoods byId = deliverGoodsService.getById(id);
         byId.setStatus(1);
         deliverGoodsService.updateById(byId);
     }
+
+    @Override
+    public DeliverGoodsPo getDeliverGoodsInfo(Long id) {
+        DeliverGoods byId = deliverGoodsService.getById(id);
+        DeliverGoodsPo deliverGoodsPo = BeanUtil.copyProperties(byId, DeliverGoodsPo.class);
+        return deliverGoodsPo;
+    }
 }

+ 3 - 2
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockServiceImpl.java

@@ -197,12 +197,13 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
     @Override
     public Page<StockVo> pageByProductSpu(StockSelectDto dto) {
         IWrapper<Stock> wrapper = getWrapper();
-        wrapper.orderByDesc("s", Stock::getId);
         wrapper.eq(Stock::getWarehouseId, dto.getId());
         wrapper.like(Stock::getQuantity, dto.getKeyword());
         wrapper.eq("pi.definition", dto.getDefinition());
-        wrapper.isNotNull("pi.product_spu_id");
+        wrapper.isNotNull("ps.id");
         wrapper.groupBy("pi.product_spu_id");
+        wrapper.orderByDesc("s", Stock::getId);
+
 
         Page<StockVo> page = this.baseMapper.pageByProductSpu(dto.getPage(), wrapper);
         List<StockVo> stockVos = page.getRecords();

+ 1 - 0
hx-wms/src/main/resources/mapper/stock/StockMapper.xml

@@ -51,6 +51,7 @@
             stock s
                 LEFT JOIN bytesailing_item.product_info pi ON s.product_id = pi.id
                 LEFT JOIN bytesailing_item.product_spu ps ON pi.product_spu_id = ps.id
+            ${ew.customSqlSegment}
     </select>
 
 </mapper>