|
@@ -20,6 +20,7 @@ import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceTwo;
|
|
|
import org.jeecg.modules.system.util.JsonChangeUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.BeansException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
@@ -85,11 +86,11 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
String pkorgSplit[] = pkorg.split(",");
|
|
|
|
|
|
|
|
|
- for (String str : pkorgSplit) {
|
|
|
- String pkorgStr = str;
|
|
|
- String pkorgValue[] = pkorgStr.split(":");
|
|
|
-
|
|
|
-
|
|
|
+ if (account != "" && account !=null) {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
String sql = "SELECT " +
|
|
|
"s.ID AS id," +
|
|
@@ -238,44 +239,109 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
}
|
|
|
}
|
|
|
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());
|
|
|
}
|
|
|
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());
|
|
|
+ }
|
|
|
+ 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());
|
|
|
+ }
|
|
|
+
|
|
|
+ syOrderDataItemService.deleteByID(syEntity.getId());
|
|
|
+ }
|
|
|
+ syOrderDataItemService.save(syEntity);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ syItemList.add(syEntity);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
- if(isNewOrder){
|
|
|
- syOrderDataItemService.save(sy2);
|
|
|
- continue;
|
|
|
- }
|
|
|
- syItemList.add(sy2);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -310,12 +376,12 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
senYuDataSourceThree.update(blackWrite);
|
|
|
}
|
|
|
|
|
|
- if(jianMub<1){
|
|
|
- result.setMessage("同步失败,销售订单不符合同步需求!!!");
|
|
|
- return result;
|
|
|
- }else {
|
|
|
- continue;
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -492,11 +558,11 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
|
|
|
查询最终供应商数据
|
|
|
*/
|
|
|
- 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<>();
|
|
|
|
|
|
查询账套用于判断
|
|
|
*/
|
|
@@ -518,14 +584,14 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
对应账套取对应的值
|
|
|
*/
|
|
|
if(account[0].equals(syOrderDataVO.getAccount())){
|
|
|
- String sql = " SELECT" +
|
|
|
+ String sql = " SELECT quantity," +
|
|
|
" ompoCode,ompoIdItem,ompoId,supplierCode,v.cVenAbbName as supplier,iTaxPrice,dArriveDate,guangpeiGateWidth," +account[0]+" as ompoAccount"+
|
|
|
" FROM" +
|
|
|
" SO_SODetails s" +
|
|
|
" left join (" +
|
|
|
" 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" +
|
|
|
+ " om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid,od.iQuantity as quantity " +
|
|
|
" 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')" +
|
|
@@ -535,17 +601,17 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
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;
|
|
|
|
|
|
}else if(account[1].equals(syOrderDataVO.getAccount())){
|
|
|
- String sql = "SELECT" +
|
|
|
+ String sql = "SELECT quantity," +
|
|
|
" ompoCode,ompoIdItem,ompoId,supplierCode,v.cVenAbbName as supplier,iTaxPrice,guangpeiGateWidth,dArriveDate,s.iRowNo as poIrowno," +account[1]+" as ompoAccount"+
|
|
|
" FROM" +
|
|
|
" SO_SODetails s" +
|
|
|
" left join (" +
|
|
|
- " SELECT pm.cPOID as ompoCode,pm.POID as ompoId,pd.id as ompoIdItem,pd.irowno as poIrowno,"+
|
|
|
+ " SELECT pm.cPOID as ompoCode,pm.POID as ompoId,pd.id as ompoIdItem,pd.irowno as poIrowno,pd.iQuantity as quantity,"+
|
|
|
" pd.cDefine23 as guangpeiGateWidth,pd.dArriveDate,"+
|
|
|
" pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
|
|
|
" FROM PO_Pomain pm" +
|
|
@@ -558,28 +624,29 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
List<JSONObject> jian = JsonChangeUtils.toJSONObject(list);
|
|
|
for (JSONObject jsonObject:jian) {
|
|
|
syOrderDataVO = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
|
|
|
+ result.add(syOrderDataVO);
|
|
|
}
|
|
|
if(syOrderDataVO.getSupplier()==null){
|
|
|
- return syOrderDataVO;
|
|
|
+ return result;
|
|
|
}
|
|
|
if(!syOrderDataVO.getSupplier().equals("马菲羊")){
|
|
|
- return syOrderDataVO;
|
|
|
+ return result;
|
|
|
}
|
|
|
- String sql2 = "SELECT" +
|
|
|
+ String sql2 = "SELECT quantity," +
|
|
|
" ompoCode,ompoIdItem,ompoId,supplierCode,v.cVenAbbName as supplier,iTaxPrice,dArriveDate,guangpeiGateWidth," +account[2]+" as ompoAccount"+
|
|
|
" FROM" +
|
|
|
" so_somain ss " +
|
|
|
" join SO_SODetails s on s.id=ss.id" +
|
|
|
" join HY_DZ_K7_SYNERGISMLOGDID hy on voucherno=s.cSOCode and did=s.isosid "+
|
|
|
" left join (" +
|
|
|
- " SELECT pm.cPOID as ompoCode,pm.POID as ompoId,pd.id as ompoIdItem," +
|
|
|
+ " SELECT pm.cPOID as ompoCode,pm.POID as ompoId,pd.id as ompoIdItem,pd.iQuantity as quantity," +
|
|
|
" pd.cDefine23 as guangpeiGateWidth,pd.dArriveDate,"+
|
|
|
" 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')" +
|
|
|
" UNION" +
|
|
|
- " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem," +
|
|
|
+ " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem,od.iQuantity as quantity," +
|
|
|
" od.cDefine23 as guangpeiGateWidth,od.dArriveDate,"+
|
|
|
" om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
|
|
|
" FROM OM_MOMain om" +
|
|
@@ -591,24 +658,24 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
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;
|
|
|
|
|
|
}else if(account[2].equals(syOrderDataVO.getAccount())){
|
|
|
- String sql = "SELECT" +
|
|
|
+ String sql = "SELECT quantity," +
|
|
|
" ompoCode,ompoIdItem,ompoId,supplierCode,v.cVenAbbName as supplier,iTaxPrice,dArriveDate,guangpeiGateWidth," +account[2]+" as ompoAccount"+
|
|
|
" FROM" +
|
|
|
" SO_SODetails s" +
|
|
|
" left join (" +
|
|
|
- " SELECT pm.cPOID as ompoCode,pm.POID as ompoId,pd.id as ompoIdItem," +
|
|
|
+ " SELECT pm.cPOID as ompoCode,pm.POID as ompoId,pd.id as ompoIdItem,pd.iQuantity as quantity," +
|
|
|
" pd.cDefine23 as guangpeiGateWidth,pd.dArriveDate,"+
|
|
|
" 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')" +
|
|
|
" UNION" +
|
|
|
- " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem," +
|
|
|
+ " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem,od.iQuantity as quantity," +
|
|
|
" od.cDefine23 as guangpeiGateWidth,od.dArriveDate,"+
|
|
|
" om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
|
|
|
" FROM OM_MOMain om" +
|
|
@@ -620,7 +687,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
|
|
|
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;
|
|
|
|