|
@@ -1,10 +1,16 @@
|
|
|
package org.jeecg.modules.splt.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.google.gson.JsonArray;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.config.InterfaceConnUtils;
|
|
|
import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetails;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
|
|
@@ -13,6 +19,7 @@ import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.mapper.SyShippingOrderItemMapper;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.mapper.SyShippingOrderMapper;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.service.ISyShippingOrderService;
|
|
|
+import org.jeecg.modules.openApi.mapper.PurchaseWarehousingMapper;
|
|
|
import org.jeecg.modules.spapl.entity.SizeTable;
|
|
|
import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList;
|
|
|
import org.jeecg.modules.spapl.entity.SyPreAssembledPackingListItem;
|
|
@@ -189,16 +196,25 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
syPackingListTailoring.setDelFlag("0");
|
|
|
syPackingListTailoring.setPushState("0");
|
|
|
syPackingListTailoring.setStatus("0");
|
|
|
- syPackingListTailoring.setDocumentNo(randomStr());
|
|
|
+ syPackingListTailoring.setDocumentNo(randomStr());
|
|
|
+ syPackingListTailoring.setId(null);
|
|
|
syPackingListTailoringMapper.insert(syPackingListTailoring);
|
|
|
Map<String,String> mapId=new HashMap<String, String>();
|
|
|
- for(SyPackingListTailoringItem s1 : items){
|
|
|
+ syPackingListTailoring.setTotal(new BigDecimal("0"));
|
|
|
+ syPackingListTailoring.setTotalBoxes(new BigDecimal("0"));
|
|
|
+ syPackingListTailoring.setTotalVolume(new BigDecimal("0"));
|
|
|
+ syPackingListTailoring.setTotalGrossWeight(new BigDecimal("0"));
|
|
|
+ syPackingListTailoring.setTotalGrossWeight(new BigDecimal("0"));
|
|
|
+ syPackingListTailoring.setTotalPrice(new BigDecimal("0"));
|
|
|
+ for(SyPackingListTailoringItem s1 : items){
|
|
|
+ s1.setId(null);
|
|
|
s1.setSyPackingListTailoringId(syPackingListTailoring.getId());
|
|
|
if(!mapId.containsKey(s1.getGroupId())){
|
|
|
mapId.put(s1.getGroupId(), org.jeecg.modules.system.util.oConvertUtils.getId());
|
|
|
syPackingListTailoring.setTotalBoxes(syPackingListTailoring.getTotalBoxes().add(s1.getBoxNumber()));
|
|
|
}
|
|
|
s1.setGroupId(mapId.get(s1.getGroupId()));
|
|
|
+ syPackingListTailoring.setTotalBoxes(s1.getBoxNumber());
|
|
|
syPackingListTailoring.setTotal(syPackingListTailoring.getTotal().add(s1.getTotal()));
|
|
|
syPackingListTailoring.setTotalNetWeight(syPackingListTailoring.getTotalNetWeight().add(s1.getTotalNetWeight()));
|
|
|
syPackingListTailoring.setTotalGrossWeight(syPackingListTailoring.getTotalGrossWeight().add(s1.getTotalGrossWeight()));
|
|
@@ -592,4 +608,251 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
System.out.println("strs\n"+strs);
|
|
|
return strs;
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseWarehousingMapper purchaseWarehousingMapper;
|
|
|
+
|
|
|
+ @DS("multi-one")
|
|
|
+ public JSONArray one(List<SyPackingListTailoring> mains){
|
|
|
+ return saveBatch(mains );
|
|
|
+ }
|
|
|
+
|
|
|
+ @DS("multi-two")
|
|
|
+ public JSONArray two(List<SyPackingListTailoring> mains){
|
|
|
+ return saveBatch(mains );
|
|
|
+ }
|
|
|
+
|
|
|
+ @DS("multi-three")
|
|
|
+ public JSONArray three(List<SyPackingListTailoring> mains){
|
|
|
+ return saveBatch(mains );
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getOrderDataId(String id){
|
|
|
+ return syPackingListTailoringMapper.getOrderDataId(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONArray saveBatch(List<SyPackingListTailoring> mains ){
|
|
|
+ if(mains==null||mains.size()==0){
|
|
|
+ return new JSONArray();
|
|
|
+ }
|
|
|
+ JSONArray mapList=new JSONArray();
|
|
|
+ JSONArray mapList2=new JSONArray();
|
|
|
+ JSONArray mapList3=new JSONArray();
|
|
|
+ JSONArray mapList4=new JSONArray();
|
|
|
+ JSONArray mapList5=new JSONArray();
|
|
|
+ JSONArray mapList6=new JSONArray();
|
|
|
+
|
|
|
+
|
|
|
+ JSONArray mapLists=new JSONArray();
|
|
|
+
|
|
|
+ for (SyPackingListTailoring main : mains){
|
|
|
+ String createBy="进出口平台管理员";
|
|
|
+ String ompoId="";
|
|
|
+ String orderName="";
|
|
|
+ JSONObject map=new JSONObject();
|
|
|
+ map.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("id+1","RdRecord01","dnmaketime"));
|
|
|
+ map.put("DDATE",main.getCreateTime());
|
|
|
+ map.put("CMAKER",createBy);
|
|
|
+ map.put("cVouchType",1);
|
|
|
+ map.put("cOrderCode",main.getOrderNumber());
|
|
|
+
|
|
|
+ JSONObject map2=new JSONObject();
|
|
|
+ map2.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("ID+1","rdrecord11","dnmaketime"));
|
|
|
+ map2.put("DDATE",main.getCreateTime());
|
|
|
+ map2.put("CHANDLER",createBy);
|
|
|
+ map2.put("CMAKER",createBy);
|
|
|
+ map2.put("cOrderCode",main.getOrderNumber());
|
|
|
+
|
|
|
+ JSONObject map3=new JSONObject();
|
|
|
+ map3.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("DLID+1","DispatchList","dcreatesystime"));
|
|
|
+ map3.put("DDATE",main.getCreateTime());
|
|
|
+ map3.put("BRETURNFLAG","0");
|
|
|
+ map3.put("CMAKER",createBy);
|
|
|
+
|
|
|
+ JSONObject map4=new JSONObject();
|
|
|
+ map4.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("ID+1","rdrecord32","dnmaketime"));
|
|
|
+ map4.put("DDATE",main.getCreateTime());
|
|
|
+ map4.put("CMAKER",createBy);
|
|
|
+
|
|
|
+ JSONObject map5=new JSONObject();
|
|
|
+ map5.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("PBVID+1","PurBillVouch","cmaketime"));
|
|
|
+ map5.put("DDATE",main.getCreateTime());
|
|
|
+ map5.put("CTYPE","x");
|
|
|
+ map5.put("CMAKER",createBy);
|
|
|
+
|
|
|
+ JSONObject map6=new JSONObject();
|
|
|
+ map6.put("CVOUCHCODE",purchaseWarehousingMapper.getMaxCode("SBVID+1","SaleBillVouch","dcreatesystime"));
|
|
|
+ map6.put("DDATE",main.getCreateTime());
|
|
|
+ map6.put("CTYPE","x");
|
|
|
+ map6.put("CMAKER",createBy);
|
|
|
+
|
|
|
+ JSONArray mapItems=new JSONArray();
|
|
|
+ JSONArray mapItems2=new JSONArray();
|
|
|
+ JSONArray mapItems3=new JSONArray();
|
|
|
+ JSONArray mapItems4=new JSONArray();
|
|
|
+ JSONArray mapItems5=new JSONArray();
|
|
|
+ JSONArray mapItems6=new JSONArray();
|
|
|
+
|
|
|
+ if(main.getSyOrderDataId()!=null){
|
|
|
+ Map<String,Object> order=syPackingListTailoringMapper.getSoMain(main.getSyOrderDataId().substring(3));
|
|
|
+ if(order!=null){
|
|
|
+
|
|
|
+ map2.put("CDEPCODE",order.get("cDepCode"));
|
|
|
+ map2.put("CEXCH_NAME",order.get("cexch_name"));
|
|
|
+ map2.put("CPERSONCODE",order.get("cPersonCode"));
|
|
|
+ map3.put("CBUSTYPE",order.get("cBusType"));
|
|
|
+ map4.put("CEXCH_NAME",order.get("cexch_name"));
|
|
|
+ map6.put("CBUSTYPE",order.get("cBusType"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (SyPackingListTailoringItem item : main.getSyPackingListTailoringItemList()){
|
|
|
+ JSONObject mapItem=new JSONObject();
|
|
|
+ JSONObject mapItem2=new JSONObject();
|
|
|
+ JSONObject mapItem3=new JSONObject();
|
|
|
+ JSONObject mapItem4=new JSONObject();
|
|
|
+ JSONObject mapItem5=new JSONObject();
|
|
|
+ JSONObject mapItem6=new JSONObject();
|
|
|
+
|
|
|
+ if(item.getSupplierCode()!=null){
|
|
|
+ map.put("CVENCODE",item.getSupplierCode());
|
|
|
+ String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(item.getSupplierCode());
|
|
|
+ if(wheCode!=null){
|
|
|
+ map.put("CWHCODE",wheCode);
|
|
|
+ map2.put("CWHCODE",wheCode);
|
|
|
+ map4.put("CWHCODE",main.getCreateBy());
|
|
|
+ mapItem3.put("CWHCODE",wheCode);
|
|
|
+ mapItem6.put("CWHCODE",wheCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("CACCID",item.getAcSetNo());
|
|
|
+ map2.put("CACCID",item.getAcSetNo());
|
|
|
+ map3.put("CACCID",item.getAcSetNo());
|
|
|
+ map4.put("CACCID",item.getAcSetNo());
|
|
|
+ map5.put("CACCID",item.getAcSetNo());
|
|
|
+ map6.put("CACCID",item.getAcSetNo());
|
|
|
+
|
|
|
+ if(map.get("cOrderCode")==null){
|
|
|
+ map.put("cOrderCode",item.getOrderNumber());
|
|
|
+ map2.put("cOrderCode",item.getOrderNumber());
|
|
|
+ }
|
|
|
+ ompoId=item.getOmpoId();
|
|
|
+ orderName=item.getSpurOrSubOrder();
|
|
|
+ if(ompoId!=null&&ompoId.length()!=0&&orderName!=null&&orderName.length()!=0&&!map.containsKey("CRDCODE")){
|
|
|
+ Map<String,Object> orderData=null;
|
|
|
+ orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","POID='"+ompoId+"'","cPOID='"+orderName+"'");
|
|
|
+ map.put("CRDCODE","采购入库");
|
|
|
+ map2.put("CRDCODE","采购出库");
|
|
|
+ if(orderData==null){
|
|
|
+ orderData=syPackingListTailoringMapper.getOmOrPo("om_momain","MOID='"+ompoId+"'","cCode='"+orderName+"'");
|
|
|
+ map.put("CRDCODE","委外入库");
|
|
|
+ map2.put("CRDCODE","委外出库");
|
|
|
+ }
|
|
|
+ if(orderData!=null){
|
|
|
+ map5.put("IEXCHRATE",orderData.get("nflat"));
|
|
|
+ map5.put("CPAYCODE",orderData.get("cPayCode"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(map.containsKey("CRDCODE")&&map.get("CRDCODE").equals("采购入库")){
|
|
|
+ mapItem.put("POAUTOIDCOL","ID");
|
|
|
+ }else if(map.containsKey("CRDCODE")&&map.get("CRDCODE").equals("委外入库")){
|
|
|
+ mapItem.put("POAUTOIDCOL","MODetailsID");
|
|
|
+ mapItem2.put("AUTOID_ALL",item.getOmpoIdItem());
|
|
|
+ mapItem2.put("ALLCAUTOIDCOL","AllocateId");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> orderDataItem=null;
|
|
|
+ if(map.get("CRDCODE").equals("采购入库")){
|
|
|
+ orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("PO_PoDetails", "ID='"+item.getOmpoIdItem()+"'");
|
|
|
+ mapItem5.put("POAUTOIDCOL","ID");
|
|
|
+ mapItem5.put("AUTOID_PO",item.getOmpoIdItem());
|
|
|
+ }else{
|
|
|
+ orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("OM_MODetails", "MODetailsID='"+item.getOmpoIdItem()+"'");
|
|
|
+ mapItem5.put("POAUTOIDCOL","MODetailsID");
|
|
|
+ mapItem5.put("AUTOID_PO",item.getOmpoIdItem());
|
|
|
+ }
|
|
|
+ mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));
|
|
|
+ mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));
|
|
|
+
|
|
|
+ if(item.getSyOrderDataItemId()!=null){
|
|
|
+ Map<String,Object> orderDataItem2=syPackingListTailoringMapper.getSoMainItem(item.getSyOrderDataItemId().substring(3));
|
|
|
+ mapItem3.put("ITAXUNITPRICE",orderDataItem2.get("iTaxUnitPrice"));
|
|
|
+ mapItem3.put("ITAXRATE",orderDataItem2.get("iTaxRate"));
|
|
|
+ }
|
|
|
+
|
|
|
+ mapItem.put("CINVCODE",item.getInventoryCode());
|
|
|
+ mapItem.put("IQUANTITY",item.getTotal());
|
|
|
+ mapItem.put("AUTOID_PO",item.getOmpoIdItem());
|
|
|
+ mapItem.put("cBatch","x");
|
|
|
+
|
|
|
+ mapItem2.put("CINVCODE",item.getInventoryCode());
|
|
|
+ mapItem2.put("IQUANTITY",item.getTotal());
|
|
|
+
|
|
|
+ mapItem3.put("CINVCODE",item.getInventoryCode());
|
|
|
+ mapItem3.put("IQUANTITY",item.getTotal());
|
|
|
+ mapItem3.put("SOAUTOIDCOL","ISOSID");
|
|
|
+ mapItem3.put("AUTOID_SO",item.getSyOrderDataItemId());
|
|
|
+
|
|
|
+ mapItem4.put("CINVCODE",item.getInventoryCode());
|
|
|
+ mapItem4.put("IQUANTITY",item.getTotal());
|
|
|
+ mapItem4.put("SOAUTOIDCOL","x");
|
|
|
+ mapItem4.put("AUTOID_PO","x");
|
|
|
+
|
|
|
+ mapItem5.put("CINVCODE",item.getInventoryCode());
|
|
|
+ mapItem5.put("IQUANTITY",item.getTotal());
|
|
|
+
|
|
|
+ mapItem6.put("CINVCODE",item.getInventoryCode());
|
|
|
+ mapItem6.put("IQUNTITY",item.getTotal());
|
|
|
+
|
|
|
+ mapItems.add(mapItem);
|
|
|
+ mapItems2.add(mapItem2);
|
|
|
+ mapItems3.add(mapItem3);
|
|
|
+ mapItems4.add(mapItem4);
|
|
|
+ mapItems5.add(mapItem5);
|
|
|
+ mapItems6.add(mapItem6);
|
|
|
+ }
|
|
|
+
|
|
|
+ map.put("DETAILList",mapItems);
|
|
|
+ mapList.add(map);
|
|
|
+ map2.put("DETAILList",mapItems2);
|
|
|
+ mapList2.add(map2);
|
|
|
+ map3.put("DETAILList",mapItems3);
|
|
|
+ mapList3.add(map3);
|
|
|
+ map4.put("DETAILList",mapItems4);
|
|
|
+ mapList4.add(map4);
|
|
|
+ map5.put("DETAILList",mapItems5);
|
|
|
+ mapList5.add(map5);
|
|
|
+ map6.put("DETAILList",mapItems6);
|
|
|
+ mapList6.add(map6);
|
|
|
+ }
|
|
|
+
|
|
|
+ mapLists.addAll(mapList);
|
|
|
+ mapLists.addAll(mapList2);
|
|
|
+ mapLists.addAll(mapList3);
|
|
|
+ mapLists.addAll(mapList4);
|
|
|
+ mapLists.addAll(mapList5);
|
|
|
+ mapLists.addAll(mapList6);*/
|
|
|
+
|
|
|
+ System.out.println("mapList1\n"+mapList);
|
|
|
+ System.out.println("mapList2\n"+mapList2);
|
|
|
+ System.out.println("mapList3\n"+mapList3);
|
|
|
+ System.out.println("mapList4\n"+mapList4);
|
|
|
+ System.out.println("mapList5\n"+mapList5);
|
|
|
+ System.out.println("mapList6\n"+mapList6);*/
|
|
|
+
|
|
|
+ JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");
|
|
|
+
|
|
|
+ JSONArray resturn3 = InterfaceConnUtils.doPost(mapList,"consignment_import");
|
|
|
+ JSONArray resturn4 = InterfaceConnUtils.doPost(mapList,"saleout_import");
|
|
|
+ JSONArray resturn5 = InterfaceConnUtils.doPost(mapList,"purinvoice_import");
|
|
|
+ JSONArray resturn6 = InterfaceConnUtils.doPost(mapList,"saleinvoice_import");
|
|
|
+
|
|
|
+ System.out.println("调用接口后返回的信息resturn1\n"+resturn1);
|
|
|
+
|
|
|
+ System.out.println("resturn1\n"+resturn3);
|
|
|
+ System.out.println("resturn1\n"+resturn4);
|
|
|
+ System.out.println("resturn1\n"+resturn5);
|
|
|
+ System.out.println("resturn1\n"+resturn6);*/
|
|
|
+
|
|
|
+ return mapLists;
|
|
|
+ }
|
|
|
+}
|