add:冲销

This commit is contained in:
郭飞 2025-03-27 17:58:27 +08:00
parent 9f6f959e1b
commit 29167783aa
6 changed files with 143 additions and 38 deletions

View File

@ -6,18 +6,18 @@
#db.Local.url=jdbc:oracle:thin:@10.140.249.73:1521:ORCL
#db.Local.username=b16mwmsadm
#db.Local.password=adm2024
db.Local.url=jdbc:oracle:thin:@123.57.206.181:1521/ORCLPDB1
db.Local.url=jdbc:oracle:thin:@192.168.1.73:1526/test
db.Local.username=ziwms_sap_test
db.Local.password=adm2024
#Section 2 - Customer Local dev DB Info
db.Dev.url=jdbc:oracle:thin:@123.57.206.181:1521/ORCLPDB1
db.Dev.url=jdbc:oracle:thin:@192.168.1.73:1526/test
db.Dev.username=ziwms_sap_test
db.Dev.password=adm2024
#Section 3 - Customer Test DB Info
db.Tst.url=jdbc:oracle:thin:@123.57.206.181:1521/ORCLPDB1
db.Tst.url=jdbc:oracle:thin:@192.168.1.73:1526/test
db.Tst.username=ziwms_sap_test
db.Tst.password=adm2024
#Section 4 - Customer Prod DB Info
db.Prd.url=jdbc:oracle:thin:@123.57.206.181:1521/ORCLPDB1
db.Prd.url=jdbc:oracle:thin:@192.168.1.73:1526/test
db.Prd.username=ziwms_sap_test
db.Prd.password=adm2024

View File

