|
|
@@ -49,7 +49,7 @@ public class ERPServiceImpl implements ERPService {
|
|
|
// SpObserver.putSp(master);//没有用
|
|
|
// 执行查询
|
|
|
SqlRowList docMsg = baseDao.queryForRowSet(" select pr_id,pr_code,pr_ycxh,pr_ycxhin,pr_detail,pr_orispeccode,pr_brand,pr_unit,pr_zxbzs,nvl(pr_sendwmsflag,0) pr_sendwmsflag " +
|
|
|
- " from "+vwmsConfig.getDC_MASTER()+".product left join "+vwmsConfig.getDC_MASTER()+".productbrand on pb_name = pr_brand where pr_id in ("+ids+") and pb_sendwms = -1 ");
|
|
|
+ " from "+vwmsConfig.getDC_MASTER()+".product left join "+vwmsConfig.getDC_MASTER()+".productbrand on pb_name = pr_brand where pr_id in ("+ids+") and ( pb_sendwms = -1 or nvl(pr_sendwmsflag,0) = -1 )");
|
|
|
if(!docMsg.hasNext()){
|
|
|
baseDao.execute("update "+vwmsConfig.getDC_MASTER()+".product set pr_sendwmsstatus='同步失败',pr_sendwmserr='没有需要同步的商品(品牌需设置对接WMS)。' where pr_id IN ("+ids+")");
|
|
|
retMap.put("success",false);
|
|
|
@@ -914,8 +914,6 @@ public class ERPServiceImpl implements ERPService {
|
|
|
return resMap;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private OrderVastRequest.OrdersRequest<OrderCancel> getOrderCancelOrdersRequest(String cancelReason, ProdInout prodInOut) {
|
|
|
OrderVastRequest.OrdersRequest<OrderCancel> orders = new OrderVastRequest.OrdersRequest<OrderCancel>();
|
|
|
OrderCancel cancelOrder = new OrderCancel();
|
|
|
@@ -928,5 +926,168 @@ public class ERPServiceImpl implements ERPService {
|
|
|
return orders;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void syncUnValidChange(String master, String emCode) {
|
|
|
+ //物料资料变更
|
|
|
+ try {
|
|
|
+ SqlRowList unSyncProdCList = baseDao.queryForRowSet("select cl_id,cl_code,cl_keyvalue,cl_auditman,pr_code,cl_caller " +
|
|
|
+ " from commonchangelog left join product on pr_id = cl_keyvalue " +
|
|
|
+ " where cl_status='已审核' and CL_CALLER like 'Product%' and nvl(pr_sendwmsflag,0) = -1 and nvl(CL_sendwmsflag,0) = 0 " +
|
|
|
+ " and to_char(CL_AUDITDATE,'yyyymm') >= '202506' and CL_AUDITDATE <= SYSDATE - INTERVAL '5' MINUTE" +
|
|
|
+ " order by cl_id,cl_keyvalue");
|
|
|
+ if(unSyncProdCList.hasNext()){
|
|
|
+ while (unSyncProdCList.next()){
|
|
|
+ Integer clId = unSyncProdCList.getGeneralInt("cl_id");
|
|
|
+ Integer prId = unSyncProdCList.getGeneralInt("cl_keyvalue");
|
|
|
+ String auditman = unSyncProdCList.getGeneralString("cl_auditman");
|
|
|
+ String code = unSyncProdCList.getGeneralString("pr_code");
|
|
|
+ String caller = unSyncProdCList.getGeneralString("cl_caller");
|
|
|
+ String clCode = unSyncProdCList.getGeneralString("cl_code");
|
|
|
+ Map<String, Object> result = sendProd(master, String.valueOf(prId), emCode,"Product");
|
|
|
+ String message = "";
|
|
|
+ boolean successFlag = true;
|
|
|
+ if (result.get("success") == null || !"true".equals(result.get("success").toString())) {
|
|
|
+ if(result.get("errList")!=null){
|
|
|
+ try {
|
|
|
+ List<Map<String,Object>> errList = (List<Map<String,Object>>) result.get("errList");
|
|
|
+ for(Map<String,Object> map:errList){
|
|
|
+ if(map.get("code").equals(code)){
|
|
|
+ message = map.get("eMsg") == null? "同步失败" : map.get("eMsg").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ message = result.get("message") == null ? "同步失败" : result.get("message").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ message = result.get("message") == null ? "同步失败" : result.get("message").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(successFlag){
|
|
|
+ baseDao.execute("update commonchangelog set CL_sendwmsflag = -1,cl_sendwmserr='' where cl_id = ?",clId);
|
|
|
+ baseDao.execute("update product set pr_sendwmsflag = -1 where pr_id = ?",prId);
|
|
|
+ baseDao.execute("Insert into MESSAGELOG (ML_ID,ML_DATE,ML_MAN,ML_CONTENT,ML_RESULT,ML_SEARCH,CODE) " +
|
|
|
+ "values (MESSAGELOG_seq.nextval,sysdate,'"+auditman+"','同步至WMS','同步成功','" + caller + "|cl_id=" + clId + "','" + clCode + "')");
|
|
|
+ }else {
|
|
|
+ baseDao.execute("update commonchangelog set CL_sendwmsflag = -1,cl_sendwmserr='"+message+"' where cl_id = ?",clId);
|
|
|
+ baseDao.execute("Insert into MESSAGELOG (ML_ID,ML_DATE,ML_MAN,ML_CONTENT,ML_RESULT,ML_SEARCH,CODE) " +
|
|
|
+ "values (MESSAGELOG_seq.nextval,sysdate,'"+auditman+"','同步至WMS','"+message+"','" + caller + "|cl_id=" + clId + "','" + clCode + "')");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ //客户资料
|
|
|
+ try {
|
|
|
+ SqlRowList unSyncCustCList = baseDao.queryForRowSet("select cl_id,cl_code,cl_keyvalue,cl_auditman,cu_code,cl_caller " +
|
|
|
+ " from commonchangelog left join customer on cu_id = cl_keyvalue " +
|
|
|
+ " where cl_status='已审核' and CL_CALLER like 'Customer!Base%' and nvl(CL_sendwmsflag,0) = 0 " +
|
|
|
+ " and to_char(CL_AUDITDATE,'yyyymm') >= '202506' and CL_AUDITDATE <= SYSDATE - INTERVAL '5' MINUTE " +
|
|
|
+ " order by cl_id,cl_keyvalue");
|
|
|
+ if(unSyncCustCList.hasNext()){
|
|
|
+ while (unSyncCustCList.next()){
|
|
|
+ Integer clId = unSyncCustCList.getGeneralInt("cl_id");
|
|
|
+ Integer cuId = unSyncCustCList.getGeneralInt("cl_keyvalue");
|
|
|
+ String auditman = unSyncCustCList.getGeneralString("cl_auditman");
|
|
|
+ String code = unSyncCustCList.getGeneralString("cu_code");
|
|
|
+ String caller = unSyncCustCList.getGeneralString("cl_caller");
|
|
|
+ String clCode = unSyncCustCList.getGeneralString("cl_code");
|
|
|
+ Map<String, Object> result = sendCust(master, String.valueOf(cuId), emCode,"Customer!Base");
|
|
|
+ String message = "";
|
|
|
+ boolean successFlag = true;
|
|
|
+ if (result.get("success") == null || !"true".equals(result.get("success").toString())) {
|
|
|
+ if(result.get("errList")!=null){
|
|
|
+ try {
|
|
|
+ List<Map<String,Object>> errList = (List<Map<String,Object>>) result.get("errList");
|
|
|
+ for(Map<String,Object> map:errList){
|
|
|
+ if(map.get("code").equals(code)){
|
|
|
+ message = map.get("eMsg") == null? "同步失败" : map.get("eMsg").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ message = result.get("message") == null ? "同步失败" : result.get("message").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ message = result.get("message") == null ? "同步失败" : result.get("message").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(successFlag){
|
|
|
+ baseDao.execute("update commonchangelog set cl_sendwmsflag = -1,cl_sendwmserr='' where cl_id = ?",clId);
|
|
|
+ baseDao.execute("update customer set cu_sendwmsflag = -1 where cu_id = ?",cuId);
|
|
|
+ baseDao.execute("Insert into MESSAGELOG (ML_ID,ML_DATE,ML_MAN,ML_CONTENT,ML_RESULT,ML_SEARCH,CODE) " +
|
|
|
+ "values (MESSAGELOG_seq.nextval,sysdate,'"+auditman+"','同步至WMS','同步成功','" + caller + "|cl_id=" + clId + "','" + clCode + "')");
|
|
|
+ }else {
|
|
|
+ baseDao.execute("update commonchangelog set cl_sendwmsflag = -1,cl_sendwmserr='"+message+"' where cl_id = ?",clId);
|
|
|
+ baseDao.execute("Insert into MESSAGELOG (ML_ID,ML_DATE,ML_MAN,ML_CONTENT,ML_RESULT,ML_SEARCH,CODE) " +
|
|
|
+ "values (MESSAGELOG_seq.nextval,sysdate,'"+auditman+"','同步至WMS','"+message+"','" + caller + "|cl_id=" + clId + "','" + clCode + "')");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ //供应商资料
|
|
|
+ try {
|
|
|
+ SqlRowList unSyncCustCList = baseDao.queryForRowSet("select cl_id,cl_code,cl_keyvalue,cl_auditman,ve_code,cl_caller " +
|
|
|
+ " from commonchangelog left join Vendor on ve_id = cl_keyvalue " +
|
|
|
+ " where cl_status='已审核' and CL_CALLER like 'Vendor%' and nvl(CL_sendwmsflag,0) = 0 " +
|
|
|
+ " and to_char(CL_AUDITDATE,'yyyymm') >= '202506' and CL_AUDITDATE <= SYSDATE - INTERVAL '5' MINUTE " +
|
|
|
+ " order by cl_id,cl_keyvalue");
|
|
|
+ if(unSyncCustCList.hasNext()){
|
|
|
+ while (unSyncCustCList.next()){
|
|
|
+ Integer clId = unSyncCustCList.getGeneralInt("cl_id");
|
|
|
+ Integer veId = unSyncCustCList.getGeneralInt("cl_keyvalue");
|
|
|
+ String auditman = unSyncCustCList.getGeneralString("cl_auditman");
|
|
|
+ String code = unSyncCustCList.getGeneralString("ve_code");
|
|
|
+ String caller = unSyncCustCList.getGeneralString("cl_caller");
|
|
|
+ String clCode = unSyncCustCList.getGeneralString("cl_code");
|
|
|
+ Map<String, Object> result = sendVend(master, String.valueOf(veId), emCode,"Vendor");
|
|
|
+ String message = "";
|
|
|
+ boolean successFlag = true;
|
|
|
+ if (result.get("success") == null || !"true".equals(result.get("success").toString())) {
|
|
|
+ if(result.get("errList")!=null){
|
|
|
+ try {
|
|
|
+ List<Map<String,Object>> errList = (List<Map<String,Object>>) result.get("errList");
|
|
|
+ for(Map<String,Object> map:errList){
|
|
|
+ if(map.get("code").equals(code)){
|
|
|
+ message = map.get("eMsg") == null? "同步失败" : map.get("eMsg").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ message = result.get("message") == null ? "同步失败" : result.get("message").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ message = result.get("message") == null ? "同步失败" : result.get("message").toString();
|
|
|
+ successFlag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(successFlag){
|
|
|
+ baseDao.execute("update commonchangelog set cl_sendwmsflag = -1,cl_sendwmserr='' where cl_id = ?",clId);
|
|
|
+ baseDao.execute("update vendor set ve_sendwmsflag = -1 where ve_id = ?",veId);
|
|
|
+ baseDao.execute("Insert into MESSAGELOG (ML_ID,ML_DATE,ML_MAN,ML_CONTENT,ML_RESULT,ML_SEARCH,CODE) " +
|
|
|
+ "values (MESSAGELOG_seq.nextval,sysdate,'"+auditman+"','同步至WMS','同步成功','" + caller + "|cl_id=" + clId + "','" + clCode + "')");
|
|
|
+ }else {
|
|
|
+ baseDao.execute("update commonchangelog set cl_sendwmsflag = -1,cl_sendwmserr='"+message+"' where cl_id = ?",clId);
|
|
|
+ baseDao.execute("Insert into MESSAGELOG (ML_ID,ML_DATE,ML_MAN,ML_CONTENT,ML_RESULT,ML_SEARCH,CODE) " +
|
|
|
+ "values (MESSAGELOG_seq.nextval,sysdate,'"+auditman+"','同步至WMS','"+message+"','" + caller + "|cl_id=" + clId + "','" + clCode + "')");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|