Compare commits

..

2 Commits

6 changed files with 120 additions and 31 deletions

View File

@ -5744,7 +5744,7 @@ public class ToSAPServiceImpl {
ErpMessageLog erplog = new ErpMessageLog();
erplog.setEventUser("");
erplog.setServerName("WmsToErp");
erplog.setEventName("iqcResultFeekback");
erplog.setEventName("pqcSyncdata2-QMS质检结果");
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
erplog.setMessageId(UUID.randomUUID().toString());
erplog.setSendMsg(sendData);

View File

@ -41,17 +41,22 @@ public class MaterialUndoController {
String undoId = undoDto.getUndoId();
String userId = undoDto.getUserId();
String flag = undoDto.getFlag();
String inv_TYPE = undoDto.getINV_TYPE();
String inv_TYPE = undoDto.getINV_TYPE() == null ? "" : undoDto.getINV_TYPE();
String lastEventName = undoDto.getLastEventName();
String commitDate = undoDto.getCommitDate();
String preErpLocation = undoDto.getPreErpLocation();
String preLocationName = undoDto.getPreLocationName();
String locationName = undoDto.getErpLocation();
String erpLocation = undoDto.getLocationName();
//根据物料凭证校验物料状态是否一致
try {
Boolean checkUndoCondition = untils.CheckUndoCondition(undoId);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
}
// try {
// Boolean checkUndoCondition = untils.CheckUndoCondition(undoId);
// } catch (Exception e) {
// e.printStackTrace();
// return AjaxResult.me().setSuccess(false).setMessage(e.toString());
// }
//校验单据类型根据单据类型判断逻辑
// switch (inv_TYPE) {
// case "45":
@ -71,19 +76,27 @@ public class MaterialUndoController {
// return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销");
// }
if ("Z001".equals(inv_TYPE) || "Z005".equals(inv_TYPE) || "Z006".equals(inv_TYPE) || "Z007".equals(inv_TYPE)) {
if ("Z002".equals(inv_TYPE) || "Z003".equals(inv_TYPE) || "Z004".equals(inv_TYPE) || "Z001".equals(inv_TYPE) || "Z005".equals(inv_TYPE) || "Z006".equals(inv_TYPE) || "Z007".equals(inv_TYPE)) {
// materialUndoServiceImpl.rkUndo(undoId, userId); // 入库
materialUndoServiceImpl.cgrkUndo(undoId, userId); // 采购入库
} else if ("Z002".equals(inv_TYPE) || "Z003".equals(inv_TYPE) || "Z004".equals(inv_TYPE)) {
materialUndoServiceImpl.cprkUndo(undoId, userId);// 成品入库
} else if (inv_TYPE.contains("ZLF") || "Z008".equals(inv_TYPE)) { // 出库冲销
}
// else if ("Z002".equals(inv_TYPE) || "Z003".equals(inv_TYPE) || "Z004".equals(inv_TYPE)) {
// materialUndoServiceImpl.cprkUndo(undoId, userId);// 成品入库
// }
else if ("Z008".equals(inv_TYPE)) { // 出库冲销
materialUndoServiceImpl.ckUndo(undoId, userId);
} else if (inv_TYPE.contains("ZLR")) {
materialUndoServiceImpl.ckUndo(undoId, userId);
}else if(inv_TYPE.contains("ZK")) { // 转库
materialUndoServiceImpl.zkUndo(undoId, userId);
}else if(lastEventName.contains("自动转库")) { // 自动转库
materialUndoServiceImpl.zdZkUndo(undoId, userId,preErpLocation,preLocationName);
}else if(lastEventName.contains("质检结果")) { // 质检结果
materialUndoServiceImpl.zjJgUndo(undoId, userId);
}else if(inv_TYPE.contains("NLCC") && lastEventName.contains("调拨出库")) { // 调拨出库
materialUndoServiceImpl.orderUndo(undoId, userId,commitDate);
} else if (inv_TYPE.contains("ZLF")) { // 销售发货出库
materialUndoServiceImpl.orderUndo(undoId, userId,commitDate);
} else {
return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销");
}

View File

@ -284,7 +284,7 @@ public class QMSController {
SetEventInfo setEventInfo = new SetEventInfo();
SetEventInfo setEventInfo2 = new SetEventInfo();
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", "", "iqcSyncdata");
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("QMS质检结果", "QMS", "pqcSyncdata2-QMS质检结果");
EventInfo eventInfo = new EventInfo();
eventInfo.setEventName("iqcSyncdata");
eventInfo.setEventUser("pQC");
@ -314,7 +314,7 @@ public class QMSController {
String pqcResult = jb.get("judgementResult").toString();//检验结果
String pqcResultDate = jb.get("resultTime").toString();//检验时间
String user = jb.get("inspector").toString();//检验员
makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", user, "iqcSyncdata");
// makeEventInfo = new EventInfoUtil().makeEventInfo("iqcSyncdata", user, "iqcSyncdata");
String exceptionHandling = jb.get("exceptionHandling") == null ? "" : jb.get("exceptionHandling").toString();//异常处理 0复卷1降级2报废
String specialState = jb.get("specialState") == null ? "" : jb.get("specialState").toString();//特殊状态 0特采1紧急放行2退供应商
String transferStatus = jb.get("transferStatus") == null ? "" : jb.get("transferStatus").toString();//异常处理
@ -354,6 +354,7 @@ public class QMSController {
//eventInfo.setEventTime(Timestamp.valueOf(pqcResultDate));
eventInfo.setEventUser(user);
List<String> sapBoxList = new ArrayList<> ();
if ("0".equals(tpType)) {//采购到货单, 领料退库产成品入库
// 获取JSON数组
@ -418,6 +419,10 @@ public class QMSController {
if(sapBoxList.size() > 0) {
String undoId = toSAPService.iqcResultFeekback(sapBoxList,siteName,commonNumber,materialCode,pqcResult,pqcResultDate,user,
exceptionHandling,specialState);
if (undoId == null || "".equals(undoId)) {
throw new CustomException("SAP过账失败");
}
untils.SaveUnDoInfo_ForSap(sapBoxList, undoId, makeEventInfo);
}
if(mpList.size()>0)
@ -517,6 +522,11 @@ public class QMSController {
if(sapBoxList.size() > 0) {
String undoId = toSAPService.iqcResultFeekback(sapBoxList,siteName,commonNumber,materialCode,pqcResult,pqcResultDate,user,
exceptionHandling,specialState);
if (undoId == null || "".equals(undoId)) {
throw new CustomException("SAP过账失败");
}
untils.SaveUnDoInfo_ForSap(sapBoxList, undoId, makeEventInfo);
}
if(mpList.size()>0)
@ -992,7 +1002,7 @@ public class QMSController {
// billCode = NCWServiceImpl.OQZkNoInvoice(LocationBoxList, sendUser);
if (billCode == null || "".equals(billCode)) {
throw new CustomException("ERP过账失败");
throw new CustomException("SAP过账失败");
}
EventInfoUtil eventInfoUtil = new EventInfoUtil();

View File

@ -16,4 +16,12 @@ public class MaterialUndoDto {
private String lastEventName;
private String commitDate;
private String preErpLocation;
private String preLocationName;
private String locationName;
private String erpLocation;
}

View File

@ -74,29 +74,34 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
@Transactional
public void cgrkUndo (String undoId, String user) throws Exception {
String billCode = toSAPService.cancelShipInter(undoId, user);
if (billCode == null) {
throw new GlobalException("报送ERP失败,请联系IT处理");
}
// String billCode = toSAPService.cancelShipInter(undoId, user);
// if (billCode == null) {
// throw new GlobalException("报送ERP失败,请联系IT处理");
// }
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("MakeUndo", user, "MakeUndo");
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("采购入库冲销", user, "采购入库冲销");
String condition="WHERE UNDOID =? ";
String[] bindSet={undoId};
//根据物料凭证找到所有的待冲销数据更新库存状态为创建
// 直接删除生成的标签
List<MaterialPacking> list = MaterialPackingServiceProxy.getMaterialPackingService().select(condition, bindSet);
Map<String, Object> hashMap = new HashMap<String, Object> ();
hashMap.put("stockState", "Created");
SetEventInfo setEventInfo = new SetEventInfo();
setEventInfo.setUserColumns(hashMap);
if(list.size() > 0) {
for (MaterialPacking materialPacking : list) {
MaterialPackingKey key = materialPacking.getKey();
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo);
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo);
String delSql = "DELETE FROM MATERIALPACKING WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
String MATERIALPACKINGNAME = materialPacking.getMaterialPackingName();
Map<String, Object> hashMap = new HashMap<String, Object> ();
hashMap.put("MATERIALPACKINGNAME", MATERIALPACKINGNAME);
// SetEventInfo setEventInfo = new SetEventInfo();
// setEventInfo.setUserColumns(hashMap);
IDMFrameServiceProxy.getSqlTemplate().update(delSql, hashMap);
}
}
// String sql = "UPDATE BS_MATERIALPACKINGUNDOINFO b SET b.FLAG = 'Y' WHERE b.UNDOID = :UNDOID";
// Map<String, Object> hashMap2 = new HashMap<String, Object> ();
// hashMap2.put("UNDOID", undoId);
// IDMFrameServiceProxy.getSqlTemplate().update(sql, hashMap2);
// 更新凭证冲销状态
MaterialReversalDao.updateReversalUnDoId(undoId);
}
@ -298,6 +303,58 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
MaterialReversalDao.updateReversalUnDoId(undoId);
}
/**
* 自动转库
* @param undoId
* @param user
*/
@Transactional
public void zdZkUndo (String undoId, String user,String preErpLocation,String preLocationName) throws Exception {
String billCode = toSAPService.cancelShipInter(undoId, user);
if (billCode == null) {
throw new GlobalException("报送ERP失败,请联系IT处理");
}
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("冲销自动转库", user, "冲销自动转库");
String condition="WHERE UNDOID =? ";
String[] bindSet={undoId};
//根据物料凭证找到所有的待冲销数据更新库存状态为创建
List<MaterialPacking> list = MaterialPackingServiceProxy.getMaterialPackingService().select(condition, bindSet);
for (MaterialPacking materialPacking : list) {
Map<String, Object> hashMap = new HashMap<String, Object> ();
hashMap.put("erpLocation", preErpLocation);
hashMap.put("locationName", preLocationName);
// hashMap.put("preErpLocation", materialPacking.getErpLocation());
// hashMap.put("preLocationName", materialPacking.getLocationName());
SetEventInfo setEventInfo = new SetEventInfo();
setEventInfo.setUserColumns(hashMap);
MaterialPackingKey key = materialPacking.getKey();
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo);
}
// 更新凭证冲销状态
MaterialReversalDao.updateReversalUnDoId(undoId);
}
/**
* 质检结果
* @param undoId
* @param user
*/
@Transactional
public void zjJgUndo (String undoId, String user) throws Exception {
String billCode = toSAPService.cancelShipInter(undoId, user);
if (billCode == null) {
throw new GlobalException("SAP质检结果冲销失败");
}
// 更新凭证冲销状态
MaterialReversalDao.updateReversalUnDoId(undoId);
}
@Transactional
public void orderUndo (String undoId, String user, String commitDate) throws Exception {

View File

@ -54,6 +54,7 @@ public class NoInvoiceManagerServiceImpl {
}
String undoid = "";
// undoid = NCWServiceImpl.qtrNoInvoice(list,user,commitDate,opCode);
SDKMaterialPackingServiceImpl.updateUndoIdByList(list, undoid, makeEventInfo,opCode);
//更新库存状态
SDKMaterialPackingServiceImpl.SaveUnDoInfo( undoid,commitDate);