@ -731,7 +731,7 @@ public class ToSAPServiceImpl {
Map<String,String> bodyJSonData = new HashMap<>();
MainData.put("HEAD",headJSonData);
MainData.put("BODY",bodyJSonData);
headJSonData.put("INTF_ID","");
headJSonData.put("INTF_ID","MM068");
headJSonData.put("SRC_SYSTEM","WMS");
headJSonData.put("DEST_SYSTEM","SAP");
headJSonData.put("SRC_MSGID","");

View File

@ -29,7 +29,7 @@ public class MaterialUndoController {
private MaterialUndoServiceImpl materialUndoServiceImpl;
@RequestMapping(value = "/commitUndo", method = RequestMethod.POST)
public AjaxResult commitUndo(@RequestBody JSONObject in ) {
public AjaxResult commitUndo(@RequestBody JSONObject in ) throws Exception {
MaterialUndoDto undoDto = JSON.toJavaObject(in, MaterialUndoDto.class);
String undoId = undoDto.getUndoId();
@ -44,25 +44,38 @@ public class MaterialUndoController {
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
}
//校验单据类型根据单据类型判断逻辑
switch (inv_TYPE) {
case "45":
materialUndoServiceImpl.rkUndo(undoId, userId);
break;
case "46":
materialUndoServiceImpl.cprkUndo(undoId, userId);
break;
case "4C":
// switch (inv_TYPE) {
// case "45":
// materialUndoServiceImpl.rkUndo(undoId, userId);
// break;
// case "46":
// materialUndoServiceImpl.cprkUndo(undoId, userId);
// break;
// case "4C":
// materialUndoServiceImpl.ckUndo(undoId, userId);
// case "4Y" :
// materialUndoServiceImpl.ckUndo(undoId, userId);
// case "4I" :
// materialUndoServiceImpl.ckUndo(undoId, userId);
// break;
// default :
// return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销");
// }
if ("Z001".equals(inv_TYPE) || "Z005".equals(inv_TYPE) || "Z006".equals(inv_TYPE) || "Z007".equals(inv_TYPE) || "Z008".equals(inv_TYPE)) {
materialUndoServiceImpl.rkUndo(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")) {
materialUndoServiceImpl.ckUndo(undoId, userId);
case "4Y" :
} else if (inv_TYPE.contains("ZLR")) {
materialUndoServiceImpl.ckUndo(undoId, userId);
case "4I" :
materialUndoServiceImpl.ckUndo(undoId, userId);
break;
default :
}else if(inv_TYPE.contains("ZK")) { // 转库
materialUndoServiceImpl.zkUndo(undoId, userId);
}else {
return AjaxResult.me().setSuccess(false).setMessage("单据类型不支持冲销");
}
return AjaxResult.me().setSuccess(true).setMessage("冲销成功");
}
}

View File

@ -0,0 +1,19 @@
package com.cim.idm.dao;
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface MaterialReversalDao {
//更新冲销凭证为已冲销
public static void updateReversalUnDoId(@Param("undoId") String undoId) throws Exception {
}
}

View File

@ -1,9 +1,12 @@
package com.cim.idm.service.Impl;
import com.alibaba.fastjson.JSONArray;
import com.cim.idm.dao.MaterialReversalDao;
import com.cim.idm.exception.GlobalException;
import com.cim.idm.framework.IDMFrameServiceProxy;
import com.cim.idm.framework.data.EventInfo;
import com.cim.idm.service.IMaterialUndoService;
import com.cim.idm.service.impl.ToSAPServiceImpl;
import com.cim.idm.utils.AjaxResult;
import com.cim.idm.utils.EventInfoUtil;
import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy;
@ -11,6 +14,7 @@ import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey;
import com.cim.idm.wmspackage.materialpacking.management.info.RemoveInfo;
import com.cim.idm.wmspackage.materialpacking.management.info.SetEventInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -21,14 +25,24 @@ import java.util.Map;
@Service("MaterialUndo")
public class MaterialUndoServiceImpl implements IMaterialUndoService {
@Autowired
private ToSAPServiceImpl toSAPService;
@Autowired
private MaterialReversalDao materialReversalDao;
/**
* 入库冲销
* @param undoId
* @param user
*/
@Transactional
public void rkUndo (String undoId, String user) {
public void rkUndo (String undoId, String user) throws Exception {
String billCode = toSAPService.cancelShipInter(undoId, user);
if (billCode == null) {
throw new GlobalException("报送ERP失败,请联系IT处理");
}
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("MakeUndo", user, "MakeUndo");
String condition="WHERE UNDOID =? ";
String[] bindSet={undoId};
@ -42,11 +56,13 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
MaterialPackingKey key = materialPacking.getKey();
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo);
}
String sql = "UPDATE IF_ERPUNDO T SET T.FLAG = 'Y' WHERE T.UNDOID = :UNDOID ";
Map<String, Object> hashMap2 = new HashMap<String, Object> ();
hashMap2.put("UNDOID", undoId);
IDMFrameServiceProxy.getSqlTemplate().update(sql, hashMap2);
// 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);
}
/**
@ -55,7 +71,11 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
* @param user
*/
@Transactional
public void cprkUndo (String undoId, String user) {
public void cprkUndo (String undoId, String user) throws Exception {
String billCode = toSAPService.cancelShipInter(undoId, user);
if (billCode == null) {
throw new GlobalException("报送ERP失败,请联系IT处理");
}
EventInfo makeEventInfo = new EventInfoUtil ().makeEventInfo("MakeUndo", user, "MakeUndo");
String condition="SELECT MATERIALPACKINGNAME FROM MATERIALPACKING WHERE UNDOID = :UNDOID ";
// String[] bindSet={undoId};
@ -115,10 +135,12 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
MaterialPackingServiceProxy.getMaterialPackingService().remove(new MaterialPackingKey("SDK", MATERIALPACKINGNAME), makeEventInfo, removeInfo);
}
String sql = "UPDATE IF_ERPUNDO T SET T.FLAG = 'Y' WHERE T.UNDOID = :UNDOID ";
Map<String, Object> hashMap2 = new HashMap<String, Object> ();
hashMap2.put("UNDOID", undoId);
IDMFrameServiceProxy.getSqlTemplate().update(sql, hashMap2);
// String sql = "UPDATE IF_ERPUNDO T SET T.FLAG = 'Y' WHERE T.UNDOID = :UNDOID ";
// Map<String, Object> hashMap2 = new HashMap<String, Object> ();
// hashMap2.put("UNDOID", undoId);
// IDMFrameServiceProxy.getSqlTemplate().update(sql, hashMap2);
// 更新凭证冲销状态
MaterialReversalDao.updateReversalUnDoId(undoId);
}
@ -128,7 +150,13 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
* @param user
*/
@Transactional
public void ckUndo (String undoId, String user) {
public void ckUndo (String undoId, String user) throws Exception {
String billCode = toSAPService.cancelShipInter(undoId, user);
if (billCode == null) {
throw new GlobalException("报送ERP失败,请联系IT处理");
}
EventInfo makeEventInfo = new EventInfoUtil ().makeEventInfo("MakeUndo", user, "MakeUndo");
String condition="WHERE UNDOID =? ";
String[] bindSet={undoId};
@ -194,11 +222,44 @@ public class MaterialUndoServiceImpl implements IMaterialUndoService {
IDMFrameServiceProxy.getSqlTemplate().update(pcSql, hashMap);
IDMFrameServiceProxy.getSqlTemplate().update(cxSql, hashMap);
}
String sql = "UPDATE IF_ERPUNDO T SET T.FLAG = 'Y' WHERE T.UNDOID = :UNDOID ";
Map<String, Object> hashMap2 = new HashMap<String, Object> ();
hashMap2.put("UNDOID", undoId);
IDMFrameServiceProxy.getSqlTemplate().update(sql, hashMap2);
// 更新凭证冲销状态
MaterialReversalDao.updateReversalUnDoId(undoId);
}
/**
* 转库
* @param undoId
* @param user
*/
@Transactional
public void zkUndo (String undoId, String user) throws Exception {
String billCode = toSAPService.cancelShipInter(undoId, user);
if (billCode == null) {
throw new GlobalException("报送ERP失败,请联系IT处理");
}
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("MakeUndo", user, "MakeUndo");
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", materialPacking.getPreErpLocation());
hashMap.put("locationName", materialPacking.getPreLocationName());
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);
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cim.idm.dao.MaterialReversalDao">
<!-- 更新入库标记-->
<update id="updateReversalUnDoId" parameterType="map">
UPDATE BS_MATERIALPACKINGUNDOINFO b SET b.FLAG = 'Y' WHERE b.UNDOID = #{undoId}
</update>
</mapper>