|
@@ -21,6 +21,7 @@ import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceTwo;
|
|
|
import org.jeecg.modules.system.util.JsonChangeUtils;
|
|
|
import org.quartz.*;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.context.ApplicationContextAware;
|
|
@@ -133,7 +134,8 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
" LEFT JOIN Customer cc ON s.cCusCode = cc.cCusCode" +
|
|
|
" LEFT JOIN Person pe ON s.cPersonCode = pe.cPersonCode" +
|
|
|
" left join Vendor v on s.cDefine12=v.cVenName" +
|
|
|
- " where s.iStatus = 1 and (s.cCloser is null or s.cCloser='asuser') AND (s.cdefine15 is null or s.cdefine15 !='1' and s.cdefine15 !='2') and dverifydate > "+formattedDate;
|
|
|
+ " where s.iStatus = 1 and (s.cCloser is null or s.cCloser='asuser') AND (s.cdefine15 is null or s.cdefine15 !='1' and s.cdefine15 !='2') and dverifydate > "
|
|
|
+ +formattedDate;
|
|
|
|
|
|
//103的销售订单只取客户是101的
|
|
|
if(account.equals("103")){
|
|
@@ -269,44 +271,151 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
}
|
|
|
}
|
|
|
sy2.setSyOrderDataId(sy.getAccount()+sy2.getSyOrderDataId());
|
|
|
- SyOrderDataVO ordervo = queryOrder(sy2.getId());
|
|
|
- if(ordervo != null){
|
|
|
- sy2.setOmpoAccount(ordervo.getOmpoAccount());
|
|
|
- sy2.setOmpoCode(ordervo.getOmpoCode());
|
|
|
- sy2.setOmpoId(ordervo.getOmpoId());
|
|
|
- sy2.setDArriveDate(ordervo.getDArriveDate());
|
|
|
- sy2.setOmpoIdItem(ordervo.getOmpoIdItem());
|
|
|
- sy2.setITaxPrice(ordervo.getITaxPrice());
|
|
|
+ List<SyOrderDataVO> ordervo = queryOrder(sy2.getId());
|
|
|
+
|
|
|
+ if(ordervo.size()!=0 && ordervo.size() == 1){
|
|
|
+ sy2.setOmpoAccount(ordervo.get(0).getOmpoAccount());
|
|
|
+ sy2.setOmpoCode(ordervo.get(0).getOmpoCode());
|
|
|
+ sy2.setOmpoId(ordervo.get(0).getOmpoId());
|
|
|
+ sy2.setDArriveDate(ordervo.get(0).getDArriveDate());
|
|
|
+ sy2.setOmpoIdItem(ordervo.get(0).getOmpoIdItem());
|
|
|
+ sy2.setITaxPrice(ordervo.get(0).getITaxPrice());
|
|
|
if(sy2.getGuangpeiGateWidth()==null||sy2.getGuangpeiGateWidth().equals("/")||sy2.getGuangpeiGateWidth().equals("")){
|
|
|
- sy2.setGuangpeiGateWidth(ordervo.getGuangpeiGateWidth());
|
|
|
+ sy2.setGuangpeiGateWidth(ordervo.get(0).getGuangpeiGateWidth());
|
|
|
}
|
|
|
- sy2.setSupplier(ordervo.getSupplier());
|
|
|
+ sy2.setSupplier(ordervo.get(0).getSupplier());
|
|
|
if(sy2.getInventoryCcode().substring(0,2).equals("19")){
|
|
|
- sy2.setGarmentFactory(ordervo.getSupplier());
|
|
|
+ sy2.setGarmentFactory(ordervo.get(0).getSupplier());
|
|
|
}/*else if(sy.getCustomerAbbreviation().equals("International Apparel Group") || sy.getCustomerAbbreviation().equals("宁波森语") ) {
|
|
|
sy2.setGarmentFactory(queryGSupplier(sy.getOrderNumber(),sy.getAccount(),sy.getCustomerCode()));
|
|
|
}*/else {
|
|
|
sy2.setGarmentFactory(sy.getGarmentFactory());
|
|
|
}
|
|
|
- sy2.setSupplierCode(ordervo.getSupplierCode());
|
|
|
+ sy2.setSupplierCode(ordervo.get(0).getSupplierCode());
|
|
|
+
|
|
|
+ if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
|
|
|
+ List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
|
|
|
+ if(rsup.size()>0){
|
|
|
+ sy2.setRSupplierCode(rsup.get(0));
|
|
|
+ sy2.setRSupplier(rsup.get(1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(isNewOrder){
|
|
|
+ syOrderDataItemService.save(sy2);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ syItemList.add(sy2);
|
|
|
}else {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
|
|
|
- continue;
|
|
|
- }
|
|
|
- if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
|
|
|
- List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
|
|
|
- if(rsup.size()>0){
|
|
|
- sy2.setRSupplierCode(rsup.get(0));
|
|
|
- sy2.setRSupplier(rsup.get(1));
|
|
|
+ int indexi = 0;
|
|
|
+ for(SyOrderDataVO li:ordervo) {
|
|
|
+
|
|
|
+ sy2.setQuantity(li.getQuantity());//数量
|
|
|
+ sy2.setSurplusNum(li.getQuantity());
|
|
|
+
|
|
|
+ sy2.setOmpoAccount(li.getOmpoAccount());
|
|
|
+ sy2.setOmpoCode(li.getOmpoCode());
|
|
|
+ sy2.setOmpoId(li.getOmpoId());
|
|
|
+ sy2.setDArriveDate(li.getDArriveDate());
|
|
|
+ sy2.setOmpoIdItem(li.getOmpoIdItem());
|
|
|
+ sy2.setITaxPrice(li.getITaxPrice());
|
|
|
+ if(sy2.getGuangpeiGateWidth()==null||sy2.getGuangpeiGateWidth().equals("/")||sy2.getGuangpeiGateWidth().equals("")){
|
|
|
+ sy2.setGuangpeiGateWidth(li.getGuangpeiGateWidth());
|
|
|
+ }
|
|
|
+ sy2.setSupplier(li.getSupplier());
|
|
|
+ if(sy2.getInventoryCcode().substring(0,2).equals("19")){
|
|
|
+ sy2.setGarmentFactory(li.getSupplier());
|
|
|
+ }/*else if(sy.getCustomerAbbreviation().equals("International Apparel Group") || sy.getCustomerAbbreviation().equals("宁波森语") ) {
|
|
|
+ sy2.setGarmentFactory(queryGSupplier(sy.getOrderNumber(),sy.getAccount(),sy.getCustomerCode()));
|
|
|
+ }*/else {
|
|
|
+ sy2.setGarmentFactory(sy.getGarmentFactory());
|
|
|
+ }
|
|
|
+ sy2.setSupplierCode(li.getSupplierCode());
|
|
|
+
|
|
|
+ if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
|
|
|
+ List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
|
|
|
+ if(rsup.size()>0){
|
|
|
+ sy2.setRSupplierCode(rsup.get(0));
|
|
|
+ sy2.setRSupplier(rsup.get(1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ indexi++;
|
|
|
+ SyOrderDataItem syEntity = new SyOrderDataItem();
|
|
|
+ BeanUtils.copyProperties(sy2, syEntity);
|
|
|
+ if(indexi>1 ){
|
|
|
+ syEntity.setId(syEntity.getId()+"-("+indexi+")");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isNewOrder){
|
|
|
+ String item = syOrderDataItemService.queryItemMub(syEntity.getId());
|
|
|
+ if(item!=null && item.equals("已被参照")) {
|
|
|
+ idsID.add(syEntity.getId());
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ if(indexi>1){
|
|
|
+ idsID.add(syEntity.getId());
|
|
|
+ }
|
|
|
+ //更新数据前 删除旧数据防止id冲突
|
|
|
+ syOrderDataItemService.deleteByID(syEntity.getId());
|
|
|
+ }
|
|
|
+ syOrderDataItemService.save(syEntity);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ syItemList.add(syEntity);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
- if(isNewOrder){
|
|
|
- syOrderDataItemService.save(sy2);
|
|
|
- continue;
|
|
|
- }
|
|
|
- syItemList.add(sy2);
|
|
|
+
|
|
|
+
|
|
|
+// if(ordervo != null){
|
|
|
+// sy2.setOmpoAccount(ordervo.getOmpoAccount());
|
|
|
+// sy2.setOmpoCode(ordervo.getOmpoCode());
|
|
|
+// sy2.setOmpoId(ordervo.getOmpoId());
|
|
|
+// sy2.setDArriveDate(ordervo.getDArriveDate());
|
|
|
+// sy2.setOmpoIdItem(ordervo.getOmpoIdItem());
|
|
|
+// sy2.setITaxPrice(ordervo.getITaxPrice());
|
|
|
+// if(sy2.getGuangpeiGateWidth()==null||sy2.getGuangpeiGateWidth().equals("/")||sy2.getGuangpeiGateWidth().equals("")){
|
|
|
+// sy2.setGuangpeiGateWidth(ordervo.getGuangpeiGateWidth());
|
|
|
+// }
|
|
|
+// sy2.setSupplier(ordervo.getSupplier());
|
|
|
+// if(sy2.getInventoryCcode().substring(0,2).equals("19")){
|
|
|
+// sy2.setGarmentFactory(ordervo.getSupplier());
|
|
|
+// }/*else if(sy.getCustomerAbbreviation().equals("International Apparel Group") || sy.getCustomerAbbreviation().equals("宁波森语") ) {
|
|
|
+// sy2.setGarmentFactory(queryGSupplier(sy.getOrderNumber(),sy.getAccount(),sy.getCustomerCode()));
|
|
|
+// }*/else {
|
|
|
+// sy2.setGarmentFactory(sy.getGarmentFactory());
|
|
|
+// }
|
|
|
+// sy2.setSupplierCode(ordervo.getSupplierCode());
|
|
|
+// }else {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
|
|
|
+// List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
|
|
|
+// if(rsup.size()>0){
|
|
|
+// sy2.setRSupplierCode(rsup.get(0));
|
|
|
+// sy2.setRSupplier(rsup.get(1));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if(isNewOrder){
|
|
|
+// syOrderDataItemService.save(sy2);
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// syItemList.add(sy2);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
//处理U8已经删除的数据,单证系统也需要删除
|
|
|
//第一查询改订单下所有行数据
|
|
@@ -509,11 +618,11 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
/*
|
|
|
查询最终供应商数据
|
|
|
*/
|
|
|
- public SyOrderDataVO queryOrder(String orderItemID) throws Exception{
|
|
|
+ public List<SyOrderDataVO> queryOrder(String orderItemID) throws Exception{
|
|
|
SyOrderDataVO syOrderDataVO = new SyOrderDataVO();
|
|
|
syOrderDataVO.setId(orderItemID);
|
|
|
List<Map<String, Object>> listSon = new ArrayList<>();
|
|
|
- SyOrderDataVO result = new SyOrderDataVO();
|
|
|
+ List<SyOrderDataVO> result = new ArrayList<>();
|
|
|
/*
|
|
|
查询账套用于判断
|
|
|
*/
|
|
@@ -545,14 +654,14 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
" om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
|
|
|
" FROM OM_MOMain om" +
|
|
|
" LEFT JOIN OM_MODetails od on om.MOID =od.MOID" +
|
|
|
- " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
|
|
|
+ " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
|
|
|
") p on s.isosid = p.isosid and s.cInvCode = p.cInvCode" +
|
|
|
" left join Vendor v on p.supplierCode=v.cVenCode" +
|
|
|
" where s.autoid ="+syOrderDataVO.getId();
|
|
|
listSon = senYuDataSourceOne.queryForList(sql);
|
|
|
List<JSONObject> jian = JsonChangeUtils.toJSONObject(listSon);
|
|
|
for (JSONObject jsonObject:jian) {
|
|
|
- result = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
|
|
|
+ result.add(JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class));
|
|
|
}
|
|
|
return result;
|
|
|
|
|
@@ -567,7 +676,7 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
" pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
|
|
|
" FROM PO_Pomain pm" +
|
|
|
" LEFT JOIN PO_Podetails pd on pm.POID=pd.POID" +
|
|
|
- " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
|
|
|
+ " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
|
|
|
") p on s.isosid = p.isosid and s.cInvCode = p.cInvCode" +
|
|
|
" left join Vendor v on p.supplierCode=v.cVenCode"+
|
|
|
" where s.autoid ="+syOrderDataVO.getId();
|
|
@@ -577,10 +686,11 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
syOrderDataVO = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
|
|
|
}
|
|
|
if(syOrderDataVO.getSupplier()==null){
|
|
|
- return syOrderDataVO;
|
|
|
+ return result;
|
|
|
}
|
|
|
if(!syOrderDataVO.getSupplier().equals("马菲羊")){
|
|
|
- return syOrderDataVO;
|
|
|
+ result.add(syOrderDataVO);
|
|
|
+ return result;
|
|
|
}
|
|
|
String sql2 = "SELECT" +
|
|
|
" ompoCode,ompoIdItem,ompoId,supplierCode,v.cVenAbbName as supplier,iTaxPrice,dArriveDate,guangpeiGateWidth," +account[2]+" as ompoAccount"+
|
|
@@ -594,21 +704,21 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
" pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
|
|
|
" FROM PO_Pomain pm" +
|
|
|
" LEFT JOIN PO_Podetails pd on pm.POID=pd.POID" +
|
|
|
- " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
|
|
|
+ " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
|
|
|
" UNION" +
|
|
|
" SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem," +
|
|
|
" od.cDefine23 as guangpeiGateWidth,od.dArriveDate,"+
|
|
|
" om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
|
|
|
" FROM OM_MOMain om" +
|
|
|
" LEFT JOIN OM_MODetails od on om.MOID =od.MOID" +
|
|
|
- " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
|
|
|
+ " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
|
|
|
" ) p on s.isosid = p.isosid and s.cInvCode = p.cInvCode" +
|
|
|
" left join Vendor v on p.supplierCode=v.cVenCode"+
|
|
|
" where hy.predid ="+syOrderDataVO.getOmpoIdItem() +" and ss.cSOCode='"+syOrderDataVO.getOmpoCode()+"'";
|
|
|
listSon = senYuDataSourceThree.queryForList(sql2);
|
|
|
List<JSONObject> jian2 = JsonChangeUtils.toJSONObject(listSon);
|
|
|
for (JSONObject jsonObject:jian2) {
|
|
|
- result = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
|
|
|
+ result.add(JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class));
|
|
|
}
|
|
|
return result;
|
|
|
|
|
@@ -623,21 +733,21 @@ public class AddOrderJob implements Job,ApplicationContextAware {
|
|
|
" pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
|
|
|
" FROM PO_Pomain pm" +
|
|
|
" LEFT JOIN PO_Podetails pd on pm.POID=pd.POID" +
|
|
|
- " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
|
|
|
+ " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
|
|
|
" UNION" +
|
|
|
" SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem," +
|
|
|
" od.cDefine23 as guangpeiGateWidth,od.dArriveDate,"+
|
|
|
" om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
|
|
|
" FROM OM_MOMain om" +
|
|
|
" LEFT JOIN OM_MODetails od on om.MOID =od.MOID" +
|
|
|
- " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
|
|
|
+ " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
|
|
|
") p on s.isosid = p.isosid and s.cInvCode = p.cInvCode" +
|
|
|
" left join Vendor v on p.supplierCode=v.cVenCode"+
|
|
|
" where s.autoid ="+syOrderDataVO.getId();
|
|
|
listSon = senYuDataSourceThree.queryForList(sql);
|
|
|
List<JSONObject> jian = JsonChangeUtils.toJSONObject(listSon);
|
|
|
for (JSONObject jsonObject:jian) {
|
|
|
- result = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
|
|
|
+ result.add(JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class));
|
|
|
}
|
|
|
return result;
|
|
|
|