|
@@ -6,6 +6,7 @@ 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 org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
import org.jeecg.config.InterfaceConnUtils;
|
|
@@ -689,14 +690,11 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
return new HashMap();
|
|
|
}
|
|
|
JSONArray mapList=new JSONArray();
|
|
|
-
|
|
|
JSONArray mapList3=new JSONArray();
|
|
|
JSONArray mapList4=new JSONArray();
|
|
|
JSONArray mapList5=new JSONArray();
|
|
|
JSONArray mapList6=new JSONArray();
|
|
|
|
|
|
-
|
|
|
-
|
|
|
JSONArray mapLists=new JSONArray();
|
|
|
|
|
|
if (main!=null){
|
|
@@ -711,13 +709,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
map.put("CMAKER",createBy);
|
|
|
map.put("cVouchType",1);
|
|
|
|
|
|
-
|
|
|
- map2.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cCode","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",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cDLCode","DispatchList","dcreatesystime")));
|
|
|
map3.put("DDATE",createDate);
|
|
@@ -759,7 +750,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
map4.put("CGLTYPE","销售发货单");
|
|
|
map5.put("CGLTYPE","委外订单");
|
|
|
map6.put("CGLTYPE","销售出库单");
|
|
|
-
|
|
|
}else {
|
|
|
if(mapt.get("orderNumber").equals("one")){
|
|
|
orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("mpOrder")+"'","POID");
|
|
@@ -771,7 +761,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
map4.put("CGLTYPE","销售发货单");
|
|
|
map5.put("CGLTYPE","采购订单");
|
|
|
map6.put("CGLTYPE","销售出库单");
|
|
|
-
|
|
|
}
|
|
|
if(orderData!=null){
|
|
|
map.put("CVENCODE",orderData.get("cvencode"));
|
|
@@ -781,7 +770,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
}
|
|
|
for (SyPackingListTailoringItem item : main.getSyPackingListTailoringItemList()){
|
|
|
JSONObject mapItem=new JSONObject();
|
|
|
-
|
|
|
JSONObject mapItem3=new JSONObject();
|
|
|
JSONObject mapItem4=new JSONObject();
|
|
|
JSONObject mapItem5=new JSONObject();
|
|
@@ -789,7 +777,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
|
|
|
|
|
|
map.put("CACCID",mapt.get("account"));
|
|
|
-
|
|
|
map3.put("CACCID",mapt.get("account"));
|
|
|
map4.put("CACCID",mapt.get("account"));
|
|
|
map5.put("CACCID",mapt.get("account"));
|
|
@@ -832,8 +819,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
mapItem.put("POAUTOIDCOL","MODetailsID");
|
|
|
mapItem.put("AUTOID_PO",orderDataItem.get("id"));
|
|
|
map5.put("CGLTYPE","委外订单");
|
|
|
-
|
|
|
- mapItem2.put("ALLCAUTOIDCOL","AllocateId");
|
|
|
mapItem5.put("POAUTOIDCOL","MODetailsID");
|
|
|
mapItem5.put("AUTOID_PO",orderDataItem.get("id"));
|
|
|
mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));
|
|
@@ -844,7 +829,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
|
|
|
if(wheCode!=null){
|
|
|
map.put("CWHCODE",wheCode);
|
|
|
-
|
|
|
map4.put("CWHCODE",wheCode);
|
|
|
mapItem3.put("CWHCODE",wheCode);
|
|
|
mapItem6.put("CWHCODE",wheCode);
|
|
@@ -869,10 +853,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
mapt.put("orderNumber",order.get("cSOCode"));
|
|
|
mapt.put("customerCode",order.get("cCusCode"));
|
|
|
if(order!=null){
|
|
|
-
|
|
|
-
|
|
|
- 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"));
|
|
@@ -885,17 +865,11 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
mapItem.put("CINVCODE",item.getInventoryCode());
|
|
|
mapItem.put("IQUANTITY",item.getTotal());
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
-
|
|
|
- mapItem2.put("IQUANTITY",item.getTotal());
|
|
|
-
|
|
|
mapItem3.put("CINVCODE",item.getInventoryCode());
|
|
|
mapItem3.put("IQUANTITY",item.getTotal());
|
|
|
|
|
@@ -912,9 +886,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
mapItem6.put("IQUANTITY",item.getTotal());
|
|
|
mapItem6.put("size",item.getSize());
|
|
|
|
|
|
-
|
|
|
mapItems.add(mapItem);
|
|
|
-
|
|
|
mapItems3.add(mapItem3);
|
|
|
mapItems4.add(mapItem4);
|
|
|
mapItems5.add(mapItem5);
|
|
@@ -923,8 +895,6 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
|
|
|
map.put("DETAILList",mapItems);
|
|
|
mapList.add(map);
|
|
|
-
|
|
|
- mapList2.add(map2);*/
|
|
|
map3.put("DETAILList",mapItems3);
|
|
|
mapList3.add(map3);
|
|
|
map4.put("DETAILList",mapItems4);
|
|
@@ -943,45 +913,103 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
}
|
|
|
mapt.put("itemSort",mapSort);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- if(true){
|
|
|
- main.setRecording("903-3-1000130,902-2-1000244");
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if(main.getRecording()!=null&&!main.getRecording().equals("")){
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-*/
|
|
|
text(mapList,"采购入库单");
|
|
|
text(mapList3,"销售发货单");
|
|
|
text(mapList5,"采购发票单");
|
|
|
- JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");
|
|
|
-
|
|
|
- JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");
|
|
|
- JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");
|
|
|
|
|
|
- result(resturn1,"采购入库单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());
|
|
|
+ String recording=null;
|
|
|
+ if(main.getRecording()!=null){
|
|
|
+ String[] recordings=main.getRecording().split(",");
|
|
|
+ Map<String,Map<String,String>> maps=new HashMap<>();
|
|
|
+ for (int i=0;i<recordings.length;i++){
|
|
|
+ Map<String,String> map=new HashMap<>();
|
|
|
+ map.put("index",recordings[i].split("-")[1]);
|
|
|
+ map.put("code",recordings[i].split("-")[2]);
|
|
|
+ maps.put(recordings[i].split("-")[0],map);
|
|
|
+ }
|
|
|
+ String account=mapList.getJSONObject(0).get("CACCID").toString();
|
|
|
+ if (maps.containsKey(account)){
|
|
|
+ switch (maps.get(account).get("index")){
|
|
|
+ case "1":
|
|
|
+ JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");
|
|
|
+ recording=result(main,resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),"2");
|
|
|
+ maps.get(account).put("code",resturn3.getJSONObject(0).get("U8ReceiptNo").toString());
|
|
|
+ recording(main,recording);
|
|
|
+ String u8ReceiptNo103= resturn3.getJSONObject(0).get("U8ReceiptNo").toString();
|
|
|
+ this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(u8ReceiptNo103.substring(u8ReceiptNo103.length()-4 ) ),"108");
|
|
|
+ case "2":
|
|
|
+ JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");
|
|
|
+ recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"3");
|
|
|
+ recording(main,recording);
|
|
|
+ this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn5.getJSONObject(0).get("U8ReceiptNo").toString()),"109");
|
|
|
+ case "3":
|
|
|
+ String consignmentName=maps.get(account).get("code");
|
|
|
+ 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");
|
|
|
+ recording=result(main,resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),"4");
|
|
|
+ maps.get(account).put("code",resturn4.getJSONObject(0).get("U8ReceiptNo").toString());
|
|
|
+ recording(main,recording);
|
|
|
+ case "4":
|
|
|
+ String saleoutName=maps.get(account).get("code");
|
|
|
+
|
|
|
+ this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(saleoutName),"131");
|
|
|
+
|
|
|
+ List<Map<String,Object>> saleoutMaps= syPackingListTailoringMapper.getRdrecord32(saleoutName);
|
|
|
+ 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");
|
|
|
+ recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");
|
|
|
+ recording(main,recording);
|
|
|
+ }
|
|
|
+ return mapt;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ JSONArray resturn1 = InterfaceConnUtils.doPost(mapList,"purchasein_import");
|
|
|
+ recording=result(main,resturn1,"采购入库单",((Map) mapList.get(0)).get("CACCID").toString(),"1");
|
|
|
+ recording(main,recording);
|
|
|
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(),main.getId());
|
|
|
+ JSONArray resturn3 = InterfaceConnUtils.doPost(mapList3,"consignment_import");
|
|
|
+ recording=result(main,resturn3,"销售发货单",((Map) mapList.get(0)).get("CACCID").toString(),"2");
|
|
|
+ recording(main,recording);
|
|
|
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(),main.getId());
|
|
|
+ JSONArray resturn5 = InterfaceConnUtils.doPost(mapList5,"purinvoice_import");
|
|
|
+ recording=result(main,resturn5,"采购发票单",((Map) mapList.get(0)).get("CACCID").toString(),"3");
|
|
|
+ recording(main,recording);
|
|
|
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();
|
|
|
-
|
|
|
List<Map<String,Object>> consignmentMaps= syPackingListTailoringMapper.getDispatchLists(consignmentName);
|
|
|
if(consignmentMaps!=null){
|
|
|
for (Map map : consignmentMaps){
|
|
@@ -1000,17 +1028,15 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
|
|
|
text(mapList4,"销售出库单");
|
|
|
JSONArray resturn4 = InterfaceConnUtils.doPost(mapList4,"saleout_import");
|
|
|
- result(resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());
|
|
|
-
|
|
|
+ recording=result(main,resturn4,"销售出库单",((Map) mapList.get(0)).get("CACCID").toString(),"4");
|
|
|
+ recording(main,recording);
|
|
|
|
|
|
JSONObject jsonObject4=resturn4.getJSONObject(0);
|
|
|
String saleoutName=jsonObject4.get("U8ReceiptNo").toString();
|
|
|
|
|
|
this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(saleoutName),"131");
|
|
|
|
|
|
-
|
|
|
List<Map<String,Object>> saleoutMaps= syPackingListTailoringMapper.getRdrecord32(saleoutName);
|
|
|
-
|
|
|
if(saleoutMaps!=null){
|
|
|
for (Map map : saleoutMaps){
|
|
|
JSONObject jsonObject=mapList6.getJSONObject(0);
|
|
@@ -1026,11 +1052,24 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
}
|
|
|
text(mapList6,"销售发票单");
|
|
|
JSONArray resturn6 = InterfaceConnUtils.doPost(mapList6,"saleinvoice_import");
|
|
|
- result(resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),main.getId());
|
|
|
+ recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");
|
|
|
+ recording(main,recording);
|
|
|
|
|
|
return mapt;
|
|
|
}
|
|
|
|
|
|
+ public void recording(SyPackingListTailoring syPackingListTailoring,String recording){
|
|
|
+ if(syPackingListTailoring.getRecording()!=null){
|
|
|
+ if(syPackingListTailoring.getRecording().substring(0,3).equals(recording.substring(0,3))){
|
|
|
+ syPackingListTailoring.setRecording(recording);
|
|
|
+ }else{
|
|
|
+ syPackingListTailoring.setRecording(syPackingListTailoring.getRecording()+","+recording);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ syPackingListTailoring.setRecording(recording);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
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";
|
|
@@ -1044,14 +1083,12 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void result(JSONArray jsonArray,String tableName ,String account,String id){
|
|
|
+ public String result(SyPackingListTailoring main,JSONArray jsonArray,String tableName ,String account,String index){
|
|
|
JSONObject jsonObject=jsonArray.getJSONObject(0);
|
|
|
if(jsonObject.get("Result").equals("F")){
|
|
|
-
|
|
|
- syPackingListTailoring.setRecording(account+"-"+tableName);
|
|
|
- syPackingListTailoringMapper.updateById(syPackingListTailoring);*/
|
|
|
- throw new JeecgBootException("账套"+account+"接口"+tableName+",原因\t"+ jsonObject.get("Description"));
|
|
|
+ throw new JeecgBootException("账套"+account+"接口"+tableName+",原因"+ jsonObject.get("Description"));
|
|
|
}
|
|
|
+ return account+"-"+index+"-"+jsonObject.get("ReceiptNo");
|
|
|
}
|
|
|
|
|
|
public void getcFree(JSONObject itemMap,Map<String,Object> mapPOPodetails){
|