|
@@ -1,11 +1,13 @@
|
|
|
package org.jeecg.modules.splfi.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
+import org.jeecg.config.InterfaceConnUtils;
|
|
|
import org.jeecg.modules.documents.orderData.entity.SyOrderDataItem;
|
|
|
import org.jeecg.modules.documents.orderData.mapper.SyOrderDataItemMapper;
|
|
|
import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationElements;
|
|
@@ -19,6 +21,7 @@ import org.jeecg.modules.documents.shippingDetails.mapper.SyShippingDetailsItemM
|
|
|
import org.jeecg.modules.documents.shippingDetails.service.impl.SyShippingDetailsItemServiceImpl;
|
|
|
import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrder;
|
|
|
import org.jeecg.modules.openApi.entity.DxpDataPlan;
|
|
|
+import org.jeecg.modules.openApi.mapper.PurchaseWarehousingMapper;
|
|
|
import org.jeecg.modules.openApi.service.IDxpDataPlanService;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
|
|
@@ -33,6 +36,7 @@ import org.jeecg.modules.splfi.mapper.SyPackingListFabricMapper;
|
|
|
import org.jeecg.modules.splfi.service.ISyPackingListFabricService;
|
|
|
import org.jeecg.modules.splt.entity.SyPackingListTailoring;
|
|
|
import org.jeecg.modules.splt.entity.SyPackingListTailoringItem;
|
|
|
+import org.jeecg.modules.splt.mapper.SyPackingListTailoringMapper;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
import org.jeecg.modules.system.util.JsonChangeUtils;
|
|
|
import org.jeecg.modules.system.util.oConvertUtils;
|
|
@@ -43,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
+import java.io.FileWriter;
|
|
|
import java.io.Serializable;
|
|
|
import java.lang.reflect.Array;
|
|
|
import java.math.BigDecimal;
|
|
@@ -116,6 +121,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
entity.setPreDeliveryDate(detailsItem.getPreDeliveryDate());//hod
|
|
|
entity.setOrderNumber(detailsItem.getOrderNumber());//获取订单号
|
|
|
entity.setSmallPo(detailsItem.getSmallPo());//小po
|
|
|
+ entity.setOmpoAccount(detailsItem.getOmpoAccount());
|
|
|
+ entity.setOmpoIdItem(detailsItem.getOmpoIdItem());
|
|
|
+ entity.setOmpoId(detailsItem.getOmpoId());
|
|
|
entity.setInventoryQuantity(entity.getActualDeclaredQuantity());//入库数量=实际报关数量
|
|
|
entity.setDistributionPoint(detailsItem.getDistributionPoint());//分销点
|
|
|
entity.setPurOrSubOrder(detailsItem.getPurOrSubOrder());//采购委外订单号
|
|
@@ -686,6 +694,421 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
return strs;
|
|
|
}
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SyPackingListTailoringMapper syPackingListTailoringMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PurchaseWarehousingMapper purchaseWarehousingMapper;//采购入库表
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void one(List<SyPackingListFabric> mains, Map<String, Object> map) {
|
|
|
+ saveBatch(mains,map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void two(List<SyPackingListFabric> mains, Map<String, Object> map) {
|
|
|
+ saveBatch(mains,map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void three(List<SyPackingListFabric> mains, Map<String, Object> map) {
|
|
|
+ saveBatch(mains,map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,Object> saveBatch(List<SyPackingListFabric> mains,Map<String,Object> mapt){
|
|
|
+ mapt.put("customerCode","xxx");//进入方法时设置客户编码为空
|
|
|
+ if(mains==null||mains.size()==0){
|
|
|
+ return new HashMap();//为空就传回空对象
|
|
|
+ }
|
|
|
+ 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 (SyPackingListFabric main : mains){
|
|
|
+ Map<String,String> mapSort=new HashMap<>();
|
|
|
+
|
|
|
+ String createBy="进出口平台管理员";
|
|
|
+ //String createDate=main.getCreateTime().toString();
|
|
|
+ String createDate=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(main.getCreateTime());//转化日期类型
|
|
|
+ JSONObject map=new JSONObject();//采购(委外)入库单
|
|
|
+ map.put("CVOUCHCODE", org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","RdRecord01","dnmaketime")));//获取单据号
|
|
|
+ map.put("DDATE",createDate);//日期(格式2015-01-01)
|
|
|
+ map.put("CMAKER",createBy);//制单人
|
|
|
+ map.put("cVouchType",1);//传1
|
|
|
+
|
|
|
+ /* JSONObject map2=new JSONObject();//材料出库单
|
|
|
+ map2.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","rdrecord11","dnmaketime")));//单号
|
|
|
+ map2.put("DDATE",main.getCreateTime());//日期(格式2015-01-01)
|
|
|
+ map2.put("CHANDLER",createBy);//审核人
|
|
|
+ map2.put("CMAKER",createBy);//制单人
|
|
|
+ map2.put("cOrderCode",main.getOrderNumber());//销售订单号*/
|
|
|
+
|
|
|
+ JSONObject map3=new JSONObject();//销售发货单
|
|
|
+ map3.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cDLCode","DispatchList","dcreatesystime")));//发货单号
|
|
|
+ map3.put("DDATE",createDate);//发货日期(yyyy-MM-dd)
|
|
|
+ map3.put("BRETURNFLAG","0");//退货标识(1:退货,0:发货)
|
|
|
+ map3.put("CMAKER",createBy);//制单人名称
|
|
|
+ //map3.put("CVERIFIER",createBy);//审核人名称
|
|
|
+
|
|
|
+ JSONObject map4=new JSONObject();//销售出库单
|
|
|
+ map4.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("ccode","rdrecord32","dnmaketime")));//单据号
|
|
|
+ map4.put("DDATE",createDate);//订单日期(格式2015-01-01)
|
|
|
+ map4.put("CHANDLER",createBy);//制单人
|
|
|
+ map4.put("CMAKER",createBy);//制单人
|
|
|
+
|
|
|
+ JSONObject map5=new JSONObject();//采购发票
|
|
|
+ map5.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cpbvcode ","PurBillVouch","cmaketime")));//发票号
|
|
|
+ map5.put("DDATE",createDate);//发票日期(格式2015-01-01)
|
|
|
+ map5.put("CTYPE","普通");//发票类型(01:专用 02:普票)
|
|
|
+ map5.put("CMAKER",createBy);//制单人
|
|
|
+
|
|
|
+ JSONObject map6=new JSONObject();//销售发票
|
|
|
+ map6.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cSBVCode","SaleBillVouch","dcreatesystime")));//发票号
|
|
|
+ map6.put("DDATE",createDate);//发票日期(yyyy-MM-dd)
|
|
|
+ map6.put("CTYPE","普通");//发票类型(普通,专用)
|
|
|
+ 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();
|
|
|
+
|
|
|
+ Map<String,Object> orderData=null;
|
|
|
+
|
|
|
+ if(mapt.get("account").equals("903")){//查询委外订单主表数据 顺序---1
|
|
|
+ orderData=syPackingListTailoringMapper.getOmOrPo("om_momain","cCode='"+mapt.get("mpOrder")+"'","moid");
|
|
|
+ map.put("CRDCODE","委外入库");//入库类别(采购入库/委外入库)
|
|
|
+ map.put("CGLTYPE","委外订单");//来源单据类型
|
|
|
+ map4.put("CGLTYPE","销售发货单");//来源单据类型
|
|
|
+ map5.put("CGLTYPE","委外订单");//来源单据类型
|
|
|
+ map6.put("CGLTYPE","销售出库单");//来源单据类型
|
|
|
+ //map2.put("CRDCODE","委外出库");//出库类别
|
|
|
+ }else {//查询采购订单表数据
|
|
|
+ if(mapt.get("orderNumber").equals("one")){
|
|
|
+ orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("mpOrder")+"'","POID");//委外订单号判断
|
|
|
+ }else{
|
|
|
+ orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("orderNumber")+"'","POID");//根据采购订单号判断
|
|
|
+ }
|
|
|
+ map.put("CRDCODE","采购入库");//入库类别(采购入库/委外入库)
|
|
|
+ map.put("CGLTYPE","采购订单");//来源单据类型
|
|
|
+ map4.put("CGLTYPE","销售发货单");//来源单据类型
|
|
|
+ map5.put("CGLTYPE","采购订单");//来源单据类型
|
|
|
+ map6.put("CGLTYPE","销售出库单");//来源单据类型
|
|
|
+ //map2.put("CRDCODE","采购出库");//出库类别
|
|
|
+ }
|
|
|
+ if(orderData!=null){
|
|
|
+ map.put("CVENCODE",orderData.get("cvencode"));//供应商编码
|
|
|
+ mapt.put("CVENCODE",orderData.get("cvencode"));//供应商编码
|
|
|
+ map5.put("IEXCHRATE",orderData.get("nflat"));//汇率(如果传空,接口默认1)cPayCode
|
|
|
+ map5.put("CPAYCODE",orderData.get("cPayCode"));//付款条件编码(如果传空,取来源单据)
|
|
|
+ }
|
|
|
+ for (SyPackingListFabricItem item : main.getSyPackingListFabricItem()){
|
|
|
+ JSONObject mapItem=new JSONObject();
|
|
|
+ //JSONObject mapItem2=new JSONObject();
|
|
|
+ JSONObject mapItem3=new JSONObject();
|
|
|
+ JSONObject mapItem4=new JSONObject();
|
|
|
+ JSONObject mapItem5=new JSONObject();
|
|
|
+ JSONObject mapItem6=new JSONObject();
|
|
|
+
|
|
|
+
|
|
|
+ map.put("CACCID",mapt.get("account"));//账套号
|
|
|
+ //map2.put("CACCID",mapt.get("account"));//账套号
|
|
|
+ map3.put("CACCID",mapt.get("account"));//账套号
|
|
|
+ map4.put("CACCID",mapt.get("account"));//账套号
|
|
|
+ map5.put("CACCID",mapt.get("account"));//账套号
|
|
|
+ map6.put("CACCID",mapt.get("account"));//账套号
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ Map<String,Object> orderDataItem=null;// inum
|
|
|
+ if(!mapt.get("account").equals("903")){ //采购订单子表数据 顺序---2
|
|
|
+ System.out.println("mapt.get(\"orderNumber\")\n"+mapt.get("orderNumber"));
|
|
|
+ System.out.println("mapt.containsKey(\"itemSort\")\t"+mapt.containsKey("itemSort"));
|
|
|
+ System.out.println("item.getOmpoIdItem()\t"+item.getOmpoIdItem());
|
|
|
+ if(!mapt.containsKey("itemSort")){ //第一次进行循环
|
|
|
+ orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("PO_PoDetails", "ID='"+item.getOmpoIdItem()+"'","ID");
|
|
|
+ }else{
|
|
|
+ if(orderData!=null&&orderData.containsKey("id")){
|
|
|
+ orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("PO_PoDetails", "poid='"+orderData.get("id")+"' and irowno='"+
|
|
|
+ ((Map<String,String>)mapt.get("itemSort")).get(item.getId())+"'","ID");//根据行号获取信息
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(orderDataItem!=null){
|
|
|
+ Map<String,Object> orderDataItem2=purchaseWarehousingMapper.getPOPodetails(orderDataItem.get("id").toString());//获取自由项
|
|
|
+ getcFree(mapItem,orderDataItem2);
|
|
|
+ getcFree(mapItem5,orderDataItem2);
|
|
|
+ mapItem.put("POAUTOIDCOL","ID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
|
|
|
+ mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
|
|
|
+ map5.put("CGLTYPE","采购订单");
|
|
|
+ mapItem5.put("POAUTOIDCOL","ID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
|
|
|
+ mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
|
|
|
+ mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
|
|
|
+ /*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
|
|
|
+ mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
|
|
|
+ }
|
|
|
+ }else{//委外订单子表数据 顺序---2
|
|
|
+ //第二次怎么获取采购订单的子表id 查询销售订单子表保存行号去绑定上游的账套
|
|
|
+ orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("OM_MODetails", "MODetailsID='"+item.getOmpoIdItem()+"'","MODetailsID");
|
|
|
+ Map<String,Object> orderDataItem2=purchaseWarehousingMapper.getOMMoDetails(item.getOmpoIdItem());//获取自由项
|
|
|
+ getcFree(mapItem,orderDataItem2);
|
|
|
+ getcFree(mapItem5,orderDataItem2);
|
|
|
+ mapItem.put("POAUTOIDCOL","MODetailsID");//订单明细ID对应字段名(关联单据类型为采购订单传ID,为采购到货单为Autoid,为委外订单传MODetailsID,为委外到货单为Autoid)
|
|
|
+ mapItem.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
|
|
|
+ map5.put("CGLTYPE","委外订单");
|
|
|
+ /* mapItem2.put("AUTOID_ALL",orderDataItem.get("id"));//关联明细ID
|
|
|
+ mapItem2.put("ALLCAUTOIDCOL","AllocateId");//订单明细ID对应字段名(固定AllocateId)*/
|
|
|
+ mapItem5.put("POAUTOIDCOL","MODetailsID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
|
|
|
+ mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
|
|
|
+ mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
|
|
|
+ /*mapItem5.put("IORIMONEY",orderDataItem.get("iMoney"));//原币金额
|
|
|
+ mapItem5.put("IMONEY",orderDataItem.get("iNatMoney"));//本币金额*/
|
|
|
+ }
|
|
|
+ if(!mapt.get("CVENCODE").equals("one")){//查询供应商表获取编码 顺序---3
|
|
|
+ String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
|
|
|
+ if(wheCode!=null){
|
|
|
+ map.put("CWHCODE",wheCode);//仓库编码
|
|
|
+ // map2.put("CWHCODE",wheCode);//仓库编码
|
|
|
+ map4.put("CWHCODE",wheCode);//仓库编码
|
|
|
+ mapItem3.put("CWHCODE",wheCode);//仓库编码 这个是子表需要字段
|
|
|
+ mapItem6.put("CWHCODE",wheCode);//仓库编码
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mapt.put("poid","one");//重置销售订单id
|
|
|
+
|
|
|
+ //if(item.getSyOrderDataItemId()!=null){//销售发货单 ---查询销售订单子表数据 顺序---5
|
|
|
+ if(orderDataItem!=null&&orderDataItem.containsKey("iSOsID")){
|
|
|
+ Map<String,Object> orderDataItem2=syPackingListTailoringMapper.getSoMainItem(orderDataItem.get("iSOsID").toString());
|
|
|
+ mapSort.put(item.getId(),orderDataItem2.get("irowno").toString());
|
|
|
+ mapItem3.put("ITAXUNITPRICE",orderDataItem2.get("iTaxUnitPrice"));//原币含税单价(如果传空,取来源单据)(以含税单价为准自动计算相关价格及金额)
|
|
|
+ mapItem3.put("ITAXRATE",orderDataItem2.get("iTaxRate"));//税率(如果传空,取来源单据,无来源单据,取存货档案对应的销项税率)
|
|
|
+ mapItem3.put("SOAUTOIDCOL","ISOSID");//来源单据明细ID对应字段名(如果取销售订单主键,需传固定值ISOSID)
|
|
|
+ mapItem3.put("AUTOID_SO",orderDataItem2.get("iSOsID"));//来源单据明细ID
|
|
|
+ mapt.put("poid", orderDataItem2.get("id"));
|
|
|
+ }
|
|
|
+ //}
|
|
|
+
|
|
|
+ if(!mapt.get("poid").equals("one")){//销售订单
|
|
|
+ Map<String,Object> order=syPackingListTailoringMapper.getSoMain(mapt.get("poid").toString());//
|
|
|
+ mapt.put("orderNumber",order.get("cSOCode"));//销售订单号
|
|
|
+ mapt.put("customerCode",order.get("cCusCode"));//客户编码
|
|
|
+ if(order!=null){//销售订单主表
|
|
|
+ //cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,nflat
|
|
|
+ /*map2.put("CDEPCODE",order.get("cDepCode"));//部门编码(如果传空,取来源单据)
|
|
|
+ map2.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,接口默认人民币)
|
|
|
+ map2.put("CPERSONCODE",order.get("cPersonCode"));//业务员编码(如果传空,取来源单据)*/
|
|
|
+ map.put("cOrderCode",order.get("cSOCode"));//销售订单号
|
|
|
+ map3.put("CBUSTYPE",order.get("cBusType"));//业务类型(普通销售、分期付款)(如果传空,取来源单据)
|
|
|
+ map4.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,传来源单据;无来源单据,默认人民币)
|
|
|
+ map6.put("CBUSTYPE",order.get("cBusType"));//业务类型
|
|
|
+ map6.put("CCUSCODE",order.get("cCusCode"));//客户编码
|
|
|
+ map6.put("CDEPCODE",order.get("cDepCode"));//部门编码(如果传空,取来源单据)
|
|
|
+ map6.put("SALETPYECODE",order.get("cSTCode"));//销售类型编码
|
|
|
+ map6.put("IEXCHRATE",order.get("iExchRate"));//IEXCHRATE 汇率
|
|
|
+ map6.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ mapItem.put("CINVCODE",item.getInventoryCode());//存货编码
|
|
|
+ mapItem.put("IQUANTITY",item.getActualDeclaredQuantity());//数量
|
|
|
+ //mapItem.put("INUM",orderDataItem.get("inum"));//明细ID(采购订单行ID/委外订单行ID)
|
|
|
+
|
|
|
+ //mapItem.put("cBatch","x");//批号
|
|
|
+
|
|
|
+ /*mapItem2.put("CINVCODE",item.getInventoryCode());//存货编码(如果来源单据是委外订单,此字段需要传该订单的子件编码)
|
|
|
+ mapItem2.put("IQUANTITY",item.getTotal());//数量*/
|
|
|
+
|
|
|
+ mapItem3.put("CINVCODE",item.getInventoryCode());//存货编码
|
|
|
+ mapItem3.put("IQUANTITY",item.getActualDeclaredQuantity());//数量
|
|
|
+
|
|
|
+ mapItem4.put("CINVCODE",item.getInventoryCode());//存货编码
|
|
|
+ mapItem4.put("IQUANTITY",item.getActualDeclaredQuantity());//数量
|
|
|
+ mapItem4.put("size",item.getSize());//根据尺码判断
|
|
|
+ mapItem4.put("SOAUTOIDCOL","IDLSID");//订单明细ID对应字段名(关联单据类型为发货单IDLSID)
|
|
|
+ //mapItem4.put("AUTOID_SO","10300001");//关联明细ID 测试用先写
|
|
|
+
|
|
|
+ mapItem5.put("CINVCODE",item.getInventoryCode());//存货编码
|
|
|
+ mapItem5.put("IQUANTITY",item.getActualDeclaredQuantity());//数量
|
|
|
+
|
|
|
+ mapItem6.put("CINVCODE",item.getInventoryCode());//存货编码
|
|
|
+ mapItem6.put("IQUANTITY",item.getActualDeclaredQuantity());//数量
|
|
|
+ mapItem6.put("size",item.getSize());//根据尺码判断
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ if(mapt.get("customerCode").equals("0001")&&!mapt.get("account").equals("901")){
|
|
|
+ mapt.put("account","901");//账套号
|
|
|
+ }else if(mapt.get("customerCode").equals("T020001")&&!mapt.get("account").equals("902")){
|
|
|
+ mapt.put("account","902");//账套号
|
|
|
+ }else{
|
|
|
+ mapt.put("account","904");//账套号
|
|
|
+ }
|
|
|
+ mapt.put("itemSort",mapSort);
|
|
|
+ }
|
|
|
+ text(mapList,"采购入库单");
|
|
|
+ text(mapList3,"销售发货单");
|
|
|
+ text(mapList5,"采购发票单");
|
|
|
+ JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");//采购入库单 主表添加了一个字段,子表可能要添加一个字段
|
|
|
+ //JSONArray resturn2 = InterfaceConnUtils.doPost(mapList,"materialout_import");//材料出库单
|
|
|
+ JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");//销售发货单
|
|
|
+ JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");//采购发票单
|
|
|
+
|
|
|
+ result(resturn1,"采购入库单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//采购入库单
|
|
|
+ this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn1.getJSONObject(0).get("U8ReceiptNo").toString()),"107");
|
|
|
+
|
|
|
+ result(resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//销售发货单
|
|
|
+ String u8ReceiptNo103= resturn3.getJSONObject(0).get("U8ReceiptNo").toString();
|
|
|
+ this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(u8ReceiptNo103.substring(u8ReceiptNo103.length()-4 ) ),"108");
|
|
|
+
|
|
|
+
|
|
|
+ result(resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//采购发票单
|
|
|
+ this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
|
|
|
+
|
|
|
+ JSONObject jsonObject3=resturn3.getJSONObject(0);//销售发货单
|
|
|
+ String consignmentName=jsonObject3.get("U8ReceiptNo").toString();//获取销售发货单
|
|
|
+ //String consignmentName= "20220401T00245841";// jsonObject3.get("U8ReceiptNo").toString();//获取销售发货单
|
|
|
+ List<Map<String,Object>> consignmentMaps= syPackingListTailoringMapper.getDispatchLists(consignmentName);
|
|
|
+ if(consignmentMaps!=null){
|
|
|
+ for (Map map : consignmentMaps){
|
|
|
+ JSONObject jsonObject=mapList4.getJSONObject(0);//循环迭代
|
|
|
+ List<Map<String,Object>> mapItems4= (List<Map<String,Object>>) jsonObject.get("DETAILList");
|
|
|
+ for (Map itemMap4 : mapItems4){
|
|
|
+ if(itemMap4.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap4.get("IQUANTITY").toString())
|
|
|
+ ==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap4.containsKey("AUTOID_SO")){//根据尺码判断
|
|
|
+ getcFree((JSONObject) itemMap4,map);
|
|
|
+ itemMap4.put("AUTOID_SO",map.get("iDLsID"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("mapItems4\t"+mapItems4);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ text(mapList4,"销售出库单");
|
|
|
+ JSONArray resturn4 = InterfaceConnUtils.doPost(mapList4,"saleout_import");//
|
|
|
+ result(resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//销售出库单
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject jsonObject4=resturn4.getJSONObject(0);//销售出库单
|
|
|
+ String saleoutName=jsonObject4.get("U8ReceiptNo").toString();//销售出库单
|
|
|
+
|
|
|
+ this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(saleoutName),"131");
|
|
|
+
|
|
|
+ //String saleoutName= "0000005974";// jsonObject4.get("U8ReceiptNo").toString();//获取销售发货单
|
|
|
+ List<Map<String,Object>> saleoutMaps= syPackingListTailoringMapper.getRdrecord32(saleoutName);
|
|
|
+ //System.out.println("saleoutMaps\t"+saleoutMaps);
|
|
|
+ if(saleoutMaps!=null){
|
|
|
+ for (Map map : saleoutMaps){
|
|
|
+ JSONObject jsonObject=mapList6.getJSONObject(0);//循环迭代
|
|
|
+ List<Map<String,Object>> mapItems6= (List<Map<String,Object>>) jsonObject.get("DETAILList");
|
|
|
+ for (Map itemMap6 : mapItems6){
|
|
|
+ itemMap6.put("DISAUTOIDCOL","AUTOID");
|
|
|
+ if(itemMap6.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap6.get("IQUANTITY").toString())
|
|
|
+ ==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap6.containsKey("AUTOID_DIS")){
|
|
|
+ itemMap6.put("AUTOID_DIS",map.get("autoid"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ text(mapList6,"销售发票单");
|
|
|
+ JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");//销售发票单
|
|
|
+ result(resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),mains.get(0).getId());//销售发票单
|
|
|
+ //this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn6.getJSONObject(0).get("U8ReceiptNo").toString()),"120");
|
|
|
+ return mapt;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void text(JSONArray mapList,String tableName){
|
|
|
+ try{
|
|
|
+ String txtWorld="\n"+((Map)mapList.get(0)).get("CACCID")+"\t"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(System.currentTimeMillis())+"\n\n";
|
|
|
+ txtWorld+=mapList.toString()+"\n";
|
|
|
+ FileWriter file =new FileWriter ("D:\\test1\\面辅料-"+tableName+".txt",true);
|
|
|
+ file.write(txtWorld); //以字节数组类型写入内容
|
|
|
+ file.close();
|
|
|
+ System.out.println("已创建test.txt文件,已写入内容");
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void result(JSONArray jsonArray,String tableName ,String account,String id){
|
|
|
+ JSONObject jsonObject=jsonArray.getJSONObject(0);
|
|
|
+ if(jsonObject.get("Result").equals("F")){//获取发货单是否成功添加
|
|
|
+ /*SyPackingListTailoring syPackingListTailoring=syPackingListTailoringMapper.selectById(id);
|
|
|
+ syPackingListTailoring.setRecording(account+"-"+tableName);
|
|
|
+ syPackingListTailoringMapper.updateById(syPackingListTailoring);*/
|
|
|
+ throw new JeecgBootException("报错账套"+account+"接口"+tableName+",原因\t"+ jsonObject.get("Description"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void getcFree(JSONObject itemMap,Map<String,Object> mapPOPodetails){
|
|
|
+ itemMap.put("CDEFINE22",setNull(mapPOPodetails.get("cDefine22")));
|
|
|
+ itemMap.put("CDEFINE23",setNull(mapPOPodetails.get("cDefine23")));
|
|
|
+ itemMap.put("CDEFINE24",setNull(mapPOPodetails.get("cDefine24")));
|
|
|
+ itemMap.put("CDEFINE25",setNull(mapPOPodetails.get("cDefine25")));
|
|
|
+ itemMap.put("CDEFINE26",setNull(mapPOPodetails.get("cDefine26")));
|
|
|
+ itemMap.put("CDEFINE27",setNull(mapPOPodetails.get("cDefine27")));
|
|
|
+ itemMap.put("CDEFINE28",setNull(mapPOPodetails.get("cDefine28")));
|
|
|
+ itemMap.put("CDEFINE29",setNull(mapPOPodetails.get("cDefine29")));
|
|
|
+ itemMap.put("CDEFINE30",setNull(mapPOPodetails.get("cDefine30")));
|
|
|
+ itemMap.put("CDEFINE31",setNull(mapPOPodetails.get("cDefine31")));
|
|
|
+ itemMap.put("CDEFINE32",setNull(mapPOPodetails.get("cDefine32")));
|
|
|
+ itemMap.put("CDEFINE33",setNull(mapPOPodetails.get("cDefine33")));
|
|
|
+ itemMap.put("CDEFINE34",setNull(mapPOPodetails.get("cDefine34")));
|
|
|
+ itemMap.put("CDEFINE35",setNull(mapPOPodetails.get("cDefine35")));
|
|
|
+ itemMap.put("CDEFINE36",setNull(mapPOPodetails.get("cDefine36")));
|
|
|
+ itemMap.put("CDEFINE37",setNull(mapPOPodetails.get("cDefine37")));
|
|
|
+ itemMap.put("CFREE1",setNull(mapPOPodetails.get("cFree1")));
|
|
|
+ itemMap.put("CFREE2",setNull(mapPOPodetails.get("cFree2")));
|
|
|
+ itemMap.put("CFREE3",setNull(mapPOPodetails.get("cFree3")));
|
|
|
+ itemMap.put("CFREE4",setNull(mapPOPodetails.get("cFree4")));
|
|
|
+ itemMap.put("CFREE5",setNull(mapPOPodetails.get("cFree5")));
|
|
|
+ itemMap.put("CFREE6",setNull(mapPOPodetails.get("cFree6")));
|
|
|
+ itemMap.put("CFREE7",setNull(mapPOPodetails.get("cFree7")));
|
|
|
+ itemMap.put("CFREE8",setNull(mapPOPodetails.get("cFree8")));
|
|
|
+ itemMap.put("CFREE9",setNull(mapPOPodetails.get("cFree9")));
|
|
|
+ itemMap.put("CFREE10",setNull(mapPOPodetails.get("cFree10")));
|
|
|
+ }
|
|
|
+ public Object setNull(Object o){
|
|
|
+ if(o==null){
|
|
|
+ return "";
|
|
|
+ }else{
|
|
|
+ return o;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//@Override
|
|
|
//@Transactional
|
|
|
@Scheduled(fixedRate=1000*60*300)
|