Compare commits

...

2 Commits

Author SHA1 Message Date
李兴辉
342c54999d Merge remote-tracking branch 'origin/main' 2025-03-24 10:46:46 +08:00
李兴辉
cd36fede33 1) PC 备货出库
2) PC 备货出库(太仓)
3) PC 预备货出库
4) PDA 备货出库
5) PDA 预备货出库
6) PDA 非先进先出出库
7) PDA 销售出货
2025-03-24 10:46:38 +08:00
5 changed files with 348 additions and 323 deletions

View File

@ -392,7 +392,7 @@ public class InvoiceController {
/*****************************************出库过账********************************************************************************/
@RequestMapping(value = "/commitShipRequestNameNew", method = RequestMethod.POST)
public AjaxResult commitShipRequestNameNew(@RequestBody JSONObject in ) throws Exception{
public AjaxResult commitShipRequestNameNew(@RequestBody JSONObject in ) {
StockOutDto ms = JSON.toJavaObject(in, StockOutDto.class);
String shipRequestName = ms.getShipRequestName();
String siteName = ms.getSiteName();
@ -413,13 +413,17 @@ public class InvoiceController {
String type = queryForList.get(0).get("SHIPREQUESTTYPE").toString();
shipRequestType = type;
} else {
throw new CustomException("找不到出库单据" + shipRequestName);
return AjaxResult.me().setErrorCode(500).setMessage("找不到出库单据" + shipRequestName);
}
InvoiceServiceImpl.SendERPStockOut20240802(shipRequestName, siteName, user, boxList,commitDate,opCode);
try {
InvoiceServiceImpl.SendERPStockOut20240802(shipRequestName, siteName, user, boxList,commitDate,opCode);
} catch (Exception e) {
return AjaxResult.me().setErrorCode(500).setMessage(e.toString());
}
return AjaxResult.me().setResultObj(null);
return AjaxResult.me().setResultObj(null);
}
@ -864,7 +868,7 @@ public class InvoiceController {
" T.SHIPREQUESTNAME = M.SHIPREQUESTNAME\r\n" +
"WHERE\r\n" +
" T.SHIPREQUESTNAME LIKE :SHIPREQUESTNAME \r\n" +
" AND SHIPREQUESTTYPE NOT IN ( 'SaleOutPre', '4E') " +
// " AND SHIPREQUESTTYPE NOT IN ( 'SaleOutPre', '4E') " +
"AND SHIPREQUESTSTATE <> 'Completed' AND M.ERPFACTORY = :ERPFACTORY ORDER BY M.ORDERDATE ASC,SHIPREQUESTNAME)";
Map<String, Object> bindMap = new HashMap<String, Object>();
@ -1104,7 +1108,7 @@ public class InvoiceController {
bindMap.put("ERPFACTORY",erpfactory);
List<Map<String,Object>> list = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, bindMap);
if(Objects.isNull(list) || list.isEmpty()) {
throw new GlobalException("未找到对应的数据!");
return AjaxResult.me().setErrorCode(500).setMessage("未找到对应的数据!");
}
return AjaxResult.me().setResultObj(list);
}

View File

@ -1,307 +0,0 @@
//package com.cim.idm.controller;
//
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.cim.idm.data.ErpMessageLog;
//import com.cim.idm.exception.GlobalException;
//import com.cim.idm.framework.IDMFrameServiceProxy;
//import com.cim.idm.framework.data.EventInfo;
//import com.cim.idm.framework.orm.SqlTemplate;
//import com.cim.idm.framework.util.sys.SystemPropHelper;
//import com.cim.idm.framework.util.time.TimeStampUtil;
//import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
//import com.cim.idm.service.Impl.ProductIntoServiceImpl;
//import com.cim.idm.service.Impl.ReturnStockIntoServiceImpl;
//import com.cim.idm.service.QMSService;
//import com.cim.idm.service.impl.ToSAPServiceImpl;
//import com.cim.idm.util.MessageLogUtil;
//import com.cim.idm.utils.AjaxResult;
//import com.cim.idm.utils.CommonUtils;
//import com.cim.idm.utils.EventInfoUtil;
//import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
//import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey;
//import com.cim.idm.wmspackage.name.NameServiceProxy;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiResponse;
//import io.swagger.annotations.ApiResponses;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.transaction.annotation.Transactional;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.sql.Timestamp;
//import java.text.ParseException;
//import java.util.*;
//
//@Api("接收MES请求接口")
//@RestController
//@RequestMapping("/api/wms")
//@Slf4j
//public class MESController {
//
//
// @Autowired
// private ToSAPServiceImpl toSAPService;
// @Autowired
// private SqlTemplate sqlTemplate;
// @Autowired
// private ProductIntoServiceImpl productIntoServiceImpl;
// @Autowired
// private ReturnStockIntoServiceImpl returnStockIntoServiceImpl;
// @Autowired
// private QMSService qmsService;
//
//
// // 提取公共方法更新库存
// private void updateMaterialPackingStock(List<String> boxIdList, List<String> qtyList) {
// String sqlu = "UPDATE MATERIALPACKINGMDC m SET m.MATERIALQUANTITY = m.MATERIALQUANTITY - :QTY, "
// + "m.EVENTTIME = SYSDATE, m.EVENTNAME = :EVENTNAME WHERE m.CHARGE = :CHARGE";
// for (int j = 0; j < boxIdList.size(); j++) {
// Map<String, Object> bp = new HashMap<>();
// bp.put("CHARGE", boxIdList.get(j));
// bp.put("QTY", qtyList.get(j));
// bp.put("EVENTNAME", "MESCONSUME");
// IDMFrameServiceProxy.getSqlTemplate().update(sqlu, bp);
// }
// }
//
// // 提取公共方法插入BS_MES_SHIPPED表
// @Transactional
// private void insertIntoBsMesShipped(Map<String, Object> bindMap) throws RuntimeException {
// String insertSql = "INSERT INTO BS_MES_SHIPPED(LOTNAME, QTY, UNIT, REQUESTNAME, AREA, "
// + "PRODUCTSPECNAME, PRODUCTNAME, SDK_ID, PHASE, RECEIVE_FLAG, REMARK, SHIPTIME, "
// + "SHIPUSER, SITENAME, MATERIALSPECTYPE, INVENTORYTYPE, SALENO, SALEDETAILNO, "
// + "ERPLOCATION, CHARGE, LOCATIONNAME, OPERATIONTYPE, ERPFACTORY, GXID) "
// + "VALUES(:LOTNAME, :QTY, :UNIT, :REQUESTNAME, :AREA, :PRODUCTSPECNAME, "
// + ":PRODUCTNAME, :SDK_ID, :PHASE, 'N', :REMARK, :SHIPTIME, 'MES', 'SDK', "
// + ":MATERIALSPECTYPE, :INVENTORYTYPE, :SALENO, :SALEDETAILNO, :ERPLOCATION, "
// + ":CHARGE, :LOCATIONNAME, :OPERATIONTYPE, :ERPFACTORY, :GXID)";
// int update = sqlTemplate.update(insertSql, bindMap);
// if (update != 1) {
// throw new RuntimeException("插入BS_MES_SHIPPED表失败");
// }
// }
//
// // 优化后的materialConsume_Request方法
//
// @ApiOperation(value = "物料消耗请求")
// @RequestMapping(value = "/meswms_materialconsume_request", method = RequestMethod.POST)
// public AjaxResult materialConsume_Request(@RequestBody JSONArray in) {
// log.debug("***********************************");
// log.debug("RCRQ " + in.toString());
// log.debug("***********************************");
// AjaxResult result = new AjaxResult();
// ErpMessageLog loginfo = new ErpMessageLog();
// loginfo.setServerName("MESToWms");
// loginfo.setMessageId("");
// loginfo.setEventUser("MES");
// loginfo.setId(TimeStampUtil.getCurrentEventTimeKey());
// loginfo.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
// loginfo.setSendMsg(in.toJSONString());
// loginfo.setEventName("materialConsume_Request");
//
// List<String> boxIdList = new ArrayList<>();
// List<String> qtyList = new ArrayList<>();
// String wo = "";
// try {
// for (int i = 0; i < in.size(); i++) {
// JSONObject jb = in.getJSONObject(i);
// String charge = jb.getString("charge"); // 批号
// String qty = jb.getString("qty"); // 消耗数量
// wo = jb.getString("requestName"); // 工单
// boxIdList.add(charge);
// qtyList.add(qty);
// }
// // 调用SAP服务
// String undoId = toSAPService.mesMaterialConsume(boxIdList, qtyList, "MES", wo);
// // 更新库存
// updateMaterialPackingStock(boxIdList, qtyList);
//
// result = AjaxResult.me().setSuccess(true).setErrorCode(200).setMessage("执行成功");
// loginfo.setResultCode("0");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// } catch (Exception e) {
// log.error("物料消耗失败: {}", e.getMessage());
// result = AjaxResult.me().setSuccess(false).setErrorCode(500).setMessage(e.toString());
// loginfo.setResultCode("1");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// } finally {
// MessageLogUtil.writeMessageLog(loginfo);
// }
// return result;
// }
//
// //MES接收物料后调用触发WMS进行出库过帐zd.2024.8.23
// @ApiOperation(value = "物料出库请求")
// @RequestMapping(value = "/meswms_materialout_request", method = RequestMethod.POST)
// public AjaxResult materialOutByMES(@RequestBody JSONArray in) {
// log.debug("***********************************");
// log.debug("RCRQ "+in.toString());
// log.debug("***********************************");
// AjaxResult result = new AjaxResult();
// ErpMessageLog loginfo = new ErpMessageLog();
// loginfo.setServerName("MESToWms");
// loginfo.setMessageId("");
// loginfo.setEventUser("MES");
// loginfo.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
// loginfo.setSendMsg(in.toJSONString());
// loginfo.setEventName("MaterialOut_Request");
//
// List<String> boxIdList = new ArrayList<> ();
// String shipRequestName="";
// for (int i = 0; i < in.size(); i++) {
// JSONObject jb = in.getJSONObject(i);
// String charge = jb.get("charge").toString();//批号
// shipRequestName= jb.get("shipRequestName").toString();//领料单号
// boxIdList.add(charge);
//
// }
// try {
//
// String billCode=new ToSAPServiceImpl().ProductionStockOut_NEW(shipRequestName, "SDK", "MES",boxIdList);
//
// EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("CompleteShipRequest", "MES", "CompleteShipRequest:MES Receive");
// new CommonUtils().SaveUnDoInfo_ForSap(boxIdList, billCode, makeEventInfo);
//
//
// result = AjaxResult.me().setSuccess(true).setErrorCode(200).setMessage("执行成功");
// loginfo.setResultCode("S");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// // 消息保存日志erp推送wms的数据写入表BS_ERPMESSAGELOG中
// MessageLogUtil.writeMessageLog(loginfo);
// }catch(Exception e) {
// result = AjaxResult.me().setSuccess(false).setErrorCode(1).setMessage("执行失败");
// loginfo.setResultCode("E");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// // 消息保存日志erp推送wms的数据写入表BS_ERPMESSAGELOG中
// MessageLogUtil.writeMessageLog(loginfo);
// }
// return result;
// }
//
// @ApiOperation(value = "取消入库请求")
// @RequestMapping(value = "/meswms_cancelship_request", method = RequestMethod.POST)
// public AjaxResult cancelShipByMES(@RequestBody JSONArray in) {
// log.debug("***********************************");
// log.debug("RCRQ "+in.toString());
// log.debug("***********************************");
// AjaxResult result = new AjaxResult();
// ErpMessageLog loginfo = new ErpMessageLog();
// loginfo.setServerName("MESToWms");
// loginfo.setMessageId("");
// loginfo.setEventUser("MES");
// loginfo.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
// loginfo.setSendMsg(in.toJSONString());
// loginfo.setEventName("CancelShip_Request");
//
// List<String> boxIdList = new ArrayList<> ();
// //首先查看要退料还是退产成品
// //
// for (int i = 0; i < in.size(); i++) {
// JSONObject jb = in.getJSONObject(i);
// String charge = jb.get("charge").toString();//批号
// boxIdList.add(charge);
//
// }
// try {
// String sqld = "DELETE FROM BS_MES_SHIPPED b WHERE b.CHARGE in(:BOXIDLIST) AND NVL(b.receive_flag,'N')<>'Y' ";
// Map<String, Object> hashMap = new HashMap<String,Object> ();
// hashMap.put("BOXIDLIST", boxIdList);
// IDMFrameServiceProxy.getSqlTemplate().update(sqld, hashMap);
//
// result = AjaxResult.me().setSuccess(true).setErrorCode(200).setMessage("执行成功");
// loginfo.setResultCode("S");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// // 消息保存日志erp推送wms的数据写入表BS_ERPMESSAGELOG中
// MessageLogUtil.writeMessageLog(loginfo);
// }catch(Exception e) {
// result = AjaxResult.me().setSuccess(false).setErrorCode(500).setMessage("执行失败");
// loginfo.setResultCode("E");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// // 消息保存日志erp推送wms的数据写入表BS_ERPMESSAGELOG中
// MessageLogUtil.writeMessageLog(loginfo);
// }
// return result;
// }
//
//
// // 优化后的shipByMES方法
// @ApiOperation(value = "物料入库请求")
// @RequestMapping(value = "/meswms_ship_request", method = RequestMethod.POST)
// public AjaxResult shipByMES(@RequestBody JSONArray in) {
// log.debug("***********************************");
// log.debug("RCRQ " + in.toString());
// log.debug("***********************************");
// AjaxResult result = new AjaxResult();
// ErpMessageLog loginfo = new ErpMessageLog();
// try {
// loginfo.setServerName("MESToWms");
// loginfo.setMessageId("");
// loginfo.setEventUser("MES");
// loginfo.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
// loginfo.setSendMsg(in.toJSONString());
// loginfo.setEventName("Ship_Request");
//
// List<String> boxIdList = new ArrayList<>();
// List<String> barCodeList = new ArrayList<>();
// String stockInType = "";
// String operationType = "";
// if (in != null && in.size() > 0) {
// for (int i = 0; i < in.size(); i++) {
// JSONObject jo = in.getJSONObject(i);
// String charge = jo.getString("charge");
// String lotname = jo.getString("lotName");
// boxIdList.add(charge);
// barCodeList.add(lotname);
//
// // 插入BS_MES_SHIPPED表
// Map<String, Object> bindMap = new HashMap<>();
// bindMap.put("LOTNAME", lotname);
// bindMap.put("QTY", jo.getDoubleValue("qty"));
// bindMap.put("UNIT", jo.getString("unit"));
// bindMap.put("REQUESTNAME", jo.getString("requestName"));
// bindMap.put("AREA", jo.getString("area"));
// bindMap.put("PRODUCTSPECNAME", jo.getString("productSpecName"));
// bindMap.put("PRODUCTNAME", jo.getString("productName"));
// bindMap.put("SDK_ID", jo.getString("sdkId"));
// bindMap.put("PHASE", jo.getString("phase"));
// bindMap.put("REMARK", jo.getString("remark"));
// bindMap.put("SHIPTIME", TimeStampUtil.getTimestamp(jo.getString("shipTime")));
// bindMap.put("SHIPUSER", jo.getString("shipUser"));
// bindMap.put("INVENTORYTYPE", jo.getString("inventoryType"));
// bindMap.put("SALENO", jo.getString("saleNo"));
// bindMap.put("SALEDETAILNO", jo.getString("saleDetailNo"));
// bindMap.put("ERPLOCATION", jo.getString("erpLocation"));
// bindMap.put("LOCATIONNAME", jo.getString("locationName"));
// bindMap.put("OPERATIONTYPE", jo.getString("operationType"));
// bindMap.put("ERPFACTORY", jo.getString("erpFactory"));
// bindMap.put("MATERIALSPECTYPE", jo.getString("stockInType"));
// bindMap.put("CHARGE", charge);
// bindMap.put("GXID", jo.getString("gxId"));
//
// insertIntoBsMesShipped(bindMap);
// }
// }
// result = AjaxResult.me().setSuccess(true).setErrorCode(200).setMessage("执行成功");
// loginfo.setResultCode("S");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// } catch (Exception e) {
// log.error("发货失败: {}", e.getMessage());
// result = AjaxResult.me().setSuccess(false).setErrorCode(500).setMessage(e.toString());
// loginfo.setResultCode("E");
// loginfo.setReturnMsg(JSONObject.toJSONString(result));
// } finally {
// MessageLogUtil.writeMessageLog(loginfo);
// }
// return result;
// }
//}
//
//

View File

@ -0,0 +1,328 @@
package com.cim.idm.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cim.idm.framework.IDMFrameServiceProxy;
import com.cim.idm.model.MaterialReceiveRequest;
import com.cim.idm.utils.AjaxResult;
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy;
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.cim.idm.service.Impl.InvoiceServiceImpl;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Api("单据接口")
@RestController
@RequestMapping("/purchase")
@EnableAutoConfiguration
public class PurchaseReturnController {
@Autowired
private InvoiceServiceImpl InvoiceServiceImpl;
/**
* 获取采购退货单号列表
* @param in
* @return
*/
@RequestMapping(value = "/getPurchaseReturnList", method = RequestMethod.POST)
public AjaxResult getPurchaseReturnList(@RequestBody JSONObject in ){
MaterialReceiveRequest materialReceiveRequest = JSON.toJavaObject(in, MaterialReceiveRequest.class);
String receiverequestname = materialReceiveRequest.getReceiveRequestName() == null ? "" : materialReceiveRequest.getReceiveRequestName();
String erpfactory = materialReceiveRequest.getErpFactory();
String siteName = materialReceiveRequest.getSiteName();
String sql = "SELECT\r\n" +
" DISTINCT M.RECEIVEREQUESTNAME\r\n" +
"FROM\r\n" +
" MATERIALRECEIVEREQUESTDETAIL M\r\n" +
" LEFT JOIN MATERIALRECEIVEREQUEST R ON\r\n" +
" R.RECEIVEREQUESTNAME = M.RECEIVEREQUESTNAME\r\n" +
"WHERE\r\n" +
" M.SITENAME = :SITENAME\r\n" +
// " AND R.RECEIVEREQUESTTYPE = '45'\r\n" +
" AND R.RETURNFLAG = 'Y'\r\n" +
" AND R.RECEIVEREQUESTSTATE <> 'Completed'\r\n" +
" AND M.ERPFACTORY = :ERPFACTORY\r\n" +
" AND M.RECEIVEREQUESTNAME LIKE :RECEIVEREQUESTNAME";
Map<String, Object> bindMap = new HashMap<String, Object>();
bindMap.put("SITENAME",siteName);
bindMap.put("RECEIVEREQUESTNAME","%" + receiverequestname + "%");
bindMap.put("ERPFACTORY",erpfactory);
List<Map<String,Object>> list = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, bindMap);
if(Objects.isNull(list) || list.isEmpty()) {
return AjaxResult.me().setErrorCode(500).setMessage("未找到对应的数据!");
}
return AjaxResult.me().setResultObj(list);
}
/**
* 获取采购退货单信息
* @param in
* @return
*/
@RequestMapping(value = "/getPurchaseReturnInfo", method = RequestMethod.POST)
public AjaxResult getPurchaseReturnInfo(@RequestBody JSONObject in ){
MaterialReceiveRequest materialReceiveRequest = JSON.toJavaObject(in, MaterialReceiveRequest.class);
String receiverequestname = materialReceiveRequest.getReceiveRequestName() == null ? "" : materialReceiveRequest.getReceiveRequestName();
String erpfactory = materialReceiveRequest.getErpFactory();
String siteName = materialReceiveRequest.getSiteName();
String sql = "SELECT A.RECEIVEREQUESTNAME,A.RECEIVEREQUESTDETAILNAME,C.MATERIALSPECNAME,A.DESCRIPTION,\r\n" +
"m.FNAME MATERIALUNIT,A.REQUESTQUANTITY,A.CHARGE,A.RECEIVEDQUANTITY,C.DESC_CN,\r\n" +
"A.ERPLOCATION,D.ERPFACTORY,D.RETURNFLAG,D.SITENAME,'0' AS SELECTEDQUANTITY,A.SDK_ID,A.PHASE\r\n" +
"from\r\n" +
"MATERIALRECEIVEREQUESTDETAIL A LEFT JOIN MATERIALUNIT m ON A.MATERIALUNIT = m.FNUMBER ,MATERIALSPEC C,MATERIALRECEIVEREQUEST D \r\n" +
"where A.SITENAME = :SITENAME\r\n" +
"AND A.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME\r\n" +
"AND D.RECEIVEREQUESTNAME = A.RECEIVEREQUESTNAME\r\n" +
"AND A.MATERIALSPECNAME = C.MATERIALSPECNAME\r\n" +
"AND D.RETURNFLAG='Y'\r\n" +
"ORDER BY A.RECEIVEREQUESTDETAILNAME";
Map<String, Object> bindMap = new HashMap<String, Object>();
bindMap.put("SITENAME",siteName);
bindMap.put("RECEIVEREQUESTNAME",receiverequestname);
List<Map<String,Object>> list = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, bindMap);
if(Objects.isNull(list) || list.isEmpty()) {
return AjaxResult.me().setErrorCode(500).setMessage("未找到对应的数据!");
}
return AjaxResult.me().setResultObj(list);
}
/**
* 备货或者取消
* @param in
* @return
*/
@Transactional
@RequestMapping(value = "/purDessignOrAssign", method = RequestMethod.POST)
public AjaxResult UnFIFODessignOrAssign(@RequestBody JSONObject in ){
MaterialReceiveRequest materialReceiveRequest = JSON.toJavaObject(in, MaterialReceiveRequest.class);
String type = materialReceiveRequest.getType();//Assign 备货 Dessign 解绑
String materialPackingName = materialReceiveRequest.getMaterialPackingName();//标签
String materialSpecName = materialReceiveRequest.getMaterialSpecName();
String receiveRequestName = materialReceiveRequest.getReceiveRequestName();
String materialQuantity = materialReceiveRequest.getMaterialQuantity();
String materialQuantity2 = materialReceiveRequest.getMaterialQuantity2();
String sdk_id = materialReceiveRequest.getSdk_id() == null ? "" : materialReceiveRequest.getSdk_id();
String phase = materialReceiveRequest.getPhase() == null ? "" : materialReceiveRequest.getPhase();
String user = materialReceiveRequest.getUser();
//根据条码查询库存状态
String judge = "SELECT\r\n" +
"m.SDK_ID,MATERIALSPECNAME,\r\n" +
"m.PHASE,\r\n" +
"CASE WHEN MATERIALQUANTITY2 > 0 THEN MATERIALQUANTITY2\r\n" +
"ELSE MATERIALQUANTITY END MATERIALQUANTITY2 ,\r\n" +
"m.SHIPREQUESTNAME,\r\n" +
"m.STOCKSTATE,\r\n" +
"m.PACKINGGRADE ,\r\n" +
"m.OQARESULTSTATE,\r\n" +
"m.SPECIALSTATE,\r\n" +
"m.OQARESULT\r\n" +
"FROM\r\n" +
"MATERIALPACKING m\r\n" +
"WHERE\r\n" +
"m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME AND \r\n" +
"m.PACKINGSTATE='Released' AND m.HOLDSTATE='N'";
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
hashMap2.put("MATERIALPACKINGNAME", materialPackingName);
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(judge, hashMap2);
if (queryForList2 != null && queryForList2.size() > 0) {
materialSpecName = queryForList2.get(0).get("MATERIALSPECNAME") == null ? "" : queryForList2.get(0).get("MATERIALSPECNAME").toString();
sdk_id = queryForList2.get(0).get("SDK_ID") == null ? "" : queryForList2.get(0).get("SDK_ID").toString();
phase = queryForList2.get(0).get("PHASE") == null ? "" : queryForList2.get(0).get("PHASE").toString();
materialQuantity2 = queryForList2.get(0).get("MATERIALQUANTITY2") == null ? "" : queryForList2.get(0).get("MATERIALQUANTITY2").toString();
String invoice = queryForList2.get(0).get("SHIPREQUESTNAME") == null ? "" : queryForList2.get(0).get("SHIPREQUESTNAME").toString();
String stockState = queryForList2.get(0).get("STOCKSTATE") == null ? "" : queryForList2.get(0).get("STOCKSTATE").toString();
String packinggrade = queryForList2.get(0).get("PACKINGGRADE") == null ? "" : queryForList2.get(0).get("PACKINGGRADE").toString();
// String exp = queryForList2.get(0).get("EXP") == null ? "" : queryForList2.get(0).get("EXP").toString();
String oqaresultstate = queryForList2.get(0).get("OQARESULTSTATE") == null ? "" : queryForList2.get(0).get("OQARESULTSTATE").toString();
// String oqaresult = queryForList2.get(0).get("OQARESULT") == null ? "" : queryForList2.get(0).get("OQARESULT").toString();
String specialstate = queryForList2.get(0).get("SPECIALSTATE") == null ? "" : queryForList2.get(0).get("SPECIALSTATE").toString();
if (!"Stocked".equals(stockState)) {
return AjaxResult.me().setSuccess(false).setMessage("条码不在库!");
}
if (!"NG".equals(packinggrade)) {
return AjaxResult.me().setSuccess(false).setMessage("批次不能为合格!");
}
// if (!"1".equals(exp)) {
// return AjaxResult.me().setSuccess(false).setMessage("批次已过期!");
// }
if ("PREOQA".equals(oqaresultstate)) {
return AjaxResult.me().setSuccess(false).setMessage("质检状态不对!");
}
// if (!"".equals(invoice)) {
// return AjaxResult.me().setSuccess(false).setMessage("条码已被" + invoice + "备货!");
// }
if (!"2".equals(specialstate)) {
return AjaxResult.me().setSuccess(false).setMessage("批次不是退供应商状态!");
}
} else {
return AjaxResult.me().setSuccess(false).setMessage("未找到相对应的条码!");
}
//查询单据类型
String sql = "SELECT \r\n" +
" m.RECEIVEREQUESTTYPE,\r\n" +
" m.RECEIVEREQUESTDETAILTYPE,\r\n" +
" t.RECEIVEREQUESTDETAILNAME,\r\n" +
" t.MATERIALSPECNAME ,\r\n" +
" SUM(t.REQUESTQUANTITY - t.RECEIVEDQUANTITY) MINUSQTY,t.SDK_ID,t.PHASE\r\n" +
" FROM\r\n" +
" MATERIALRECEIVEREQUESTDETAIL t\r\n" +
" LEFT JOIN MATERIALRECEIVEREQUEST m ON\r\n" +
" t.RECEIVEREQUESTNAME = m.RECEIVEREQUESTNAME\r\n" +
" WHERE\r\n" +
" m.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME\r\n" +
" AND t.MATERIALSPECNAME = :MATERIALSPECNAME\r\n" +
" AND (:SDK_ID IS NULL\r\n" +
" OR t.SDK_ID = :SDK_ID)\r\n" +
" AND (:PHASE IS NULL OR t.PHASE = :PHASE)\r\n" +
" GROUP BY m.RECEIVEREQUESTTYPE ,\r\n" +
" m.RECEIVEREQUESTDETAILTYPE,t.RECEIVEREQUESTDETAILNAME,\r\n" +
" t.MATERIALSPECNAME,t.SDK_ID,t.PHASE\r\n" +
" ORDER BY\r\n" +
" t.MATERIALSPECNAME ,\r\n" +
" t.SDK_ID,\r\n" +
" t.PHASE";
Map<String, Object> hashMap = new HashMap<String,Object> ();
hashMap.put("RECEIVEREQUESTNAME", receiveRequestName);
hashMap.put("MATERIALSPECNAME", materialSpecName);
hashMap.put("SDK_ID", sdk_id);
hashMap.put("PHASE", phase);
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
if(Objects.isNull(queryForList) || queryForList.isEmpty()) {
return AjaxResult.me().setSuccess(false).setMessage("条码与单据无法匹配!");
}
String shipRequestType = queryForList.get(0).get("RECEIVEREQUESTTYPE").toString();
String shipRequestDetailType = queryForList.get(0).get("RECEIVEREQUESTDETAILTYPE").toString();
String receiveRequestDetailName = queryForList.get(0).get("RECEIVEREQUESTDETAILNAME").toString();
String minusQty = queryForList.get(0).get("MINUSQTY").toString();
BigDecimal FminusQty = new BigDecimal(minusQty);
BigDecimal Fzero = new BigDecimal(0);
//"SHIPREQUESTDETAILTYPE": "4Y-Cxx-03",//跨组织领料调拨单
//"BLSQ4K".equals(shipRequestType) || "4Y".equals(shipRequestType) || "CKSQ4I".equals(shipRequestType)
int dy0 = FminusQty.compareTo(Fzero);
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",materialPackingName);
com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking selectByKey = MaterialPackingServiceProxy.getMaterialPackingService().selectByKey(materialPackingKey);
if ("Assign".equals(type)) {
System.out.println("45".equals(shipRequestType) + "*****************");
if (dy0 < 0) {//只能超发一个
return AjaxResult.me().setSuccess(false).setMessage("采购退货不允许超发!");
}
// if ("4Y".equals(shipRequestType)) {//调拨单
// if ( "4Y-Cxx-03".equals(shipRequestDetailType)) {
// if (dy0 < 0) {//只能超发一个
// return AjaxResult.me().setSuccess(false).setMessage("只能超发一个不能出库了!");
// }
// }
// } else if ("BLSQ4K".equals(shipRequestType)) {//领料
// if (dy0 < 0) {//只能超发一个
// return AjaxResult.me().setSuccess(false).setMessage("只能超发一个不能出库了!");
// }
// } else if ("CKSQ4I".equals(shipRequestType)) { //其他出库
// if (dy0 < 0) {//只能超发一个
// return AjaxResult.me().setSuccess(false).setMessage("只能超发一个不能出库了!");
// }
// } else if ("4C".equals(shipRequestType)) {
// if (dy0 < 0) {//只能超发一个
// return AjaxResult.me().setSuccess(false).setMessage("销售不允许超发!");
// }
// }else {
// return AjaxResult.me().setSuccess(false).setMessage("单据类型不正确!");
// }
} else if ("Dessign".equals(type)) {
}
try {
InvoiceServiceImpl.Reserve3(selectByKey, receiveRequestName,receiveRequestDetailName, materialSpecName,sdk_id, phase, type, "SDK", user,materialQuantity2,"N");
} catch (CustomException e) {
e.printStackTrace();
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
}
return AjaxResult.me().setSuccess(true).setMessage("备货成功");
}
/**
* 查询单据时自动备货
* @param in
* @return
*/
@Transactional
@RequestMapping(value = "/getPurPackingInfo", method = RequestMethod.POST)
public AjaxResult getReservePackingInfo(@RequestBody JSONObject in ){
MaterialReceiveRequest materialShipRequest = JSON.toJavaObject(in, MaterialReceiveRequest.class);
String receiveRequestName = materialShipRequest.getReceiveRequestName() == null ? "" : materialShipRequest.getReceiveRequestName();
String user = materialShipRequest.getUser();
String ressSql = "SELECT\r\n" +
" A.MATERIALPACKINGNAME ,A.MATERIALSPECNAME,A.MATERIALQUANTITY, CASE WHEN MATERIALQUANTITY2 > 0 THEN A.MATERIALQUANTITY2 \r\n" +
" ELSE A.MATERIALQUANTITY END MATERIALQUANTITY2,A.AREANAME ,A.SHELFNAME ,\r\n" +
" A.CHARGE ,\r\n" +
" TO_CHAR(A.RECEIVETIME, 'YYYY-MM-DD') RECEIVETIME,A.SDK_ID,A.PHASE,\r\n" +
" be.DESCRIPTION ERPLOCATION,\r\n" +
" s.DESCRIPTION LOCATIONNAME,\r\n" +
" 'Y' BHFLG, A.SHIPREQUESTNAME,A.SHIPREQUESTDETAILNAME, \r\n" +
" 'N' IS_CHECK\r\n" +
" FROM\r\n" +
" MATERIALPACKING A\r\n" +
" LEFT JOIN SDK_SPEC SS ON\r\n" +
" A.SDK_ID = SS.SDK_ID\r\n" +
" LEFT JOIN \r\n" +
" MATERIALSPEC B ON\r\n" +
" A.MATERIALSPECNAME = B.MATERIALSPECNAME\r\n" +
" LEFT JOIN BS_ERPLOCATION be ON\r\n" +
" A.ERPLOCATION = be.ERPLOCATIONNAME\r\n" +
" LEFT JOIN STORAGESPEC s ON\r\n" +
" A.LOCATIONNAME = s.STORAGENAME AND A.ERPLOCATION = s.ERPLOCATION \r\n" +
" WHERE\r\n" +
" 1 = 1\r\n" +
" AND A.MATERIALSPECNAME = B.MATERIALSPECNAME\r\n" +
" AND A.SITENAME = B.SITENAME\r\n" +
" AND A.SITENAME =:SITENAME\r\n" +
" AND A.SHIPREQUESTNAME = :SHIPREQUESTNAME\r\n" +
" AND A.STOCKSTATE = 'Stocked'\r\n" +
" AND A.PACKINGSTATE = 'Released'\r\n" +
" AND A.HOLDSTATE = 'N'\r\n" +
" AND A.PACKINGGRADE = 'NG'\r\n" +
" AND A.MATERIALQUANTITY <> '0'\r\n" +
" AND (A.NPFLAG <> 'Y'\r\n" +
" OR A.NPFLAG IS NULL)\r\n" +
" AND A.OQARESULTSTATE <> 'PREOQA'\r\n" +
" AND A.SPECIALSTATE = '2'\r\n" +
" AND to_char(A.EXPIRINGDATE, 'yyyymmdd') >= to_char(SYSDATE, 'yyyymmdd') ORDER BY A.MATERIALSPECNAME,A.SDK_ID,A.PHASE, A.RECEIVETIME";
Map<String, Object> hashMap = new HashMap<String,Object> ();
hashMap.put("SITENAME", "SDK");
hashMap.put("SHIPREQUESTNAME", receiveRequestName);
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(ressSql, hashMap);
return AjaxResult.me().setResultObj(queryForList);
}
}

