Bläddra i källkod

预装单推送接口调整

huxy 2 år sedan
förälder
incheckning
c44b627574

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

@@ -412,6 +412,80 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
 
     }
 
+    /**
+     * 推送
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "预装箱单主表-推送2")
+    @ApiOperation(value="预装箱单主表-推送2", notes="预装箱单主表-推送2")
+    @RequestMapping(value = "/push2", method = {RequestMethod.GET})
+    public JSONObject push2(@RequestParam(value = "id",required = true) String id) {
+
+        JSONObject result = new JSONObject();
+        JSONObject  informationJson=null;
+        List<PackingHeaderVo> list=new ArrayList<>();
+        try{
+            if(oConvertUtils.isEmpty(id)){
+                log.warn("id为空值");
+                return null;
+            }
+            //查询IP及账套信息、时间戳
+            QueryWrapper<DxpDataPlan> queryWrapper = new QueryWrapper<>();
+            //获取推送接口地址
+            queryWrapper.eq("code", "senYu_YCY_local").or().eq("code","senYu_YCY_token");
+            queryWrapper.orderBy(true,true,"id");
+            Page<DxpDataPlan> page = new Page<DxpDataPlan>(1, 10);
+            IPage<DxpDataPlan> pageList = iDxpDataPlanService.page(page, queryWrapper);
+            List<DxpDataPlan> resultList = pageList.getRecords();
+
+            PackingHeaderVo vo=syPreAssembledPackingListService.pushData(id);
+            list.add(vo);
+            Gson userGson = new GsonBuilder().create();
+            result.put("payload", userGson.toJson(JSONObject.toJSON(list)));
+            log.info("JSON数据:" + result);
+
+            String url = resultList.get(0).getItemIp() + resultList.get(0).getItemUrl();//拼接url
+
+            String tokenUrl = resultList.get(1).getItemIp()+resultList.get(1).getItemUrl();//获取云工厂token
+
+            if(oConvertUtils.isEmpty(url)||oConvertUtils.isEmpty(tokenUrl)){
+                log.warn("缺少推送接口信息" );
+                return null;
+            }
+            //调用doPost
+            InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
+            //处理返回信息
+            informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "发预装箱单接口-");
+            //获取返回信息
+            JSONObject jsonArray = informationJson.getJSONObject("payload");
+
+            System.out.println("jsonArray\n"+jsonArray);
+            //获取code判断是否成功
+            String code = jsonArray.getString("code");
+            //获取返回消息
+            String message = jsonArray.getString("message");
+
+            SyPreAssembledPackingList syPreAssembledPackingList =   syPreAssembledPackingListService.getById(id);
+            if(code.equals("S")){
+                syPreAssembledPackingList.setPushStatus("1");
+                System.out.println("推送过去了");
+            }else{
+                syPreAssembledPackingList.setPushStatus("2");
+                System.out.println("失败原因:\t"+message);
+                System.out.println("推送失败了");
+            }
+            syPreAssembledPackingListService.updateById(syPreAssembledPackingList);
+            //return informationJson;
+        }catch (Exception ex){
+            ex.printStackTrace();
+            log.error("推送失败:" + ex.getMessage());
+        }
+
+        return  informationJson;
+
+    }
+
     /**
      * 推送测试
      * @param ids

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

@@ -212,6 +212,11 @@
 			gross_Weight AS boxGrossWeight/*毛重/箱*/,
 			total_Gross_Weight AS totalGrossWeight/*总毛重*/,
 			net_Weight_Too AS netNetWeight/*NN.W净净重*/,
+
+			sy_pre_assembled_packing_list_id AS attributeString1/*预装箱单头表id*/,
+			id AS attributeString2/*预装箱单行表id*/,
+			group_id AS attributeString3/*预装箱单分组id*/,
+
 			unit_Price AS unitPrice/*单价*/,
 			total_Price AS totalPrice/*总价*/
 		FROM sy_pre_assembled_packing_list_item

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/mapper/xml/SyPreAssembledPackingListMapper.xml

@@ -118,6 +118,12 @@
         item_number AS styleNo,/*款号*/
         product_Name AS  productName,/*品名*/
         supplier_code supplierNumber, /*供应商编码*/
+
+        id as attributeString1,/*主表id*/
+        order_Number as soNum,/*销售订单号*/
+        container_Code as attributeString2,/*集装箱代号*/
+        elements_Id as attributeString3,/*申报要素id*/
+
         create_By AS preparer/*创建人*/,
         create_Time AS preparationTime/*创建时间*/
     FROM `sy_pre_assembled_packing_list`

+ 12 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/PackingHeaderVo.java

@@ -43,5 +43,17 @@ public class PackingHeaderVo {
     private String  preparationTime;//制单日期
     @ApiModelProperty("采购/委外订单号对应的ID(唯一标识)")
     private String attributeBigint1;//采购/委外订单号对应的ID(唯一标识)
+
+    @ApiModelProperty("预装箱单头表id")
+    private String  attributeString1;//预装箱单头表id
+    @ApiModelProperty("ERP销售订单号")
+    private String  soNum;//ERP销售订单号
+    @ApiModelProperty("集装箱代号")
+    private String  attributeString2;//集装箱代号
+    @ApiModelProperty("申报要素ID")
+    private String  attributeString3;//申报要素ID
+
+
     private List<PackingLineVo> lines;//子表集合
+
 }

+ 13 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/vo/PackingLineVo.java

