|
@@ -132,9 +132,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
entity.setTotalPrice(entity.getActualDeclaredQuantity().multiply(entity.getPrice()));//实际报关数量*单价
|
|
|
if((entity.getInventoryCode().indexOf("03")!=-1&&!entity.getInventoryCode().equals("0399")) ||
|
|
|
(entity.getInventoryCode().indexOf("04")!=-1&&!entity.getInventoryCode().equals("0499"))){
|
|
|
- if(entity!=null&&entity.getMasterMetering().equals("KG")){//当单位为KG时
|
|
|
+ if(entity.getMasterMetering()!=null&&entity.getMasterMetering().equals("KG")){//当单位为KG时
|
|
|
entity.setTotalPrice(entity.getNetWeight().multiply(entity.getPrice()));//净重*单价
|
|
|
- }else if(entity!=null&&entity.getMasterMetering().equals("M")){
|
|
|
+ }else if(entity.getMasterMetering()!=null&&entity.getMasterMetering().equals("M")){
|
|
|
entity.setTotalPrice(entity.getMeter().multiply(entity.getPrice()));//净重*单价
|
|
|
}
|
|
|
}
|
|
@@ -290,7 +290,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
//@Override
|
|
|
//@Scheduled(fixedRate=1000*60*300)
|
|
|
//@Transactional
|
|
|
- public void getU8Data2() {
|
|
|
+ public void getU8Data3() {
|
|
|
SimpleDateFormat sf= new SimpleDateFormat("yyMMdd");
|
|
|
try{
|
|
|
QueryWrapper<DxpDataPlan> queryWrapper = new QueryWrapper<>();
|
|
@@ -703,31 +703,31 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
@Override
|
|
|
@DS("multi-one")
|
|
|
- public void one(SyPackingListFabric main, Map<String, Object> map) {
|
|
|
- saveBatch(main,map);
|
|
|
+ public String one(SyPackingListFabric main, Map<String, Object> map) {
|
|
|
+ return saveBatch(main,map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@DS("multi-two")
|
|
|
- public void two(SyPackingListFabric main, Map<String, Object> map) {
|
|
|
- saveBatch(main,map);
|
|
|
+ public String two(SyPackingListFabric main, Map<String, Object> map) {
|
|
|
+ return saveBatch(main,map);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@DS("multi-three")
|
|
|
- public void three(SyPackingListFabric main, Map<String, Object> map) {
|
|
|
- saveBatch(main,map);
|
|
|
+ public String three(SyPackingListFabric main, Map<String, Object> map) {
|
|
|
+ return saveBatch(main,map);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- Map<String,Object> saveBatch(SyPackingListFabric main,Map<String,Object> mapt){
|
|
|
+ String saveBatch(SyPackingListFabric main,Map<String,Object> mapt){
|
|
|
mapt.put("customerCode","xxx");//进入方法时设置客户编码为空
|
|
|
if(main==null){
|
|
|
- return new HashMap();//为空就传回空对象
|
|
|
+ return "";//为空就传回空对象
|
|
|
}
|
|
|
JSONArray mapList=new JSONArray();
|
|
|
- //JSONArray mapList2=new JSONArray();
|
|
|
+ JSONArray mapList2=new JSONArray();
|
|
|
JSONArray mapList3=new JSONArray();
|
|
|
JSONArray mapList4=new JSONArray();
|
|
|
JSONArray mapList5=new JSONArray();
|
|
@@ -749,12 +749,13 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
map.put("CMAKER",createBy);//制单人
|
|
|
map.put("cVouchType",1);//传1
|
|
|
|
|
|
- /* JSONObject map2=new JSONObject();//材料出库单
|
|
|
+ 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("DDATE",createDate);//日期(格式2015-01-01)
|
|
|
map2.put("CHANDLER",createBy);//审核人
|
|
|
+ map2.put("CRDCODE","22");//暂时设置成默认 Rd_Style有相关数据
|
|
|
map2.put("CMAKER",createBy);//制单人
|
|
|
- map2.put("cOrderCode",main.getOrderNumber());//销售订单号*/
|
|
|
+ map2.put("cOrderCode",main.getOrderNumber());//销售订单号
|
|
|
|
|
|
JSONObject map3=new JSONObject();//销售发货单
|
|
|
map3.put("CVOUCHCODE",org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cDLCode","DispatchList","dcreatesystime")));//发货单号
|
|
@@ -782,7 +783,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
map6.put("CMAKER",createBy);//制单人名称
|
|
|
|
|
|
JSONArray mapItems=new JSONArray();
|
|
|
- //JSONArray mapItems2=new JSONArray();
|
|
|
+ JSONArray mapItems2=new JSONArray();
|
|
|
JSONArray mapItems3=new JSONArray();
|
|
|
JSONArray mapItems4=new JSONArray();
|
|
|
JSONArray mapItems5=new JSONArray();
|
|
@@ -797,7 +798,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
map4.put("CGLTYPE","销售发货单");//来源单据类型
|
|
|
map5.put("CGLTYPE","委外订单");//来源单据类型
|
|
|
map6.put("CGLTYPE","销售出库单");//来源单据类型
|
|
|
- //map2.put("CRDCODE","委外出库");//出库类别
|
|
|
+ map2.put("CGLTYPE","委外出库");//出库类别
|
|
|
}else {//查询采购订单表数据
|
|
|
if(mapt.get("orderNumber").equals("one")){
|
|
|
orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("mpOrder")+"'","POID");//委外订单号判断
|
|
@@ -809,7 +810,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
map4.put("CGLTYPE","销售发货单");//来源单据类型
|
|
|
map5.put("CGLTYPE","采购订单");//来源单据类型
|
|
|
map6.put("CGLTYPE","销售出库单");//来源单据类型
|
|
|
- //map2.put("CRDCODE","采购出库");//出库类别
|
|
|
+ map2.put("CGLTYPE","采购出库");//出库类别
|
|
|
}
|
|
|
if(orderData!=null){
|
|
|
map.put("CVENCODE",orderData.get("cvencode"));//供应商编码
|
|
@@ -819,7 +820,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
}
|
|
|
for (SyPackingListFabricItem item : main.getSyPackingListFabricItem()){
|
|
|
JSONObject mapItem=new JSONObject();
|
|
|
- //JSONObject mapItem2=new JSONObject();
|
|
|
+ JSONObject mapItem2=new JSONObject();
|
|
|
JSONObject mapItem3=new JSONObject();
|
|
|
JSONObject mapItem4=new JSONObject();
|
|
|
JSONObject mapItem5=new JSONObject();
|
|
@@ -827,7 +828,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
|
|
|
map.put("CACCID",mapt.get("account"));//账套号
|
|
|
- //map2.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"));//账套号
|
|
@@ -864,14 +865,23 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
}else{//委外订单子表数据 顺序---2
|
|
|
//第二次怎么获取采购订单的子表id 查询销售订单子表保存行号去绑定上游的账套
|
|
|
orderDataItem=syPackingListTailoringMapper.getOmOrPoItem("OM_MODetails", "MODetailsID='"+item.getOmpoIdItem()+"'","MODetailsID");
|
|
|
+ System.out.println("orderDataItem\n"+orderDataItem);
|
|
|
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)*/
|
|
|
+
|
|
|
+ getcFree(mapItem2,orderDataItem2);
|
|
|
+ System.out.println("orderDataItem2\n"+orderDataItem2);
|
|
|
+ Map<String,Object> orderDataItem3 =syPackingListFabricMapper.getOM_MOMaterials(orderDataItem2);//委外订单子表
|
|
|
+ System.out.println("orderDataItem3\n"+orderDataItem3);
|
|
|
+ System.out.println("orderDataItem3\t"+orderDataItem3.size());
|
|
|
+ /*for (Map<String,Object> stringObjectMap : orderDataItem3){
|
|
|
+ mapItem2.put("AUTOID_ALL",stringObjectMap.get("MOMaterialsID"));//关联明细ID
|
|
|
+ }*/
|
|
|
+ mapItem2.put("ALLCAUTOIDCOL","MOMaterialsID");//订单明细ID对应字段名(固定MOMaterialsID) MOMaterialsID
|
|
|
mapItem5.put("POAUTOIDCOL","MODetailsID");//明细ID对应字段名(关联单据类型为采购订单传ID,委外订单传MODetailsID,入库单为Autoid)
|
|
|
mapItem5.put("AUTOID_PO",orderDataItem.get("id"));//明细ID(采购订单行ID/委外订单行ID)
|
|
|
mapItem5.put("IORITAXCOST",orderDataItem.get("iTaxPrice"));//原币单价
|
|
@@ -882,7 +892,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
String wheCode=syPackingListTailoringMapper.getWhCodeByVenCode(mapt.get("CVENCODE").toString());
|
|
|
if(wheCode!=null){
|
|
|
map.put("CWHCODE",wheCode);//仓库编码
|
|
|
- // map2.put("CWHCODE",wheCode);//仓库编码
|
|
|
+ map2.put("CWHCODE",wheCode);//仓库编码
|
|
|
map4.put("CWHCODE",wheCode);//仓库编码
|
|
|
mapItem3.put("CWHCODE",wheCode);//仓库编码 这个是子表需要字段
|
|
|
mapItem6.put("CWHCODE",wheCode);//仓库编码
|
|
@@ -908,9 +918,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
mapt.put("customerCode",order.get("cCusCode"));//客户编码
|
|
|
if(order!=null){//销售订单主表
|
|
|
//cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,nflat
|
|
|
- /*map2.put("CDEPCODE",order.get("cDepCode"));//部门编码(如果传空,取来源单据)
|
|
|
+ map2.put("CDEPCODE",order.get("cDepCode"));//部门编码(如果传空,取来源单据)
|
|
|
map2.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,接口默认人民币)
|
|
|
- map2.put("CPERSONCODE",order.get("cPersonCode"));//业务员编码(如果传空,取来源单据)*/
|
|
|
+ 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"));//币种名称(如果传空,传来源单据;无来源单据,默认人民币)
|
|
@@ -931,8 +941,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
//mapItem.put("cBatch","x");//批号
|
|
|
|
|
|
- /*mapItem2.put("CINVCODE",item.getInventoryCode());//存货编码(如果来源单据是委外订单,此字段需要传该订单的子件编码)
|
|
|
- mapItem2.put("IQUANTITY",item.getTotal());//数量*/
|
|
|
+ mapItem2.put("CINVCODE",item.getInventoryCode());//存货编码(如果来源单据是委外订单,此字段需要传该订单的子件编码)
|
|
|
+ mapItem2.put("IQUANTITY",item.getActualDeclaredQuantity());//数量
|
|
|
|
|
|
mapItem3.put("CINVCODE",item.getInventoryCode());//存货编码
|
|
|
mapItem3.put("IQUANTITY",item.getActualDeclaredQuantity());//数量
|
|
@@ -952,7 +962,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
|
|
|
mapItems.add(mapItem);
|
|
|
- //mapItems2.add(mapItem2);
|
|
|
+ mapItems2.add(mapItem2);
|
|
|
mapItems3.add(mapItem3);
|
|
|
mapItems4.add(mapItem4);
|
|
|
mapItems5.add(mapItem5);
|
|
@@ -961,8 +971,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
map.put("DETAILList",mapItems);//明细集合
|
|
|
mapList.add(map);
|
|
|
- /* map2.put("DETAILList",mapItems2);//明细集合
|
|
|
- mapList2.add(map2);*/
|
|
|
+ map2.put("DETAILList",mapItems2);//明细集合
|
|
|
+ mapList2.add(map2);
|
|
|
map3.put("DETAILList",mapItems3);//明细集合
|
|
|
mapList3.add(map3);
|
|
|
map4.put("DETAILList",mapItems4);//明细集合
|
|
@@ -981,6 +991,17 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
}
|
|
|
mapt.put("itemSort",mapSort);
|
|
|
}
|
|
|
+
|
|
|
+ if(true){
|
|
|
+ text(mapList,"采购入库单");
|
|
|
+ text(mapList2,"核销出库单");
|
|
|
+ text(mapList3,"销售发货单");
|
|
|
+ text(mapList4,"销售出库单");
|
|
|
+ text(mapList5,"采购发票单");
|
|
|
+ text(mapList6,"销售发票单");
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
text(mapList,"采购入库单");
|
|
|
text(mapList3,"销售发货单");
|
|
|
text(mapList5,"采购发票单");
|
|
@@ -1057,7 +1078,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发票单
|
|
|
recording(main,recording);
|
|
|
}
|
|
|
- return mapt;
|
|
|
+ return account+"账套推送成功!";
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1124,7 +1145,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
recording=result(main,resturn6,"销售发票单",((Map) mapList.get(0)).get("CACCID").toString(),"5");//销售发票单
|
|
|
recording(main,recording);
|
|
|
//this.purchaseWarehousingMapper.updateVoucherHistoryCNumber(org.jeecg.modules.system.util.oConvertUtils.maxNumber(resturn6.getJSONObject(0).get("U8ReceiptNo").toString()),"120");
|
|
|
- return mapt;
|
|
|
+ return mapList.getJSONObject(0).get("CACCID").toString()+"账套推送成功!";
|
|
|
|
|
|
|
|
|
}
|
|
@@ -1144,11 +1165,25 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
public void recording(SyPackingListFabric 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);
|
|
|
+ String[] recordings=syPackingListTailoring.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);
|
|
|
}
|
|
|
+ Map<String,String> map=new HashMap<>();
|
|
|
+ String[] recording2s=recording.split("-");
|
|
|
+ map.put("index",recording2s[1]);
|
|
|
+ map.put("code",recording2s[2]);
|
|
|
+ maps.put(recording2s[0],map);
|
|
|
+ String recording3="";
|
|
|
+ for (String str1 : maps.keySet()){
|
|
|
+ Map<String,String> map1=maps.get(str1);
|
|
|
+ recording3+=str1+"-"+map1.get("index")+"-"+map1.get("code")+",";
|
|
|
+ }
|
|
|
+ syPackingListTailoring.setRecording(recording3.substring(0,recording3.length()-1));//截取最后的逗号
|
|
|
}else{
|
|
|
syPackingListTailoring.setRecording(recording);
|
|
|
}
|
|
@@ -1203,8 +1238,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
|
|
|
//@Override
|
|
|
//@Transactional
|
|
|
- @Scheduled(fixedRate=1000*60*300)
|
|
|
- public void getU8Data(){
|
|
|
+ //@Scheduled(fixedRate=1000*60*3)
|
|
|
+ public void getU8Data2(){
|
|
|
try {
|
|
|
SimpleDateFormat sf = new SimpleDateFormat("yyMMdd");
|
|
|
String[] arrs = syPackingListFabricItemMapper.getu8Data();//获取发运明细已提交的辅料
|
|
@@ -1265,7 +1300,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
"and cInvCCode not like '04%'\n" +
|
|
|
"and cInvCCode not like '19%'\n" +
|
|
|
"and cCusCode='T020001' and\n" +
|
|
|
- " f.AutoID in (" + maps.get(account).toString().substring(1, maps.get(account).toString().length() - 1) + ") ";
|
|
|
+ " f.ID in (" + maps.get(account).toString().substring(1, maps.get(account).toString().length() - 1) + ") ";//查询主表全部拉取
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
if (account.equals("903")) {
|
|
|
list = senYuDataSourceThree.queryForList(sql2);//903
|
|
@@ -1344,7 +1379,6 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
continue;//退出本次循环
|
|
|
}
|
|
|
List<JSONObject> jsonObjects = JsonChangeUtils.toJSONObject(listMain);
|
|
|
- System.out.println("jsonObjects的长度\t" + jsonObjects.size());
|
|
|
//String time=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(System.currentTimeMillis());//获取现在时间
|
|
|
for (JSONObject json : jsonObjects) {
|
|
|
SyPackingListFabric sy = JSONObject.toJavaObject(json, SyPackingListFabric.class);
|
|
@@ -1365,4 +1399,172 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //@Override
|
|
|
+ //@Transactional
|
|
|
+ @Scheduled(fixedRate=1000*60*3)
|
|
|
+ public void getU8Data (){
|
|
|
+ try {
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyMMdd");
|
|
|
+ String[] arrs = syPackingListFabricItemMapper.getu8Data();//获取发运明细已提交的辅料
|
|
|
+ Map<String, List<String>> maps = new HashMap<>();//获取两个账套
|
|
|
+ for (String arr : arrs) {
|
|
|
+ String account = arr.substring(0, 3);
|
|
|
+ String id = arr.substring(3);
|
|
|
+ if (maps.containsKey(account)) {
|
|
|
+ maps.get(account).add(id);
|
|
|
+ } else {
|
|
|
+ maps.put(account, new ArrayList<>());
|
|
|
+ maps.get(account).add(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String account : maps.keySet()) {//分成两类数据
|
|
|
+ //先插主表数据,然后根据主表id查询子表数据再添加
|
|
|
+ String sql ="select \n" +
|
|
|
+ "a.id u8Id, \n" +
|
|
|
+ "f.ID as fId, \n"+
|
|
|
+ "'1' as is_U8_Data, \n" +
|
|
|
+ "a.cMemo memo, \n" +
|
|
|
+ "0 as delflag, \n" +
|
|
|
+ "0 as status, \n" +
|
|
|
+ "a.cMaker createby, \n" +
|
|
|
+ "a.cMaker preparedBy, \n" +
|
|
|
+ "a.cDefine10 exportInvoiceNo, \n" +
|
|
|
+ "a.dnmaketime preparedDate \n" +
|
|
|
+ "from rdrecord32 a \n" +
|
|
|
+ "left JOIN rdrecords32 b\n" +
|
|
|
+ "on a.id=b.id \n" +
|
|
|
+ "left join Inventory c\n" +
|
|
|
+ "on b.cInvCode=c.cInvCode\n" +
|
|
|
+ "LEFT JOIN Person d\n" +
|
|
|
+ "ON d.cPersonCode = a.cPersonCode\n" +
|
|
|
+ "left join ComputationUnit e\n" +
|
|
|
+ "on c.cComunitCode=e.cComunitCode\n" +
|
|
|
+ "left join SO_SODetails f\n" +
|
|
|
+ "on b.iorderdid=f.iSOsID\n" +
|
|
|
+ "where f.ID in (" + maps.get(account).toString().
|
|
|
+ substring(1, maps.get(account).toString().length() - 1) + ") "+
|
|
|
+ "and cMaker!='进出口平台管理员' "+
|
|
|
+ "and (cWhCode='PT0004' "+//面料
|
|
|
+ "or cWhCode='PT0005') "+//辅料
|
|
|
+ "and cCusCode='T020001'" ;//获取所有id
|
|
|
+ List<Map<String, Object>> listMain = new ArrayList<>();
|
|
|
+ if (account.equals("903")) {
|
|
|
+ listMain = senYuDataSourceThree.queryForList(sql);//903
|
|
|
+ } else {
|
|
|
+ listMain = senYuDataSourceTwo.queryForList(sql);//902
|
|
|
+ }
|
|
|
+ if (listMain.size() == 0) {
|
|
|
+ continue;//退出本次循环
|
|
|
+ }
|
|
|
+ List<JSONObject> jsonObjects = JsonChangeUtils.toJSONObject(listMain);
|
|
|
+ for (JSONObject json : jsonObjects) {//子表
|
|
|
+ SyPackingListFabric sy = JSONObject.toJavaObject(json, SyPackingListFabric.class);
|
|
|
+ QueryWrapper<SyPackingListFabric> queryWrapperCount = new QueryWrapper<>();
|
|
|
+ queryWrapperCount.like("create_time", new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis()));//获取今天时间
|
|
|
+ queryWrapperCount.eq("is_U8_Data", "1");//判断为辅料的数据
|
|
|
+ queryWrapperCount.select("lpad(count(0)+1,6,0) as id");
|
|
|
+ String dateNo = "FL" + sf.format(System.currentTimeMillis()) + getOne(queryWrapperCount).getId();//生成辅料单据号
|
|
|
+ sy.setDocumentNo(dateNo);//单据号
|
|
|
+ sy.setDataSource("2");//直接从u8拉取的数据
|
|
|
+ sy.setU8Id(account + sy.getU8Id());
|
|
|
+ sy.setId(sy.getU8Id());
|
|
|
+ // sy.setGarmentFactory(maps3.get(sy.getId()));//获取成衣工厂
|
|
|
+ syPackingListFabricMapper.insert(sy);//添加数据
|
|
|
+ String sql2 = "select " +
|
|
|
+ "b.AutoID as u8id ,\n" +
|
|
|
+ "b.id as u8pid,\n" +
|
|
|
+ "b.id as syPackingListFabricId,\n" +
|
|
|
+ "left(b.csocode,ISNULL(NULLIF(CHARINDEX('-',b.csocode)-1,-1),len(b.csocode))) as planLotNumber,\n" +
|
|
|
+ "b.csocode as orderNumber,\n" +
|
|
|
+ account + " as account,\n" +
|
|
|
+ "0 as delflag,\n" +
|
|
|
+ "f.AutoID as isosid,\n" +
|
|
|
+ "b.iQuantity as inventoryQuantity,\n" +
|
|
|
+ "b.cbMemo as remarks,\n" +
|
|
|
+ "b.cbMemo as memo,\n" +
|
|
|
+ "f.iTaxUnitPrice as price,\n" +
|
|
|
+ "d.cPersonName as salesman,\n" +
|
|
|
+ "b.cDefine22 as itemNumber,\n" +
|
|
|
+ "b.cFree6 as gramWeight,\n" +
|
|
|
+ "b.cFree1 as colour,\n" +
|
|
|
+ "b.cInvCode as inventoryCode,\n" +
|
|
|
+ "c.cInvName as inventoryName,\n" +
|
|
|
+ "c.cInvName as composition,\n" +
|
|
|
+ "b.cFree2 as size ,\n" +
|
|
|
+ "f.cDefine35 as rolls,\n" +
|
|
|
+ "e.cComUnitName as masterMetering,\n" +
|
|
|
+ "b.cFree4 as width,\n" +
|
|
|
+ "c.cInvStd as specificationAndModel\n" +
|
|
|
+ "from rdrecord32 a \n" +
|
|
|
+ "left JOIN rdrecords32 b\n" +
|
|
|
+ "on a.id=b.id \n" +
|
|
|
+ "left join Inventory c\n" +
|
|
|
+ "on b.cInvCode=c.cInvCode\n" +
|
|
|
+ "LEFT JOIN Person d\n" +
|
|
|
+ "ON d.cPersonCode = a.cPersonCode\n" +
|
|
|
+ "left join ComputationUnit e\n" +
|
|
|
+ "on c.cComunitCode=e.cComunitCode\n" +
|
|
|
+ "left join SO_SODetails f\n" +
|
|
|
+ "on b.iorderdid=f.iSOsID\n" +
|
|
|
+ "where " +
|
|
|
+ "cMaker!='进出口平台管理员' "+
|
|
|
+ "and (cWhCode='PT0004' "+//面料
|
|
|
+ "or cWhCode='PT0005') "+//辅料
|
|
|
+ "and cCusCode='T020001' and\n" +
|
|
|
+ " f.ID = "+sy.getFId();//查询主表全部拉取
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+ if (account.equals("903")) {
|
|
|
+ list = senYuDataSourceThree.queryForList(sql2);//903
|
|
|
+ } else {
|
|
|
+ list = senYuDataSourceTwo.queryForList(sql2);//902
|
|
|
+ }
|
|
|
+ List<JSONObject> jianSon = JsonChangeUtils.toJSONObject(list);
|
|
|
+ System.out.println("jianSon的长度\t" + jianSon.size());
|
|
|
+ for (JSONObject json1 : jianSon) {
|
|
|
+ SyPackingListFabricItem sy1 = JSONObject.toJavaObject(json1, SyPackingListFabricItem.class);
|
|
|
+ sy1.setU8Id(account + sy1.getU8Id());//获取账套号+id
|
|
|
+ sy1.setSyPackingListFabricId(account + sy1.getSyPackingListFabricId());//账套号+主表id
|
|
|
+ sy1.setId(sy1.getU8Id());
|
|
|
+ sy1.setIsosid(sy1.getAccount() + sy1.getIsosid());//账套号+销售订单id
|
|
|
+ sy1.setActualDeclaredQuantity(sy1.getInventoryQuantity());//给报关数量赋值
|
|
|
+ sy1.setGroupId(sy1.getOrderNumber() + "-" + sy1.getInventoryCode() + "-" + sy1.getSize());
|
|
|
+
|
|
|
+ QueryWrapper<SyShippingDetailsItem> queryWrapper2 = new QueryWrapper<>();
|
|
|
+ queryWrapper2.eq("sy_order_data_item_id", sy1.getIsosid());
|
|
|
+ queryWrapper2.last("limit 1");
|
|
|
+ SyShippingDetailsItem syShippingDetailsItem = syShippingDetailsItemMapper.selectOne(queryWrapper2);
|
|
|
+ if (syShippingDetailsItem != null) {
|
|
|
+ String elementsId = syShippingDetailsItem.getElementsId();//申报要素id
|
|
|
+ if (oConvertUtils.isNotEmpty(elementsId)) {
|
|
|
+ SyDeclarationElements syDeclarationElements = syDeclarationElementsMapper.selectById(elementsId);
|
|
|
+ if (syDeclarationElements != null) {
|
|
|
+ sy1.setDeclarationName(syDeclarationElements.getDeclarationName());//获取报关品名
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //sy1.setPrice(syShippingDetailsItem.getSalesUnitPrice());//销售单价
|
|
|
+ sy1.setSupplierCodePrintingPlant(syShippingDetailsItem.getSupplierCode());//染厂供应商编码
|
|
|
+ sy1.setSupplierPrintingPlant(syShippingDetailsItem.getSupplierCode());//染厂供应商
|
|
|
+ sy1.setSupplier(syShippingDetailsItem.getSupplier());//供应商编码
|
|
|
+ sy1.setSupplierCode(syShippingDetailsItem.getSupplierCode());//供应商
|
|
|
+ sy1.setSyShippingDetailsId(syShippingDetailsItem.getShippingDetailsId());//出运明细主表id
|
|
|
+ sy1.setSyShippingDetailsItemId(syShippingDetailsItem.getId());//出运明细子表id
|
|
|
+ sy1.setManualYarnUnitPrice(syShippingDetailsItem.getManualYarnUnitPrice());//手册纱单价
|
|
|
+ sy1.setManualYarnFlag(syShippingDetailsItem.getManualYarnFlag());//是否手册纱
|
|
|
+ sy1.setManualYarnProportion(syShippingDetailsItem.getManualYarnProportion());//手册纱占比
|
|
|
+ sy.setGarmentFactory(syShippingDetailsItem.getGarmentFactory());//获取成衣工厂
|
|
|
+ }
|
|
|
+ if(sy1.getPrice()!=null&&sy1.getActualDeclaredQuantity()!=null){
|
|
|
+ sy1.setTotalPrice(sy1.getActualDeclaredQuantity().multiply(sy1.getPrice()));//实际报关数量*单价
|
|
|
+ }
|
|
|
+ syPackingListFabricItemMapper.insert(sy1);//插入新数据
|
|
|
+ }
|
|
|
+ syPackingListFabricMapper.updateById(sy);//添加数据
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|