Compare commits
No commits in common. "df8d35f4c5844e84362f0f01cf7a560801c58066" and "d6eb8a4a31180a22ebf1afdabf52985d3646b07c" have entirely different histories.
df8d35f4c5
...
d6eb8a4a31
@ -4980,7 +4980,7 @@ public class ToSAPServiceImpl {
|
||||
erplog.setServerName("WmsToErp");
|
||||
erplog.setEventName("ReturnStockIn生产退料");
|
||||
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
|
||||
erplog.setMessageId(opCode);
|
||||
erplog.setMessageId(shipRequestName);
|
||||
erplog.setSendMsg(makeReturnStockIn);
|
||||
erplog.setSendMsg2(makeReturnStockIn);
|
||||
erplog.setSendMsg(makeReturnStockIn);
|
||||
|
@ -213,17 +213,14 @@ public class ProduceReturnController {
|
||||
} else if(list2.isEmpty()) {
|
||||
throw new GlobalException("未打印退库标签!");
|
||||
} else {
|
||||
// for (Map<String, Object> map : list2) {
|
||||
// if (!"StockOut".equals(map.get("STOCKSTATE").toString())) {
|
||||
// throw new GlobalException("条码已存在且不为出库状态!");
|
||||
// }
|
||||
// }
|
||||
for (Map<String, Object> map : list2) {
|
||||
if (!"StockOut".equals(map.get("STOCKSTATE").toString())) {
|
||||
throw new GlobalException("条码已存在且不为出库状态!");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 查看单号
|
||||
List<Map<String, Object>> list4 = produceReturnService.getMesShip(materialPackingName);
|
||||
if(list4.isEmpty()){
|
||||
throw new GlobalException("未打印退库标签!");
|
||||
}
|
||||
Map<String, Object> mapAll = new HashMap<>();
|
||||
mapAll.put("list2",list2);
|
||||
mapAll.put("list4",list4);
|
||||
|
@ -18,8 +18,6 @@ public interface ToSapDao {
|
||||
|
||||
//基于boxList更新物料凭证及库存状态
|
||||
public void updateStockState(@Param("boxList") List<MaterialPacking> boxList,@Param("stockState") String stockState,@Param("undoId") String undoId) throws Exception;
|
||||
//基于boxList更新物料凭证及库存状态
|
||||
public void updateLocationStockState(@Param("boxList") List<MaterialPacking> boxList,@Param("stockState") String stockState,@Param("undoId") String undoId,@Param("aimErpFactory") String aimErpFactory,@Param("aimErpLocation") String aimErpLocation,@Param("aimLOcationName") String aimLOcationName) throws Exception;
|
||||
|
||||
//基于boxList写入过账流水表
|
||||
public void saveUnDoInfo(@Param("boxList") List<MaterialPacking> boxList, @Param("unDoID") String unDoID, @Param("commitDate") String commitDate) throws Exception;
|
||||
|
@ -7,7 +7,7 @@ public class RespGenerator {
|
||||
* 接口返回数据
|
||||
*/
|
||||
public static BaseResponse returnOK(Object data) {
|
||||
return new BaseResponse("200", "操作成功!", data);
|
||||
return new BaseResponse("200", "SUCCESS!", data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -430,8 +430,6 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
||||
String gxId = jo.getString("gxId"); // 增加管芯字段
|
||||
// String makeDate = jo.getString("makeDate");
|
||||
erpFactory = jo.getString("erpFactory");
|
||||
String materialPackingName = jo.getString("materialPackingName"); // 生成退料原条码二维码
|
||||
|
||||
if (i == 0) {
|
||||
stockInType = jo.getString("stockInType");
|
||||
operationType = jo.getString("operationType");
|
||||
@ -471,7 +469,6 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
||||
bindMap.put("MATERIALSPECTYPE", stockInType);
|
||||
bindMap.put("CHARGE", charge);
|
||||
bindMap.put("GXID", gxId);
|
||||
bindMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||
// bindMap.put("makeDate", makeDate);
|
||||
|
||||
if ("1".equals(operationType)) { // 自动入库
|
||||
|
@ -326,17 +326,19 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
String aimLOcationName = boxList.get(0).getLocationName();
|
||||
undoID = toSAPService.NoSourceChangeLocation(arrayList,aimErpFactory,
|
||||
aimErpLocation, aimLOcationName, user );
|
||||
//更新物料凭证和库存状态
|
||||
toSapDao.updateLocationStockState(boxList, "Stocked", undoID,aimErpFactory,aimErpLocation,aimLOcationName);
|
||||
}else {
|
||||
// 直接入库
|
||||
//封装为Json的字符串
|
||||
String json = JSON.toJSONString(fgStockInInfo);
|
||||
undoID = toSAPService.FGStockInByManulIn(json, user);
|
||||
//更新物料凭证和库存状态
|
||||
toSapDao.updateStockState(boxList, "Stocked", undoID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//更新物料凭证和库存状态
|
||||
toSapDao.updateStockState(boxList, "Stocked", undoID);
|
||||
//更新过账流水
|
||||
toSapDao.saveUnDoInfo( boxList, undoID, commitDate);
|
||||
//更新接口表的标记和
|
||||
|
@ -290,7 +290,7 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
}
|
||||
pc += "'')";
|
||||
try {
|
||||
boolean refundStockIn = ReturnStockInNew(pc, user, commitDate,opCode,boxList);
|
||||
boolean refundStockIn = ReturnStockInNew(pc, user, commitDate,opCode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new GlobalException(e.toString());
|
||||
@ -323,7 +323,7 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
sql.append(" SELECT ");
|
||||
sql.append(" T.LOTNAME MATERIALPACKINGNAME, ");
|
||||
sql.append(" T.QTY MATERIALQUANTITY, ");
|
||||
sql.append(" T.UNIT ,T.RECEIVE_FLAG, T.MATERIALPACKINGNAME PREMATERIALPACKINGNAME,T.CHARGE, ");
|
||||
sql.append(" T.UNIT , T.CHARGE, ");
|
||||
sql.append(" M2. SHIPREQUESTDETAILNAME,");
|
||||
sql.append(" T.REQUESTNAME SHIPREQUESTNAME,");
|
||||
sql.append(" T.PRODUCTSPECNAME MATERIALSPECNAME, ");
|
||||
@ -358,19 +358,6 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
}
|
||||
|
||||
|
||||
// 查出是否存在原标签
|
||||
String receive_flag = queryForList.get(0).get("RECEIVE_FLAG") == null ? "" : queryForList.get(0).get("RECEIVE_FLAG").toString();
|
||||
String PREMATERIALPACKINGNAME = queryForList.get(0).get("PREMATERIALPACKINGNAME") == null ? "" : queryForList.get(0).get("PREMATERIALPACKINGNAME").toString();
|
||||
|
||||
List<Map<String, Object>> xcqueryForList = new ArrayList<Map<String, Object>> ();
|
||||
Map<String, Object> xcHashMap = new HashMap<String,Object> ();
|
||||
xcHashMap.put("CHARGE", queryForList.get(0).get("CHARGE"));
|
||||
xcHashMap.put("MATERIALPACKINGNAME", PREMATERIALPACKINGNAME);
|
||||
|
||||
String xcSql = "SELECT * FROM MATERIALPACKING m WHERE m.CHARGE = :CHARGE AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
xcqueryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(xcSql, xcHashMap);
|
||||
|
||||
|
||||
//判断标签是否存在,存在就更新不存在就创建新的入库
|
||||
String judgeSql = "SELECT * FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(judgeSql, hashMap);
|
||||
@ -439,17 +426,6 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
bindMap.put("RETURNPC",queryForList.get(0).get("RETURNPC"));
|
||||
|
||||
bindMap.put("ShipUser",queryForList.get(0).get("SHIPUSER"));
|
||||
|
||||
// 如果是现场仓更新标签,需根据批次才能找到对应的原标签
|
||||
if("T".equals(receive_flag)) {
|
||||
// 如果存在对应的原标签,MATERIALPACKINGNAME相等,组织 仓库 货位 用原标签,拥于后面过账
|
||||
if(xcqueryForList != null && xcqueryForList.size() > 0) {
|
||||
erpFactory = xcqueryForList.get(0).get("ErpFactory") == null ? "" : xcqueryForList.get(0).get("ErpFactory").toString();
|
||||
erpLocation = xcqueryForList.get(0).get("ErpLocation") == null ? "" : xcqueryForList.get(0).get("ErpLocation").toString();
|
||||
locationName = xcqueryForList.get(0).get("LocationName") == null ? "" : xcqueryForList.get(0).get("LocationName").toString();
|
||||
}
|
||||
}
|
||||
|
||||
bindMap.put("ErpLocation", erpLocation);
|
||||
bindMap.put("ErpFactory", erpFactory);
|
||||
bindMap.put("receiveActNo", SHIPActNo);
|
||||
@ -467,16 +443,6 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName,materialPackingName);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().create(
|
||||
eventInfo, createInfo);
|
||||
|
||||
// 如果是现场仓更新标签,需根据批次才能找到对应的原标签
|
||||
if("T".equals(receive_flag)) {
|
||||
// 如果存在对应的原标签,MATERIALPACKINGNAME相等,就删除原标签
|
||||
if(xcqueryForList != null && xcqueryForList.size() > 0) {
|
||||
String delsql = "DELETE FROM MATERIALPACKING m WHERE m.CHARGE = :CHARGE AND m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(delsql, xcHashMap);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
SetEventInfo setEventInfo = new SetEventInfo();
|
||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||
@ -511,7 +477,6 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
bindMap.put("SALESPERSON", queryForList.get(0).get("SALESPERSON"));//事业部
|
||||
bindMap.put("CUSTOMNO", queryForList.get(0).get("CUSTOMNO"));//客户
|
||||
bindMap.put("charge",palletName.split("\\|")[4]);
|
||||
|
||||
setEventInfo.setUserColumns(bindMap);
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",materialPackingName);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, eventInfo, setEventInfo);
|
||||
@ -570,11 +535,9 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
|
||||
//重写退料入库过账。同组织使用转库单(BLSQ4K)过账接口,跨组织使用调拨(4E)入库接口。zd.2024.9.2
|
||||
@Transactional
|
||||
public boolean ReturnStockInNew(String pc, String eventUser, String commitDate, String opCode,List<MaterialPacking> boxList) throws Exception {
|
||||
public boolean ReturnStockInNew(String pc, String eventUser, String commitDate, String opCode) throws Exception {
|
||||
|
||||
String siteName="SDK";
|
||||
|
||||
// gf现在sap退料MATERIALSHIPREQUEST无单据,不用单据过账
|
||||
// 根据退库Box查询有多少退库单据,分开过账
|
||||
String wgs="SELECT DISTINCT m.RECEIVEREQUESTNAME,m.ERPLOCATION,(SELECT m2.SHIPREQUESTTYPE FROM MATERIALSHIPREQUEST m2 \r\n" +
|
||||
" WHERE m2.SHIPREQUESTNAME=m.RECEIVEREQUESTNAME) AS SHIPREQUESTTYPE \r\n" +
|
||||
@ -585,64 +548,24 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
hashMap3.put("SITENAME", siteName);
|
||||
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(wgs, hashMap3);
|
||||
|
||||
String flagList="SELECT bs.RECEIVE_FLAG FROM BS_MES_SHIPPED bs WHERE bs.SITENAME =:SITENAME AND bs.LOTNAME IN" +pc;
|
||||
List<Map<String, Object>> flgQueryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(flagList, hashMap3);
|
||||
String receive_flag = flgQueryForList.get(0).get("RECEIVE_FLAG") == null ? "" : flgQueryForList.get(0).get("RECEIVE_FLAG").toString();
|
||||
|
||||
String billCode="";
|
||||
String aimErpFactory = "";
|
||||
String aimErpLocation = "";
|
||||
String aimLOcationName = "";
|
||||
|
||||
// 如果是T为现场仓退料,N无现场仓
|
||||
if (receive_flag.equals("T")) {
|
||||
List<MaterialPackingKey> arrayList = new ArrayList<MaterialPackingKey> ();
|
||||
for (int i = 0; i < boxList.size(); i++) {
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName, boxList.get(i).getMaterialPackingName());
|
||||
arrayList.add(materialPackingKey);
|
||||
}
|
||||
//先入到线边仓,从线边再转库
|
||||
aimErpFactory = boxList.get(0).getErpFactory();
|
||||
aimErpLocation = boxList.get(0).getErpLocation();
|
||||
aimLOcationName = boxList.get(0).getLocationName();
|
||||
billCode = ToSAPServiceImpl.NoSourceChangeLocation(arrayList,aimErpFactory,
|
||||
aimErpLocation, aimLOcationName, eventUser );
|
||||
|
||||
if (billCode.length() == 0) {
|
||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||
}
|
||||
}else {
|
||||
billCode = ToSAPServiceImpl.ReturnStockInNew("SDK", eventUser, "", commitDate,opCode);
|
||||
|
||||
if (billCode.length() == 0) {
|
||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||
}
|
||||
}
|
||||
// gf 现在退料无单据,不用单据过账
|
||||
//判断批次是否数量是否满足单据需求
|
||||
// for (int i = 0; i < queryForList2.size(); i++) {
|
||||
// String receiveRequestName = queryForList2.get(i).get("RECEIVEREQUESTNAME").toString();
|
||||
String receiveRequestName = "";
|
||||
for (int i = 0; i < queryForList2.size(); i++) {
|
||||
String receiveRequestName = queryForList2.get(i).get("RECEIVEREQUESTNAME").toString();
|
||||
// String erpLocation = queryForList2.get(i).get("ERPLOCATION").toString();
|
||||
// String shipRequestType=queryForList2.get(i).get("SHIPREQUESTTYPE").toString();
|
||||
// 如果不是T现场仓
|
||||
// if (!receive_flag.equals("T")) {
|
||||
// billCode = ToSAPServiceImpl.ReturnStockInNew("SDK", eventUser, receiveRequestName, commitDate,opCode);
|
||||
//
|
||||
// if (billCode.length() == 0) {
|
||||
// throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||
// }
|
||||
// }
|
||||
|
||||
String billCode="";
|
||||
billCode = ToSAPServiceImpl.ReturnStockInNew("SDK", eventUser, receiveRequestName, commitDate,opCode);
|
||||
if (billCode.length() == 0) {
|
||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||
}
|
||||
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("ReturnStockIn", eventUser, "ReturnStockIn");
|
||||
// 更新抬头文本状态和Box状态
|
||||
/*String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M WHERE M.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND ERPLOCATION = :ERPLOCATION AND m.MATERIALPACKINGNAME IN "
|
||||
+ pc;*/
|
||||
// String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME,M.CHARGE FROM MATERIALPACKING M WHERE M.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND m.MATERIALPACKINGNAME IN "
|
||||
// + pc;
|
||||
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME,M.CHARGE FROM MATERIALPACKING M WHERE m.MATERIALPACKINGNAME IN " + pc;
|
||||
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME,M.CHARGE FROM MATERIALPACKING M WHERE M.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND m.MATERIALPACKINGNAME IN "
|
||||
+ pc;
|
||||
Map<String, Object> hashMap = new HashMap<String, Object>();
|
||||
// hashMap.put("RECEIVEREQUESTNAME", receiveRequestName);
|
||||
hashMap.put("RECEIVEREQUESTNAME", receiveRequestName);
|
||||
// hashMap.put("ERPLOCATION", erpLocation);
|
||||
List<String> chargeList = new ArrayList<> ();
|
||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||
@ -653,14 +576,6 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||
bindMap.put("unDoID", billCode);
|
||||
bindMap.put("stockState", "Stocked");
|
||||
|
||||
// 如果是现场仓 把原标签更新为目标组织、仓库、货位
|
||||
if("T".equals(receive_flag)) {
|
||||
bindMap.put("erpFactory", aimErpFactory);
|
||||
bindMap.put("erpLocation", aimErpLocation);
|
||||
bindMap.put("locationName", aimLOcationName);
|
||||
}
|
||||
|
||||
setEventInfo.setUserColumns(bindMap);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo,
|
||||
setEventInfo);
|
||||
@ -688,7 +603,7 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
|
||||
// throw new GlobalException("MES返回报错:" + msg);
|
||||
// }
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
@ -4,20 +4,20 @@
|
||||
<mapper namespace="com.cim.idm.dao.ProduceReturnDao">
|
||||
|
||||
<select id="getMaterialPacking" resultType="map">
|
||||
SELECT mp.LOTNAME MATERIALPACKINGNAME, mp.PRODUCTSPECNAME MATERIALSPECNAME, mp.PHASE, mp.PACKINGGRADE,
|
||||
mp.CHARGE, m.DESC_CN, #{erpFactory} AS ERPFACTORY,
|
||||
SELECT mp.MATERIALPACKINGNAME, mp.MATERIALSPECNAME, mp.PHASE, mp.PACKINGGRADE,
|
||||
mp.STOCKSTATE, mp.RECEIVEACTNO, mp.CHARGE, m.DESC_CN, #{erpFactory} AS ERPFACTORY,
|
||||
#{erpLocation} AS ERPLOCATION, #{locationName} AS LOCATIONNAME,
|
||||
mp.QTY MATERIALQUANTITY, mp.UNIT
|
||||
FROM BS_MES_SHIPPED mp
|
||||
LEFT JOIN MATERIALSPEC m ON m.MATERIALSPECNAME = mp.PRODUCTSPECNAME
|
||||
WHERE mp.LOTNAME = #{name}
|
||||
mp.materialquantity MATERIALQUANTITY, mp.UNIT
|
||||
FROM MATERIALPACKING mp
|
||||
LEFT JOIN MATERIALSPEC m ON m.MATERIALSPECNAME = mp.MATERIALSPECNAME
|
||||
WHERE mp.MATERIALPACKINGNAME = #{name}
|
||||
</select>
|
||||
|
||||
<select id="getMesShip" resultType="map">
|
||||
select bms.PRODUCTSPECNAME as MATERIALSPECNAME, bms.REQUESTNAME as RECEIVEREQUESTNAME,
|
||||
0 as HAVEQUANTITY, sum(bms.QTY) as TOTALQTY, bms.UNIT
|
||||
FROM BS_MES_SHIPPED bms
|
||||
where bms.LOTNAME = #{name}
|
||||
where LOTNAME = #{name}
|
||||
GROUP BY bms.REQUESTNAME, bms.PRODUCTSPECNAME, bms.UNIT
|
||||
</select>
|
||||
</mapper>
|
@ -43,15 +43,6 @@
|
||||
#{box.materialPackingName}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- 更新库存状态 -->
|
||||
<update id="updateLocationStockState" parameterType="map">
|
||||
UPDATE MATERIALPACKING
|
||||
SET STOCKSTATE = #{stockState},UNDOID = #{undoId}, ERPLOCATION = #{aimErpLocation}, LOCATIONNAME = #{aimLOcationName}, ERPFACTORY = #{aimErpFactory}
|
||||
WHERE MATERIALPACKINGNAME IN
|
||||
<foreach item="box" index="index" collection="boxList" open="(" separator="," close=")">
|
||||
#{box.materialPackingName}
|
||||
</foreach>
|
||||
</update>
|
||||
<!-- 基于形态转换更新物料编码-->
|
||||
<update id="updateMaterialCode" parameterType="map">
|
||||
UPDATE MATERIALPACKING m
|
||||
|
Loading…
x
Reference in New Issue
Block a user