@@ -98,4 +98,17 @@ public class PackingLineVo {
     private String distribution;//分销点
     @ApiModelProperty("采购/委外订单号对应的ID(唯一标识)")
     private String attributeBigint1;//采购/委外订单号对应的ID(唯一标识)
+
+    @ApiModelProperty("预装箱单头表id")
+    private String attributeString1;//预装箱单头表id
+    @ApiModelProperty("预装箱单行表id")
+    private String attributeString2;//预装箱单行表id
+    @ApiModelProperty("分组groupid")
+    private String attributeString3;//分组groupid
+/*
+ attributeString1
+ attributeString2
+ attributeString3
+*/
+
 }

+ 46 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -7,6 +7,7 @@ import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.documents.orderData.entity.SyOrderDataItem;
+import org.jeecg.modules.documents.orderData.mapper.SyOrderDataItemMapper;
 import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationElements;
 import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationElementsItem;
 import org.jeecg.modules.documents.seclarationElements.mapper.SyDeclarationElementsItemMapper;
@@ -67,6 +68,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	@Autowired
 	private SyDeclarationElementsMapper syDeclarationElementsMapper;
 	@Autowired
+	private SyOrderDataItemMapper syOrderDataItemMapper;
+	@Autowired
 	private ISenYuDataSourceOne senYuDataSourceOne;
 	@Autowired
 	private ISenYuDataSourceTwo senYuDataSourceTwo;
@@ -594,11 +597,53 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			BigDecimal total2=new BigDecimal("0");
 			BigDecimal total3=new BigDecimal("0");
 			String ids="";
+
 			for (SyPackingListFabricItem item :main.getSyPackingListFabricItem()){
+				SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(item.getSyShippingDetailsItemId());//获取物料分类和其他数据
+				//物料分类
+				if(syShippingDetailsItem!=null){//不为null
+					SyOrderDataItem syOrderDataItem=syOrderDataItemMapper.selectById(syShippingDetailsItem.getSyOrderDataItemId());//获取单位
+					item.setInventoryCcode(syShippingDetailsItem.getInventoryCcode());//物料分类
+					item.setPrice(syShippingDetailsItem.getSalesUnitPrice());//价格
+					if(syOrderDataItem!=null){//不为null
+
+						if((item.getInventoryCcode().indexOf("03")!=-1&&!item.getInventoryCcode().equals("0399")) ||
+								(item.getInventoryCcode().indexOf("04")!=-1&&!item.getInventoryCcode().equals("0499"))){//面料
+							//米数计算公式 净重/(门幅/100)/(克重/1000)
+							if(item.getNetWeight()!=null&&item.getGramWeight()!=null&&item.getWidth()!=null){
+								BigDecimal netWeight=item.getNetWeight();//净重
+								BigDecimal gramWeight=new BigDecimal(item.getGramWeight());//克重
+								BigDecimal width=new BigDecimal(item.getWidth());//门幅
+								BigDecimal meter=netWeight.multiply(gramWeight).multiply(width).divide(new BigDecimal("100000"));//米数
+								item.setMeter(meter);//米数
+							}
+
+							if(item!=null&&item.getMasterMetering().equals("KG")){//KG
+								item.setTotalPrice(item.getNetWeight().multiply(item.getPrice()));//净重*单价
+							}else if(item!=null&&item.getMasterMetering().equals("M")){//M
+								item.setTotalPrice(item.getMeter().multiply(item.getPrice()));//米数*单价
+							}else if(item.getActualDeclaredQuantity()!=null){//其他
+								item.setTotalPrice(item.getActualDeclaredQuantity().multiply(item.getPrice()));//米数*单价
+							}else{
+								throw new JeecgBootException("请给单位不为KG或者M的面辅料填上实际报关数量");
+							}
+						}else{////辅料
+							if(item.getActualDeclaredQuantity()!=null){//其他
+								item.setTotalPrice(item.getActualDeclaredQuantity().multiply(item.getPrice()));//米数*单价
+							}else{
+								throw new JeecgBootException("请给单位不为KG或者M的面辅料填上实际报关数量");
+							}
+						}
+
+					}
+				}
+				//单位换算
 				total3=total3.add(item.getActualDeclaredQuantity());
 				ids+=item.getSyShippingDetailsItemId()+",";//获取出运明细子表id
+
 			}
 			if(!ids.equals("")){
+
 				ids=ids.substring(0,ids.length()-1);
 				QueryWrapper queryWrapper=new QueryWrapper();
 				queryWrapper.in("id", Arrays.asList(ids.split(",")));
@@ -688,7 +733,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					"and cInvCCode not like '03%'\n" +
 					"and cInvCCode not like '04%'\n" +
 					"and cInvCCode not like '19%'\n" +
-					"and cCusCode='T020001' and\n" +
+					"and cCusCode='0001' and\n" +
 						" f.AutoID in (" + maps.get(account).toString().substring(1, maps.get(account).toString().length() - 1) + ") ";
 				List<Map<String, Object>> list = new ArrayList<>();
 				if (account.equals("903")) {

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/vo/SyPackingListFabricVo.java

@@ -96,4 +96,9 @@ public class SyPackingListFabricVo {
 	private java.math.BigDecimal excessQuantity;
 	@Excel(name = "实际报关数量", width = 15)
 	private java.math.BigDecimal actualDeclaredQuantity;
+	@ApiModelProperty(value = "外销发票号")
+	private String exportInvoiceNo;
+	/*@ApiModelProperty(value = "集装箱号")
+	private String containerNumber;*/
+
 }