Compare commits
2 Commits
c8de025d22
...
b25d9de042
Author | SHA1 | Date | |
---|---|---|---|
b25d9de042 | |||
d5c7427f39 |
@ -592,11 +592,13 @@ public class ToSAPServiceImpl {
|
||||
item.put("MATNR", mm.get("MATERIALSPECNAME"));
|
||||
item.put("LGORT", mm.get("ERPLOCATION"));
|
||||
item.put("WERKS", mm.get("ERPFACTORY"));
|
||||
|
||||
// item.put("BWART", "531");
|
||||
if("FG".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||
item.put("BWART", "101"); //产成品,移动类型 101
|
||||
}else if("BFG".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||
}else if("BFG".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||
item.put("BWART", "531"); //副产品, 移动类型 531
|
||||
}else if("FGDEV".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||
}else if("FGDEV".equals((String)mm.get("MATERIALSPECTYPE")) ) {
|
||||
item.put("BWART", "511"); //研发品, 移动类型 511
|
||||
}else {
|
||||
item.put("BWART", "101"); //为了兼容之前的未提到的成品,统一暂用 101
|
||||
|
@ -105,7 +105,7 @@ public class FGStockInController {
|
||||
return AjaxResult.me().setSuccess(false).setMessage("生产日期为空,请联系IT处理!");
|
||||
}
|
||||
|
||||
if ("101".equals(erpFactory) || "102".equals(erpFactory)) {
|
||||
// if ("101".equals(erpFactory) || "102".equals(erpFactory)) {
|
||||
|
||||
// 良品与不良品与仓校验
|
||||
String packingGrade = list2.get(0).get("PACKINGGRADE") == null ? "" : list2.get(0).get("PACKINGGRADE").toString();
|
||||
@ -114,56 +114,56 @@ public class FGStockInController {
|
||||
throw new GlobalException("仓库类型和物料品质等级不一致");
|
||||
}
|
||||
|
||||
}
|
||||
String wgbg = "SELECT\r\n" +
|
||||
" LISTAGG(RECEIVEREQUESTNAME, ',') WITHIN GROUP (\r\n" +
|
||||
" ORDER BY RECEIVEREQUESTNAME) AS RECEIVEREQUESTNAME,\r\n" +
|
||||
" SUM(REQTY) AS REQTY,\r\n" +
|
||||
" SUM(QTY) AS QTY,\r\n" +
|
||||
" SDK_ID ,\r\n" +
|
||||
" MATERIALSPECNAME ,\r\n" +
|
||||
" PHASE\r\n" +
|
||||
"FROM\r\n" +
|
||||
" (\r\n" +
|
||||
" SELECT\r\n" +
|
||||
" M.RECEIVEREQUESTNAME,\r\n" +
|
||||
" SS.SPECNAME AS SDK_ID,\r\n" +
|
||||
" M.MATERIALSPECNAME,\r\n" +
|
||||
" M.PHASE,\r\n" +
|
||||
" M.REQUESTQUANTITY AS QTY,\r\n" +
|
||||
" (M.REQUESTQUANTITY - M.RECEIVEDQUANTITY) AS REQTY\r\n" +
|
||||
" FROM\r\n" +
|
||||
" BS_MES_SHIPPED BMS\r\n" +
|
||||
" LEFT JOIN MATERIALRECEIVEREQUESTDETAIL M ON\r\n" +
|
||||
" (BMS.REQUESTNAME = M.PRODUCTORDER\r\n" +
|
||||
" OR BMS.REQUESTNAME = M.PLANORDER)\r\n" +
|
||||
" AND BMS.PRODUCTSPECNAME = M.MATERIALSPECNAME\r\n" +
|
||||
" AND (NVL(BMS.SDK_ID, '~') = NVL(M.SDK_ID, '~'))\r\n" +
|
||||
" AND (NVL(BMS.PHASE, '~') = NVL(M.PHASE, '~'))\r\n" +
|
||||
" LEFT JOIN SDK_SPEC SS ON\r\n" +
|
||||
" BMS.SDK_ID = SS.SDK_ID\r\n" +
|
||||
" WHERE\r\n" +
|
||||
" BMS.LOTNAME = :MATERIALPACKINGNAME \r\n" +
|
||||
") SUBQUERY\r\n" +
|
||||
"GROUP BY\r\n" +
|
||||
" SDK_ID ,\r\n" +
|
||||
" MATERIALSPECNAME ,\r\n" +
|
||||
" PHASE";
|
||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(wgbg, bindMap);
|
||||
if (queryForList ==null || queryForList.size() < 1) {
|
||||
return AjaxResult.me().setSuccess(false).setMessage( list2.get(0).get("RECEIVEREQUESTNAME") + " 无法匹配完工报告,确认完工报告已开立");
|
||||
} else
|
||||
{
|
||||
String sysl = queryForList.get(0).get("REQTY") == null ? "0" : queryForList.get(0).get("REQTY").toString();
|
||||
String djsl = queryForList.get(0).get("QTY") == null ? "0" : queryForList.get(0).get("QTY").toString();
|
||||
if ("0".equals(sysl)) {
|
||||
return AjaxResult.me().setSuccess(false).setMessage(list2.get(0).get("RECEIVEREQUESTNAME") + "的完工报告已为0,不能继续使用");
|
||||
}
|
||||
String djdh = queryForList.get(0).get("RECEIVEREQUESTNAME") == null ? "" : queryForList.get(0).get("RECEIVEREQUESTNAME").toString();
|
||||
list2.get(0).put("REQTY", sysl);
|
||||
list2.get(0).put("QTY", djsl);
|
||||
list2.get(0).put("RECEIVEREQUESTNAME", djdh);
|
||||
}
|
||||
// }
|
||||
// String wgbg = "SELECT\r\n" +
|
||||
// " LISTAGG(RECEIVEREQUESTNAME, ',') WITHIN GROUP (\r\n" +
|
||||
// " ORDER BY RECEIVEREQUESTNAME) AS RECEIVEREQUESTNAME,\r\n" +
|
||||
// " SUM(REQTY) AS REQTY,\r\n" +
|
||||
// " SUM(QTY) AS QTY,\r\n" +
|
||||
// " SDK_ID ,\r\n" +
|
||||
// " MATERIALSPECNAME ,\r\n" +
|
||||
// " PHASE\r\n" +
|
||||
// "FROM\r\n" +
|
||||
// " (\r\n" +
|
||||
// " SELECT\r\n" +
|
||||
// " M.RECEIVEREQUESTNAME,\r\n" +
|
||||
// " SS.SPECNAME AS SDK_ID,\r\n" +
|
||||
// " M.MATERIALSPECNAME,\r\n" +
|
||||
// " M.PHASE,\r\n" +
|
||||
// " M.REQUESTQUANTITY AS QTY,\r\n" +
|
||||
// " (M.REQUESTQUANTITY - M.RECEIVEDQUANTITY) AS REQTY\r\n" +
|
||||
// " FROM\r\n" +
|
||||
// " BS_MES_SHIPPED BMS\r\n" +
|
||||
// " LEFT JOIN MATERIALRECEIVEREQUESTDETAIL M ON\r\n" +
|
||||
// " (BMS.REQUESTNAME = M.PRODUCTORDER\r\n" +
|
||||
// " OR BMS.REQUESTNAME = M.PLANORDER)\r\n" +
|
||||
// " AND BMS.PRODUCTSPECNAME = M.MATERIALSPECNAME\r\n" +
|
||||
// " AND (NVL(BMS.SDK_ID, '~') = NVL(M.SDK_ID, '~'))\r\n" +
|
||||
// " AND (NVL(BMS.PHASE, '~') = NVL(M.PHASE, '~'))\r\n" +
|
||||
// " LEFT JOIN SDK_SPEC SS ON\r\n" +
|
||||
// " BMS.SDK_ID = SS.SDK_ID\r\n" +
|
||||
// " WHERE\r\n" +
|
||||
// " BMS.LOTNAME = :MATERIALPACKINGNAME \r\n" +
|
||||
// ") SUBQUERY\r\n" +
|
||||
// "GROUP BY\r\n" +
|
||||
// " SDK_ID ,\r\n" +
|
||||
// " MATERIALSPECNAME ,\r\n" +
|
||||
// " PHASE";
|
||||
// List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(wgbg, bindMap);
|
||||
// if (queryForList ==null || queryForList.size() < 1) {
|
||||
// return AjaxResult.me().setSuccess(false).setMessage( list2.get(0).get("RECEIVEREQUESTNAME") + " 无法匹配完工报告,确认完工报告已开立");
|
||||
// } else
|
||||
// {
|
||||
// String sysl = queryForList.get(0).get("REQTY") == null ? "0" : queryForList.get(0).get("REQTY").toString();
|
||||
// String djsl = queryForList.get(0).get("QTY") == null ? "0" : queryForList.get(0).get("QTY").toString();
|
||||
// if ("0".equals(sysl)) {
|
||||
// return AjaxResult.me().setSuccess(false).setMessage(list2.get(0).get("RECEIVEREQUESTNAME") + "的完工报告已为0,不能继续使用");
|
||||
// }
|
||||
// String djdh = queryForList.get(0).get("RECEIVEREQUESTNAME") == null ? "" : queryForList.get(0).get("RECEIVEREQUESTNAME").toString();
|
||||
// list2.get(0).put("REQTY", sysl);
|
||||
// list2.get(0).put("QTY", djsl);
|
||||
// list2.get(0).put("RECEIVEREQUESTNAME", djdh);
|
||||
// }
|
||||
|
||||
return AjaxResult.me().setResultObj(list2);
|
||||
}
|
||||
|
@ -251,11 +251,12 @@ public class MaterialReceiveActController {
|
||||
" M.RECEIVEREQUESTDETAILNAME \r\n" +
|
||||
"FROM\r\n" +
|
||||
" MATERIALRECEIVEREQUESTDETAIL M\r\n" +
|
||||
" LEFT JOIN MATERIALSPEC c ON c.MATERIALSPECNAME = M.MATERIALSPECNAME\r\n" +
|
||||
"WHERE\r\n" +
|
||||
" M.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME\r\n" +
|
||||
" AND M.MATERIALSPECNAME = :MATERIALSPECNAME\r\n" +
|
||||
" AND (:PHASE IS NULL\r\n" +
|
||||
" OR PHASE = :PHASE)\r\n" +
|
||||
" OR c.PHASE = :PHASE)\r\n" +
|
||||
" AND (:SDK_ID IS NULL\r\n" +
|
||||
" OR SDK_ID = :SDK_ID)\r\n" +
|
||||
" AND M.REQUESTQUANTITY - M.RECEIVEDQUANTITY > 0";
|
||||
|
@ -18,4 +18,7 @@ public interface FgStockInDao {
|
||||
|
||||
//批量更新BS_MES_SHIPPED表的ReceiveFlag和ReceiveTime
|
||||
public void updateBsMesShipped(@Param("boxList") List<MaterialPacking> boxList) throws Exception;
|
||||
|
||||
// 获取packing是否存在
|
||||
public List<MaterialPacking> getBoxPacking(@Param("materialPackingName") String materialPackingName) throws Exception;
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
||||
}
|
||||
if ("1".equals(operationType)) { // 自动入库
|
||||
if ("FG".equals(stockInType) || "BFG".equals(stockInType)) { // 产成品入库 增加回收粒子入库
|
||||
fgStockIn = productIntoServiceImpl.fgStockIn(receiveActNo, "MES");
|
||||
fgStockIn = productIntoServiceImpl.outoFgStockIn(receiveActNo, "MES");
|
||||
if (fgStockIn.isEmpty()) {
|
||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||
}
|
||||
|
@ -305,7 +305,11 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
packingList1.setSiteName("SDK");
|
||||
packingList1.setMaterialPackingName(packingList.get(i).getMaterialPackingName());
|
||||
packingList1.setUserColumns(stringObjectMap);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().create(eventInfo, packingList1);
|
||||
|
||||
List<MaterialPacking> mPackingList = fgStockInDao.getBoxPacking(packingList.get(i).getMaterialPackingName());
|
||||
if (mPackingList.size() == 0) {
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().create(eventInfo, packingList1);
|
||||
}
|
||||
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",packingList.get(i).getMaterialPackingName());
|
||||
arrayList.add(materialPackingKey);
|
||||
@ -313,17 +317,24 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
//调用Sap入库接口
|
||||
List<ToSAPFgStockInDto> fgStockInInfo = toSapDao.getFgStockInInfo(boxList);
|
||||
|
||||
//封装为Json的字符串
|
||||
String json = JSON.toJSONString(fgStockInInfo);
|
||||
//现sap没有手动直接入库
|
||||
// String undoID = toSAPService.FGStockInByManulIn(json, user);
|
||||
String receiveFlag = packingList.get(0).getMesReceiveFlag();
|
||||
String undoID = "";
|
||||
if(receiveFlag.equals("Z")) {
|
||||
//先入到线边仓,从线边再转库
|
||||
String aimErpFactory = boxList.get(0).getErpFactory();
|
||||
String aimErpLocation = boxList.get(0).getErpLocation();
|
||||
String aimLOcationName = boxList.get(0).getLocationName();
|
||||
undoID = toSAPService.NoSourceChangeLocation(arrayList,aimErpFactory,
|
||||
aimErpLocation, aimLOcationName, user );
|
||||
}else {
|
||||
// 直接入库
|
||||
//封装为Json的字符串
|
||||
String json = JSON.toJSONString(fgStockInInfo);
|
||||
undoID = toSAPService.FGStockInByManulIn(json, user);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//手动先入到线边仓,再转库
|
||||
String aimErpFactory = boxList.get(0).getErpFactory();
|
||||
String aimErpLocation = boxList.get(0).getErpLocation();
|
||||
String aimLOcationName = boxList.get(0).getLocationName();
|
||||
String undoID = toSAPService.NoSourceChangeLocation(arrayList,aimErpFactory,
|
||||
aimErpLocation, aimLOcationName, user );
|
||||
|
||||
|
||||
//更新物料凭证和库存状态
|
||||
@ -396,7 +407,7 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
if(queryForList == null || queryForList.size() < 1) {
|
||||
throw new RuntimeException("不存在要入库的信息");
|
||||
}
|
||||
String materialSpecName = queryForList.get(0).get("MATERIALSPECNAME").toString();
|
||||
String materialSpecName = queryForList.get(0).get("MATERIALSPECNAME") == null ? "" : queryForList.get(0).get("MATERIALSPECNAME").toString();
|
||||
MaterialSpec materialSpec = new MaterialSpec();
|
||||
MaterialSpecKey materialSpecKey = new MaterialSpecKey();
|
||||
materialSpecKey.setMaterialSpecName(materialSpecName);
|
||||
@ -752,6 +763,42 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(sql2, hashMap2);
|
||||
|
||||
|
||||
String sql3 = "UPDATE MATERIALRECEIVEACT SET RECEIVEACTSTATE = 'Received' WHERE RECEIVEACTNO = :RECEIVEACTNO";
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(sql3, hashMap);
|
||||
|
||||
}
|
||||
String commitDate=TimeStampUtil.getCurrentTime("yyyy-MM-dd");
|
||||
SaveUnDoInfo( billCode, commitDate);
|
||||
//更新MES标识
|
||||
return billCode;
|
||||
}
|
||||
//自动成品入库到现场仓
|
||||
public String outoFgStockIn (String RECEIVEACTNO, String eventUser) throws Exception {
|
||||
|
||||
String billCode = toSAPService.FGStockIn2(RECEIVEACTNO, eventUser);
|
||||
if (billCode == null) {
|
||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
||||
}
|
||||
EventInfo makeEventInfo = EventInfoUtil.makeEventInfo("FGStockIn", eventUser, "FGStockIn", "", "");
|
||||
//更新抬头文本状态和Box状态
|
||||
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M WHERE M.RECEIVEACTNO = :RECEIVEACTNO";
|
||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||
hashMap.put("RECEIVEACTNO", RECEIVEACTNO);
|
||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||
for (Map<String, Object> map : queryForList) {
|
||||
MaterialPackingKey materialPackingKey = new MaterialPackingKey(map.get("SITENAME").toString(),map.get("MATERIALPACKINGNAME").toString());
|
||||
SetEventInfo setEventInfo = new SetEventInfo();
|
||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||
bindMap.put("unDoID", billCode);
|
||||
bindMap.put("stockState", "Stocked");
|
||||
setEventInfo.setUserColumns(bindMap);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
||||
|
||||
String sql2 = "UPDATE BS_MES_SHIPPED T SET T.RECEIVE_FLAG = 'Z', T.RECEIVE_TIME = SYSDATE WHERE T.LOTNAME = :LOTNAME";
|
||||
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||
hashMap2.put("LOTNAME", map.get("MATERIALPACKINGNAME").toString());
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(sql2, hashMap2);
|
||||
|
||||
String sql3 = "UPDATE MATERIALRECEIVEACT SET RECEIVEACTSTATE = 'Received' WHERE RECEIVEACTNO = :RECEIVEACTNO";
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(sql3, hashMap);
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
T.QTY MATERIALQUANTITY,
|
||||
T.QTY SUBPACKINGQUANTITY,
|
||||
T.QTY MaterialCreateQuantity,
|
||||
T.RECEIVE_FLAG mesReceiveFlag,
|
||||
'SDK' siteName,
|
||||
'Released' PackingState,
|
||||
'Created' stockState,
|
||||
@ -71,4 +72,9 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getBoxPacking"
|
||||
resultType="com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking" parameterType="java.util.List">
|
||||
SELECT MATERIALPACKINGNAME FROM MATERIALPACKING m WHERE MATERIALPACKINGNAME = #{materialPackingName}
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user