Browse Source

srm推送预装箱单调整

fenghaifu 6 days ago
parent
commit
06b3066fca

+ 49 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java

@@ -33,6 +33,7 @@ import org.hibernate.engine.jdbc.Size;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem;
+import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetails;
 import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
 import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo;
@@ -2535,6 +2536,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
     public RespUpdateVO srmAdd(@RequestBody SyPreAssembledPackingList syPreAssembledPackingList) {
         RespUpdateVO respUpdateVO = new RespUpdateVO();
         respUpdateVO.setSuccess(false);
+        log.info("SRM推送\t{}", syPreAssembledPackingList);
         if (!srmAccessToken.equals(syPreAssembledPackingList.getAccessToken())){
             respUpdateVO.setMessage("认证失败,请联系管理员");
             return respUpdateVO;
@@ -2544,6 +2546,53 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                 respUpdateVO.setMessage("请先填好信息再提交");
                 return respUpdateVO;
             }
+            // 从size中获取出运明细id
+            List<String> shippingDetailsItemIdList = new ArrayList<>();
+            List<SyPreAssembledPackingListItem> itemList = syPreAssembledPackingList.getSyPreAssembledPackingListItemList();
+            itemList.forEach(item -> {
+                item.getSizeTables().forEach(s->{
+                    shippingDetailsItemIdList.add(s.getItemId());
+                });
+            });
+            List<SyPreAssembledPackingListItem> srmPushExtraList = syPreAssembledPackingListItemService.getSrmPushExtraList(shippingDetailsItemIdList);
+            if (srmPushExtraList.size() == 0){
+                log.error("查找出运明细失败");
+                respUpdateVO.setMessage("查找出运明细失败");
+                return respUpdateVO;
+            }
+            // 赋值
+            SyPreAssembledPackingListItem item = srmPushExtraList.get(0);
+            syPreAssembledPackingList.setOrderNumber(item.getOrderNumber());
+            syPreAssembledPackingList.setCustomer(item.getCustomerName());
+            syPreAssembledPackingList.setGarmentFactory(item.getGarmentFactory());
+            syPreAssembledPackingList.setCustomerAbbreviation(item.getCustomerAbbreviation());
+            syPreAssembledPackingList.setElementsId(item.getElementsId());
+            syPreAssembledPackingList.setOmpoId(item.getOmpoId());
+            syPreAssembledPackingList.setIsExcel(0);
+            syPreAssembledPackingList.setIsTc(item.getIsTc());
+            syPreAssembledPackingList.setTotalPrice(syPreAssembledPackingList.getTotal().multiply(item.getUnitPrice()));
+            for (SyPreAssembledPackingListItem syPreAssembledPackingListItem : itemList){
+                SizeTable sizeTable = syPreAssembledPackingListItem.getSizeTables().get(0);
+                SyPreAssembledPackingListItem findExtraInfo = srmPushExtraList.stream().filter(e->e.getSyDeclarationElementsItemId().equals(sizeTable.getItemId())).findFirst().orElse(null);
+                if (srmPushExtraList.size() == 0){
+                    log.error("查找出运明细失败:\t{}",sizeTable);
+                    respUpdateVO.setMessage("查找出运明细失败");
+                    return respUpdateVO;
+                }
+                syPreAssembledPackingListItem.setAcSetNo(findExtraInfo.getAcSetNo());
+                syPreAssembledPackingListItem.setGarmentFactory(findExtraInfo.getGarmentFactory());
+                syPreAssembledPackingListItem.setUnitPrice(findExtraInfo.getUnitPrice());
+                syPreAssembledPackingListItem.setWithCode(findExtraInfo.getWithCode());
+                syPreAssembledPackingListItem.setSyOrderDataItemId(findExtraInfo.getSyOrderDataItemId());
+                syPreAssembledPackingListItem.setSyOrderDataId(findExtraInfo.getSyOrderDataId());
+                syPreAssembledPackingListItem.setOmpoIdItem(findExtraInfo.getOmpoIdItem());
+                syPreAssembledPackingListItem.setOmpoId(findExtraInfo.getOmpoId());
+                syPreAssembledPackingListItem.setOrderNumber(findExtraInfo.getOrderNumber());
+                syPreAssembledPackingListItem.setRemainingQuantity(findExtraInfo.getRemainingQuantity());
+                syPreAssembledPackingListItem.setSalesman(findExtraInfo.getSalesman());
+                syPreAssembledPackingListItem.setSalesDepartment(findExtraInfo.getSalesDepartment());
+                syPreAssembledPackingListItem.setCustomsDeclarationUnitPrice(findExtraInfo.getCustomsDeclarationUnitPrice());
+            }
             syPreAssembledPackingList=syPreAssembledPackingListService.saveMain2(syPreAssembledPackingList);
             respUpdateVO.setMessage(syPreAssembledPackingList.getId());
             respUpdateVO.setSuccess(true);

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingListItem.java

@@ -584,4 +584,18 @@ public class SyPreAssembledPackingListItem implements Serializable {
 		}
 	}
 