View File

@ -556,7 +556,7 @@ public class SaleOutController {
//修改发货数量功能.zd.2024.9.10
@Transactional
@RequestMapping(value = "/UpdateOutQty", method = RequestMethod.POST)
public AjaxResult updateOutQty(@RequestBody JSONObject in) throws Exception {
public AjaxResult updateOutQty(@RequestBody JSONObject in) {
MaterialPacking materialPacking = JSON.toJavaObject(in, MaterialPacking.class);
String materialPackingName = materialPacking.getMaterialPackingName();
String user = materialPacking.getUser();
@ -689,13 +689,13 @@ public class SaleOutController {
String type = queryForList.get(0).get("SHIPREQUESTTYPE").toString();
shipRequestType = type;
} else {
throw new CustomException("找不到出库单据" + shipRequestName);
return AjaxResult.me().setSuccess(false).setMessage("找不到出库单据" + shipRequestName);
}
InvoiceServiceImpl invoiceServiceImpl=new InvoiceServiceImpl();
sendERPStockOut=invoiceServiceImpl.SendERPStockOut20240802(shipRequestName, siteName, user, boxList,commitDate,opCode);
// sendERPStockOut="1";
if (sendERPStockOut == null || "".equals(sendERPStockOut)) {
throw new CustomException("过账失败");
return AjaxResult.me().setSuccess(false).setMessage("过账失败");
}
return AjaxResult.me().setResultObj(null);
}

View File

@ -1979,8 +1979,8 @@ public class InvoiceServiceImpl implements InvoiceService {
itemArray.add(item);
updateOEMINVENTORY(mm.get("ERPFACTORY").toString(),mm.get("DELIVERYADDRESS").toString(),
mm.get("MATERIALSPECNAME").toString(),mm.get("MATERIALQUANTITY").toString());
updateOEMINVENTORY(mm.get("ERPFACTORY") == null ? "" : mm.get("ERPFACTORY").toString(),mm.get("DELIVERYADDRESS") == null ? "" : mm.get("DELIVERYADDRESS").toString(),
mm.get("MATERIALSPECNAME") == null ? "" : mm.get("MATERIALSPECNAME").toString(),mm.get("MATERIALQUANTITY") == null ? "" : mm.get("MATERIALQUANTITY").toString());
}
// log.info("SendTOSAP >>>>" + sendData);
@ -2021,8 +2021,8 @@ public class InvoiceServiceImpl implements InvoiceService {
{
String sqls="SELECT o.MATERIALSPECNAME FROM OEMINVENTORY o \r\n" +
" WHERE o.ERPFACTORY =:ERPFACTORY\r\n" +
" AND o.MATERIALSPECNAME =:MATERIALSPECNAME\r\n" +
" AND o.SUPPLIERNO =:SUPPLIERNO";
" AND o.MATERIALSPECNAME =:MATERIALSPECNAME\r\n" ;
// " AND o.SUPPLIERNO =:SUPPLIERNO";
Map<String, Object> bp=new HashMap<>();
bp.put("ERPFACTORY", erpFactory);
bp.put("MATERIALSPECNAME", materialSpecName);
@ -2033,8 +2033,8 @@ public class InvoiceServiceImpl implements InvoiceService {
{
String sqlu="UPDATE OEMINVENTORY o SET o.QTY =o.QTY + :QTY\r\n" +
" WHERE o.ERPFACTORY =:ERPFACTORY\r\n" +
" AND o.MATERIALSPECNAME =:MATERIALSPECNAME\r\n" +
" AND o.SUPPLIERNO =:SUPPLIERNO";
" AND o.MATERIALSPECNAME =:MATERIALSPECNAME\r\n" ;
// " AND o.SUPPLIERNO =:SUPPLIERNO";
IDMFrameServiceProxy.getSqlTemplate().update(sqlu, bp);
}
else