|
@@ -226,13 +226,13 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
//如果902销售订单客户 做判断 如果是香港森语 就需要向上追溯(取佣金)
|
|
|
if(sy.getAccount().equals("102") && sy.getCustomerAbbreviation().equals("International Apparel Group")) {
|
|
|
String ymoneySql = "select sosose901.cbdefine2 as ymoney " +
|
|
|
- "from UFDATA_902_2021.dbo.SO_SODetails sosos902 " +
|
|
|
- "left join UFDATA_902_2021.dbo.SO_SOmain soso902 on soso902.id=sosos902.id " +
|
|
|
+ "from UFDATA_102_2021.dbo.SO_SODetails sosos902 " +
|
|
|
+ "left join UFDATA_102_2021.dbo.SO_SOmain soso902 on soso902.id=sosos902.id " +
|
|
|
"left join UFDATA_103_2021.dbo.HY_DZ_K7_SYNERGISMLOGDID HDK on " +
|
|
|
"(HDK.accid='1000000002'and soso902.cCusCode='T020001' ) and hdk.did=sosos902.iSOsID and hdk.cvouchertype='17' " +
|
|
|
- "left join UFDATA_901_2021.dbo.PO_Podetails popos901 on popos901.id=hdk.PreDid " +
|
|
|
- "left join UFDATA_901_2021.dbo.SO_SODetails_extradefine sosose901 on sosose901.iSOsID=popos901.iorderdid " +
|
|
|
- "left join UFDATA_902_2021.dbo.Inventory inv902 on inv902.cInvCode=sosos902.cInvCode " +
|
|
|
+ "left join UFDATA_101_2021.dbo.PO_Podetails popos901 on popos901.id=hdk.PreDid " +
|
|
|
+ "left join UFDATA_101_2021.dbo.SO_SODetails_extradefine sosose901 on sosose901.iSOsID=popos901.iorderdid " +
|
|
|
+ "left join UFDATA_102_2021.dbo.Inventory inv902 on inv902.cInvCode=sosos902.cInvCode " +
|
|
|
"where soso902.cCusCode='T020001' and left(inv902.cInvCCode,2)='19' " +
|
|
|
"and soso902.cSOCode='"+sy.getOrderNumber()+"' and sosos902.AutoID =" + sy2.getId();
|
|
|
List<Map<String, Object>> ymoneyList = new ArrayList<>();
|
|
@@ -250,6 +250,8 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
}
|
|
|
|
|
|
sy2.setId(sy.getAccount()+sy2.getId());
|
|
|
+
|
|
|
+ //查询订单子表数据,这里存在主表数据为true
|
|
|
if(isNewOrder){
|
|
|
String item = syOrderDataItemService.queryItemMub(sy2.getId());
|
|
|
if(item!=null && item.equals("已被参照")){
|
|
@@ -311,7 +313,7 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
for (SyOrderDataItem str : entityList) {
|
|
|
deleteId.add(str.getId());
|
|
|
}
|
|
|
- //比对两个几个的差集,删除deleteId集合不存的ID
|
|
|
+ //比对两个几个的差集,删除deleteId集合不存的ID(这里是U8删除了,单证有多余的数据)
|
|
|
Collection subtract = CollectionUtils.subtract(deleteId, idsID);
|
|
|
for (Object s : subtract) {
|
|
|
//删除没用的数据
|
|
@@ -336,25 +338,37 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
|
- }
|
|
|
- //添加主子表数据进入数据库
|
|
|
- for (SyOrderDataItem sy2:syItemList) {
|
|
|
- syOrderDataItemService.save(sy2);
|
|
|
+
|
|
|
+ //添加主子表数据进入数据库
|
|
|
+ for (SyOrderDataItem sy2:syItemList) {
|
|
|
+ syOrderDataItemService.save(sy2);
|
|
|
+ }
|
|
|
}
|
|
|
if(isNewOrder){
|
|
|
syOrderDataService.updateById(sy);
|
|
|
isNewOrder=false;
|
|
|
- }else {
|
|
|
- syOrderDataService.save(sy);
|
|
|
}
|
|
|
- //回写拉取的数据状态 1
|
|
|
- String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '1' WHERE id='"+syId+"'";
|
|
|
- if(sy.getAccount().equals("101")){
|
|
|
- senYuDataSourceOne.update(blackWrite);
|
|
|
- }else if(sy.getAccount().equals("102")){
|
|
|
- senYuDataSourceTwo.update(blackWrite);
|
|
|
- }else if(sy.getAccount().equals("103")){
|
|
|
- senYuDataSourceThree.update(blackWrite);
|
|
|
+ if(syItemList.size() !=0){
|
|
|
+ syOrderDataService.save(sy);
|
|
|
+ //回写拉取的数据状态 1
|
|
|
+ String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '1' WHERE id='"+syId+"'";
|
|
|
+ if(sy.getAccount().equals("101")){
|
|
|
+ senYuDataSourceOne.update(blackWrite);
|
|
|
+ }else if(sy.getAccount().equals("102")){
|
|
|
+ senYuDataSourceTwo.update(blackWrite);
|
|
|
+ }else if(sy.getAccount().equals("103")){
|
|
|
+ senYuDataSourceThree.update(blackWrite);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //回写拉取的数据状态 1
|
|
|
+ String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '0' WHERE id='"+syId+"'";
|
|
|
+ if(sy.getAccount().equals("101")){
|
|
|
+ senYuDataSourceOne.update(blackWrite);
|
|
|
+ }else if(sy.getAccount().equals("102")){
|
|
|
+ senYuDataSourceTwo.update(blackWrite);
|
|
|
+ }else if(sy.getAccount().equals("103")){
|
|
|
+ senYuDataSourceThree.update(blackWrite);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
dxpDataPlanService.updateLastTime(day,"senYu_syOrder");
|