+	/** srm 推单用到 **/
+	// 客户全称
+	@TableField(exist = false)
+	private String customerName;
+	// 客户简称
+	@TableField(exist = false)
+	private String customerAbbreviation;
+	// 申报要素id
+	@TableField(exist = false)
+	private String elementsId;
+	// 是否tc
+	@TableField(exist = false)
+	private String isTc;
+
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/SyPreAssembledPackingListItemMapper.java

@@ -64,4 +64,11 @@ public interface SyPreAssembledPackingListItemMapper extends BaseMapper<SyPreAss
 
 //	@DS("multi-for")
 //    List<SyPreAssembledPackingListItem> selectById2(String id);
+
+	/**
+	 * 根据发运明细子表ID获取SRM推送预装箱单时需要的数据
+	 * @param shippingDetailsItemIdList
+	 * @return
+	 */
+	List<SyPreAssembledPackingListItem> getSrmPushExtraList(@Param("shippingDetailsItemIdList")List<String> shippingDetailsItemIdList);
 }

+ 10 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListItemMapper.xml

@@ -445,7 +445,7 @@
 		and del_flag=0
 	</select>
 	<!-- SRM推送时信息查询-->
-	<select id="selectSrmPushExtraList" parameterType="java.lang.String" resultType="org.jeecg.modules.spapl.entity.SyPreAssembledPackingListItem">
+	<select id="getSrmPushExtraList" parameterType="java.lang.String" resultType="org.jeecg.modules.spapl.entity.SyPreAssembledPackingListItem">
 		select * from (
 		  SELECT
 			  a.id as sy_declaration_elements_item_id,
@@ -463,12 +463,20 @@
 			  a.order_remaining_quantity as remaining_Quantity,
 			  a.sales_department,
 			  a.salesman,
-			  a.customs_declaration_unit_price
+			  a.customs_declaration_unit_price,
+		  	  a.customer_name,
+		  	  a.customer_abbreviation,
+		  	  a.elements_id,
+		  	  a.is_tc
 		  FROM
 			  sy_shipping_details_item a
 				  left join sy_order_data b on a.sy_order_data_id=b.id
 				  left join sy_order_data_item c on a.sy_order_data_item_id=c.id
 		) as t1
+		where sy_declaration_elements_item_id in
+		<foreach collection="shippingDetailsItemIdList" item="value" index="index" open="(" separator="," close=")">
+			#{value}
+		</foreach>
 	</select>
 
 </mapper>

+ 13 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/service/impl/SyPreAssembledPackingListItemServiceImpl.java

@@ -14,6 +14,8 @@ import java.util.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import javax.annotation.Resource;
+
 /**
  * @Description: 预装箱单子表
  * @Author: jeecg-boot
@@ -23,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 @Service
 public class SyPreAssembledPackingListItemServiceImpl extends ServiceImpl<SyPreAssembledPackingListItemMapper, SyPreAssembledPackingListItem> implements ISyPreAssembledPackingListItemService {
 	
-	@Autowired
+	@Resource
 	private SyPreAssembledPackingListItemMapper syPreAssembledPackingListItemMapper;
 	
 	@Override
@@ -210,4 +212,14 @@ public class SyPreAssembledPackingListItemServiceImpl extends ServiceImpl<SyPreA
 		syPreAssembledPackingListItemMapper.insertBatch(entityList);
 		return  true;
 	}
+
+	/**
+	 * 根据发运明细子表ID获取SRM推送预装箱单时需要的数据
+	 * @param shippingDetailsItemIdList
+	 * @return
+	 */
+	@Override
+	public List<SyPreAssembledPackingListItem> getSrmPushExtraList(List<String> shippingDetailsItemIdList){
+		return syPreAssembledPackingListItemMapper.getSrmPushExtraList(shippingDetailsItemIdList);
+	}
 }