|
@@ -600,9 +600,21 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
SyPackingListTailoring syPackingListTailoring=syPackingListTailoringMapper.getMainId(id);
|
|
|
List<SyPackingListTailoringItem> items=syPackingListTailoringItemMapper.queryId(id);
|
|
|
List<SizeTable> size=syPackingListTailoringItemMapper.sizes(syPackingListTailoring.getId());
|
|
|
+ List<SizeTable> sizes=syPackingListTailoringItemMapper.sizeAlls(syPackingListTailoring.getId());
|
|
|
+ Map<String,List<SizeTable>> mapItems=new HashMap<>();
|
|
|
+ for (SizeTable sizeTable : sizes){
|
|
|
+ if(mapItems.containsKey(sizeTable.getGroupId())){
|
|
|
+ mapItems.get(sizeTable.getGroupId()).add(sizeTable);
|
|
|
+ }else{
|
|
|
+ List<SizeTable> sizeTables=new ArrayList<>();
|
|
|
+ sizeTables.add(sizeTable);
|
|
|
+ mapItems.put(sizeTable.getGroupId(),sizeTables);
|
|
|
+ }
|
|
|
+ }
|
|
|
syPackingListTailoring.setSizeTables(size);
|
|
|
for (SyPackingListTailoringItem item : items){
|
|
|
- item.setSizeTables(syPackingListTailoringItemMapper.size(item.getGroupId(),item.getSyPackingListTailoringId()));
|
|
|
+
|
|
|
+ item.setSizeTables(mapItems.get(item.getGroupId()));
|
|
|
}
|
|
|
syPackingListTailoring.setSyPackingListTailoringItemList(items);
|
|
|
long end= System.currentTimeMillis();
|
|
@@ -1934,7 +1946,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
}
|
|
|
|
|
|
|
|
|
- * 采购委外入库单
|
|
|
+ * 采购委外发票
|
|
|
* @param listTailorings
|
|
|
* @param maps
|
|
|
* @return
|
|
@@ -1943,22 +1955,25 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
String message="";
|
|
|
List<String> codes=getList(listTailorings,maps.get("account").toString());
|
|
|
- System.out.println("成衣查看入库单号\t"+codes);
|
|
|
+ System.out.println(maps.get("account")+"账套成衣查看入库单号\t"+codes);
|
|
|
if(codes.size()==0){
|
|
|
return "无可推送数据!";
|
|
|
}
|
|
|
+ String account=maps.get("account").toString();
|
|
|
Map<String,List<String>> customers=getSuppliers(codes);
|
|
|
+ if(account.equals("102")){
|
|
|
+ customers=getSuppliers2(codes);
|
|
|
+ }
|
|
|
Map<String,List<SyPackingListTailoringItem>> listTailoringItemMaps=getListTailoringItemMaps(customers,listTailorings);
|
|
|
Map<String,List<SyPackingListTailoring>> listTailoringMaps=getListTailoringMaps(customers,listTailorings);
|
|
|
Map<String,List<SyPackingListTailoring>> codeMaps=new HashMap<>();
|
|
|
JSONArray jsonArrays1=new JSONArray();
|
|
|
String code=purchaseWarehousingMapper.getMaxCode("cpbvcode ","PurBillVouch","cmaketime");
|
|
|
- String account=maps.get("account").toString();
|
|
|
|
|
|
for (String customer : customers.keySet()){
|
|
|
SyPackingListTailoring syPackingListTailoring=listTailoringMaps.get(customer).get(0);
|
|
|
Map<String, Object> orderData=null;
|
|
|
- if(account.equals("103")||account.equals("101")){
|
|
|
+ if(account.equals("103")||maps.get("account1").toString().equals("101")){
|
|
|
orderData=syPackingListTailoringMapper.getOmOrPo("om_momain",
|
|
|
"cCode=(select top 1 cOrderCode from rdrecord01 where ccode='"+syPackingListTailoring.getRdrecord32Code()+"')","MOID");
|
|
|
}else{
|
|
@@ -2001,18 +2016,25 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
jsonObject1.put("IEXCHRATE",rate.get("nflat").toString());
|
|
|
}
|
|
|
JSONArray jsonArrays=new JSONArray();
|
|
|
+ List<Object> autoIds=new ArrayList<>();
|
|
|
for (SyPackingListTailoringItem item : listTailoringItems){
|
|
|
JSONObject jsonObject=new JSONObject();
|
|
|
jsonObject.put("IQUANTITY",item.getTotal());
|
|
|
jsonObject.put("size",item.getSize());
|
|
|
jsonObject.put("CINVCODE",item.getInventoryCode());
|
|
|
jsonObject.put("CDEFINE28",item.getSmallPo());
|
|
|
- jsonObject.put("DISAUTOIDCOL","DISAUTOIDCOL");
|
|
|
+ jsonObject.put("POAUTOIDCOL","Autoid");
|
|
|
for (Map<String,Object> map : invoices){
|
|
|
if(Double.parseDouble(map.get("iQuantity").toString())==Double.parseDouble(jsonObject.get("IQUANTITY").toString())&&
|
|
|
- map.get("cInvCode").toString().equalsIgnoreCase(item.getInventoryCode())&&map.get("cFree2").equals(item.getSize())){
|
|
|
+ map.get("cInvCode").toString().equalsIgnoreCase(item.getInventoryCode())&&map.get("cFree2").equals(item.getSize())
|
|
|
+ &&jsonObject.get("size").equals(item.getSize()) &&!autoIds.contains(map.get("AutoID"))){
|
|
|
+ autoIds.add(map.get("AutoID"));
|
|
|
jsonObject.put("AUTOID_PO",map.get("AutoID"));
|
|
|
- jsonObject.put("IORITAXCOST",syPackingListTailoringItemMapper.getiTaxPrice(map.get("AutoID").toString()));
|
|
|
+ if(maps.get("account1").toString().equals("101")){
|
|
|
+ jsonObject.put("IORITAXCOST",syPackingListTailoringItemMapper.getiTaxPrice2(map.get("AutoID").toString()));
|
|
|
+ }else{
|
|
|
+ jsonObject.put("IORITAXCOST",syPackingListTailoringItemMapper.getiTaxPrice(map.get("AutoID").toString()));
|
|
|
+ }
|
|
|
getcFree(jsonObject,map);
|
|
|
break;
|
|
|
}
|
|
@@ -2034,36 +2056,47 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
System.out.println("jsonArrays1\n"+jsonArrays1);
|
|
|
text(jsonArrays1,"测试合并推送成衣采购发票");
|
|
|
JSONArray resturnJsonArrays = InterfaceConnUtils.doPost(jsonArrays1,"purinvoice_import");
|
|
|
- Map<String,String> codeMaps2 = result(resturnJsonArrays,"销售发票",account);
|
|
|
+ Map<String,String> codeMaps2 = result(resturnJsonArrays,"采购发票",account);
|
|
|
for (String code1 : codeMaps.keySet()){
|
|
|
List<SyPackingListTailoring> listTailoringList=codeMaps.get(code1);
|
|
|
|
|
|
for (SyPackingListTailoring tailoring : listTailoringList){
|
|
|
|
|
|
if (codeMaps2.get(code1).indexOf("失败")>-1){
|
|
|
- tailoring.setSaleInvoiceError(codeMaps2.get(code1));
|
|
|
+ if(tailoring.getSaleInvoiceError()==null){
|
|
|
+ tailoring.setSaleInvoiceError(codeMaps2.get(code1));
|
|
|
+ }else{
|
|
|
+ tailoring.setSaleInvoiceError(tailoring.getSaleInvoiceError()+";"+codeMaps2.get(code1));
|
|
|
+ }
|
|
|
+
|
|
|
}else{
|
|
|
if(tailoring.getSaleInvoiceCode()==null){
|
|
|
tailoring.setSaleInvoiceCode(codeMaps2.get(code1));
|
|
|
}else{
|
|
|
tailoring.setSaleInvoiceCode(tailoring.getSaleInvoiceCode()+";"+codeMaps2.get(code1));
|
|
|
}
|
|
|
- tailoring.setSaleInvoiceError("");
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return "推送成功";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 銷售發票
|
|
|
+ * @param listTailorings
|
|
|
+ * @param maps
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public String pushInvoices2(List<SyPackingListTailoring> listTailorings,Map<String,Object> maps) {
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
String message="";
|
|
|
List<String> codes=getList2(listTailorings,maps.get("account").toString());
|
|
|
- System.out.println("成衣查看出库单号\t"+codes);
|
|
|
+ System.out.println(maps.get("account")+"账套成衣查看出库单号\t"+codes);
|
|
|
if(codes.size()==0){
|
|
|
return "无可推送数据!";
|
|
|
}
|
|
|
- Map<String,List<String>> customers=getCustomers(codes);
|
|
|
+ Map<String,List<String>> customers=getCustomers(codes,listTailorings);
|
|
|
Map<String,List<SyPackingListTailoringItem>> listTailoringItemMaps=getListTailoringItemMaps(customers,listTailorings);
|
|
|
Map<String,List<SyPackingListTailoring>> listTailoringMaps=getListTailoringMaps(customers,listTailorings);
|
|
|
Map<String,List<SyPackingListTailoring>> codeMaps=new HashMap<>();
|
|
@@ -2121,15 +2154,18 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
jsonObject1.put("IEXCHRATE",rate.get("nflat").toString());
|
|
|
}
|
|
|
JSONArray jsonArrays=new JSONArray();
|
|
|
+ List<Object> autoIds=new ArrayList<>();
|
|
|
for (SyPackingListTailoringItem item : listFabricItems){
|
|
|
JSONObject jsonObject=new JSONObject();
|
|
|
jsonObject.put("IQUANTITY",item.getTotal());
|
|
|
jsonObject.put("size",item.getSize());
|
|
|
jsonObject.put("CINVCODE",item.getInventoryCode());
|
|
|
- jsonObject.put("DISAUTOIDCOL","DISAUTOIDCOL");
|
|
|
+ jsonObject.put("DISAUTOIDCOL","AUTOID");
|
|
|
for (Map<String,Object> map : invoices){
|
|
|
if(Double.parseDouble(map.get("iQuantity").toString())==Double.parseDouble(jsonObject.get("IQUANTITY").toString())&&
|
|
|
- map.get("cInvCode").toString().equalsIgnoreCase(item.getInventoryCode())){
|
|
|
+ map.get("cInvCode").toString().equalsIgnoreCase(item.getInventoryCode()) &&jsonObject.get("size").equals(item.getSize())
|
|
|
+ &&!autoIds.contains(map.get("AutoID"))){
|
|
|
+ autoIds.add(map.get("AutoID"));
|
|
|
jsonObject.put("AUTOID_DIS",map.get("AutoID"));
|
|
|
getcFree(jsonObject,map);
|
|
|
break;
|
|
@@ -2163,14 +2199,18 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
}
|
|
|
for (SyPackingListTailoring tailoring : listTailoringList){
|
|
|
if (codeMaps2.get(code1).indexOf("失败")>-1){
|
|
|
- tailoring.setSaleInvoiceError(codeMaps2.get(code1));
|
|
|
+ if(tailoring.getSaleInvoiceError()==null){
|
|
|
+ tailoring.setSaleInvoiceError(codeMaps2.get(code1));
|
|
|
+ }else{
|
|
|
+ tailoring.setSaleInvoiceError(tailoring.getSaleInvoiceError()+";"+codeMaps2.get(code1));
|
|
|
+ }
|
|
|
}else{
|
|
|
if(tailoring.getSaleInvoiceCode()==null){
|
|
|
tailoring.setSaleInvoiceCode(codeMaps2.get(code1));
|
|
|
}else{
|
|
|
tailoring.setSaleInvoiceCode(tailoring.getSaleInvoiceCode()+";"+codeMaps2.get(code1));
|
|
|
}
|
|
|
- tailoring.setSaleInvoiceError("");
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -2219,7 +2259,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
JSONObject jsonObject=jsonArray.getJSONObject(i);
|
|
|
if(jsonObject.get("Result").equals("F")){
|
|
|
|
|
|
- codeMaps.put(jsonObject.get("ReceiptNo").toString(),pushName+"接口推送失败原因:"+jsonObject.get("Description").toString());
|
|
|
+ codeMaps.put(jsonObject.get("ReceiptNo").toString(),account+"账套"+pushName+"接口推送失败原因:"+jsonObject.get("Description").toString());
|
|
|
}else{
|
|
|
codeMaps.put(jsonObject.get("ReceiptNo").toString(),account+pushName+"接口"+jsonObject.get("U8ReceiptNo").toString());
|
|
|
}
|
|
@@ -2252,30 +2292,68 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
return invoices;
|
|
|
}
|
|
|
|
|
|
- public Map<String,List<String>> getCustomers(List<String> codes){
|
|
|
- List<Map<String,Object>> customers=syPackingListFabricMapper.getCustomers(codes.toArray(new String[codes.size()]));
|
|
|
+
|
|
|
+ * 销售发票
|
|
|
+ * @param codes
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String,List<String>> getCustomers(List<String> codes,List<SyPackingListTailoring> listTailorings){
|
|
|
+
|
|
|
Map<String,List<String>> mapLists=new HashMap<>();
|
|
|
- System.out.println("customers.size\t"+customers.size());
|
|
|
- System.out.println("customers\t"+customers);
|
|
|
for (Map<String,Object> map : customers){
|
|
|
- if(mapLists.containsKey(map.get("cCusCode"))){
|
|
|
- mapLists.get(map.get("cCusCode").toString()).add(map.get("ccode").toString());
|
|
|
+ if(mapLists.containsKey(map.get("cVenCode").toString()+map.get("cPersonCode").toString())){
|
|
|
+ mapLists.get(map.get("cVenCode").toString()+map.get("cPersonCode").toString()).add(map.get("ccode").toString());
|
|
|
}else{
|
|
|
List<String> list=new ArrayList<>();
|
|
|
list.add(map.get("ccode").toString());
|
|
|
- mapLists.put(map.get("cCusCode").toString(),list);
|
|
|
+ mapLists.put(map.get("cVenCode").toString()+map.get("cPersonCode").toString(),list);
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ Map<String,List<String>> mapLists=new HashMap<>();
|
|
|
+ for (SyPackingListTailoring tailoring : listTailorings){
|
|
|
+ if (mapLists.containsKey(tailoring.getSupplier()+tailoring.getSalesman1())){
|
|
|
+ mapLists.get(tailoring.getSupplier()+tailoring.getSalesman1()).add(tailoring.getRdrecord32Code());
|
|
|
+ }else{
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
+ list.add(tailoring.getRdrecord32Code());
|
|
|
+ mapLists.put(tailoring.getSupplier()+tailoring.getSalesman1(),list);
|
|
|
}
|
|
|
}
|
|
|
return mapLists;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * 采购发票
|
|
|
+ * @param codes
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public Map<String,List<String>> getSuppliers(List<String> codes){
|
|
|
- List<Map<String,Object>> suppliers=syPackingListTailoringMapper.getSuppliers(codes.toArray(new String[codes.size()]));
|
|
|
+ List<Map<String,Object>> suppliers=syPackingListTailoringMapper.getSuppliers("rdrecord01",codes.toArray(new String[codes.size()]));
|
|
|
+ Map<String,List<String>> mapLists=new HashMap<>();
|
|
|
+ for (Map<String,Object> map : suppliers){
|
|
|
+ if(mapLists.containsKey(map.get("cVenCode").toString()+map.get("cPersonCode").toString())){
|
|
|
+ mapLists.get(map.get("cVenCode").toString()+map.get("cPersonCode").toString()).add(map.get("ccode").toString());
|
|
|
+ }else{
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
+ list.add(map.get("ccode").toString());
|
|
|
+ mapLists.put(map.get("cVenCode").toString()+map.get("cPersonCode").toString(),list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ System.out.println("mapLists\t"+mapLists);
|
|
|
+ return mapLists;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 采购发票
|
|
|
+ * @param codes
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String,List<String>> getSuppliers2(List<String> codes){
|
|
|
+ List<Map<String,Object>> suppliers=syPackingListTailoringMapper.getSuppliers("rdrecord01",codes.toArray(new String[codes.size()]));
|
|
|
Map<String,List<String>> mapLists=new HashMap<>();
|
|
|
- System.out.println("suppliers.size\t"+suppliers.size());
|
|
|
- System.out.println("suppliers\t"+suppliers);
|
|
|
for (Map<String,Object> map : suppliers){
|
|
|
- if(mapLists.containsKey(map.get("cVenCode"))){
|
|
|
+ if(mapLists.containsKey(map.get("cVenCode").toString())){
|
|
|
mapLists.get(map.get("cVenCode").toString()).add(map.get("ccode").toString());
|
|
|
}else{
|
|
|
List<String> list=new ArrayList<>();
|
|
@@ -2339,7 +2417,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
|
|
|
if(syPackingListFabric.getRecordingCode()!=null){
|
|
|
String [] strs=syPackingListFabric.getRecordingCode().split(";");
|
|
|
for (String str : strs){
|
|
|
- if(str.indexOf(account+"账套销售出库单")>-1&&(syPackingListFabric.getSaleInvoiceCode()==null||syPackingListFabric.getSaleInvoiceCode().indexOf(account+"采购发票")==-1)){
|
|
|
+ if(str.indexOf(account+"账套销售出库单")>-1&&(syPackingListFabric.getSaleInvoiceCode()==null||syPackingListFabric.getSaleInvoiceCode().indexOf(account+"销售发票")==-1)){
|
|
|
ids.add(str.split(":")[1]);
|
|
|
syPackingListFabric.setRdrecord32Code(str.split(":")[1]);
|
|
|
}
|