1. 产成品入库
2. 整合mybatis 3. 重写更新物料凭证 4. Map工具类封装
This commit is contained in:
parent
ccfb846abe
commit
a2365ba36a
5
pom.xml
5
pom.xml
@ -37,6 +37,11 @@
|
|||||||
<version>2.2.4</version>
|
<version>2.2.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.3.1</version> <!-- 根据实际版本调整 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
|
@ -8,6 +8,7 @@ import java.util.PriorityQueue;
|
|||||||
|
|
||||||
import com.cim.idm.framework.autoconfigure.ZidmPlatformLicenseAutoConfiguration;
|
import com.cim.idm.framework.autoconfigure.ZidmPlatformLicenseAutoConfiguration;
|
||||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -25,6 +26,7 @@ import com.zi.mwms.solution.config.Globals;
|
|||||||
@SpringBootApplication(scanBasePackages = { "com.cim.idm","com.zi.mwms"},exclude = ZidmPlatformLicenseAutoConfiguration.class)
|
@SpringBootApplication(scanBasePackages = { "com.cim.idm","com.zi.mwms"},exclude = ZidmPlatformLicenseAutoConfiguration.class)
|
||||||
@PropertySource("file:${configRootPath}/db/oracle.properties")
|
@PropertySource("file:${configRootPath}/db/oracle.properties")
|
||||||
@PropertySource("file:${configRootPath}/middleware/middleware.properties")
|
@PropertySource("file:${configRootPath}/middleware/middleware.properties")
|
||||||
|
@MapperScan("com.cim.idm.dao")
|
||||||
//@EnableAdminServer
|
//@EnableAdminServer
|
||||||
public class Application {
|
public class Application {
|
||||||
|
|
||||||
|
@ -396,6 +396,68 @@ public class ToSAPServiceImpl {
|
|||||||
return undoId;
|
return undoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动入库处理FGStockIn请求
|
||||||
|
* 该方法负责将特定的物料信息发送到SAP系统,并处理返回的结果
|
||||||
|
*
|
||||||
|
* @param bodyJson 包含物料信息的JSON字符串
|
||||||
|
* @param user 执行操作的用户
|
||||||
|
* @return 返回物料凭证相关的ID
|
||||||
|
* @throws Exception 如果与SAP系统的通信或其他错误发生时抛出异常
|
||||||
|
*/
|
||||||
|
public String FGStockInByManulIn(String bodyJson, String user) throws Exception {
|
||||||
|
// 初始化SAP返回信息、结果代码、消息文本和撤销ID
|
||||||
|
String sapreturn = "";
|
||||||
|
String rcode = "";
|
||||||
|
String rmsg = "";
|
||||||
|
String undoId = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 发送物料信息到SAP系统
|
||||||
|
sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl, "",
|
||||||
|
bodyJson);
|
||||||
|
|
||||||
|
// 解析SAP系统的返回信息
|
||||||
|
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
|
||||||
|
|
||||||
|
// 提取返回信息中的RETURN对象
|
||||||
|
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
||||||
|
rcode = returnJsonObject.get("STATUS").toString();
|
||||||
|
rmsg = returnJsonObject.get("MSGTXT").toString();
|
||||||
|
|
||||||
|
// 如果返回结果状态为"S"(成功),则拼接物料凭证号和凭证年度作为undoId
|
||||||
|
if ("S".equals(rcode)) {
|
||||||
|
undoId = returnJsonObject.get("MBLNR").toString()+"_"+returnJsonObject.get("MJAHR").toString();//将物料凭证号与凭证年度拼在一起
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 记录异常日志,并抛出运行时异常
|
||||||
|
log.error("WMS请求SAP异常:" + e.getMessage(), e);
|
||||||
|
throw new RuntimeException("WMS请求SAP异常:" + rmsg);
|
||||||
|
} finally {
|
||||||
|
// 将消息记录log表
|
||||||
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
|
erplog.setEventUser(user);
|
||||||
|
erplog.setServerName("WmsToErp");
|
||||||
|
erplog.setEventName("FGStockIn");
|
||||||
|
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
|
||||||
|
erplog.setMessageId("");
|
||||||
|
erplog.setSendMsg2(bodyJson);
|
||||||
|
erplog.setSendMsg(bodyJson);
|
||||||
|
erplog.setReturnMsg2(sapreturn);
|
||||||
|
erplog.setResultCode(rcode);
|
||||||
|
MessageLogUtil.writeMessageLog(erplog);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果返回结果状态不是"S",则抛出异常
|
||||||
|
if (!"S".equals(rcode)) {
|
||||||
|
throw new RuntimeException("SAP返回" + rmsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回物料凭证相关的ID
|
||||||
|
return undoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//取消成品入库接口。zd.2024.8.29
|
//取消成品入库接口。zd.2024.8.29
|
||||||
public String cancelFGStockIn(List<String> boxList, String user,String siteName) throws Exception {
|
public String cancelFGStockIn(List<String> boxList, String user,String siteName) throws Exception {
|
||||||
|
|
||||||
|
@ -79,16 +79,16 @@ public class ToSAPMessageUtil {
|
|||||||
// SDK
|
// SDK
|
||||||
// 获取接口返回token
|
// 获取接口返回token
|
||||||
public static String authStr = "";
|
public static String authStr = "";
|
||||||
public static String baseUrl = "http://172.22.10.53:51000/RESTAdapter/OAuthServer";
|
public static String baseUrl = "http://218.93.237.50:51000/RESTAdapter/OAuthServer";
|
||||||
// public static String baseUrl = "http://172.22.10.53:8101/RESTAdapter/OAuthServer";
|
// public static String baseUrl = "http://172.22.10.53:8101/RESTAdapter/OAuthServer";
|
||||||
// public static String baseUrl = "http://172.22.10.53:8003/RESTAdapter/OAuthServer";
|
// public static String baseUrl = "http://172.22.10.53:8003/RESTAdapter/OAuthServer";
|
||||||
// public static String DNUrl = "http://218.93.237.50:51000/RESTAdapter/sd023/api";
|
// public static String DNUrl = "http://218.93.237.50:51000/RESTAdapter/sd023/api";
|
||||||
// DN回传接口
|
// DN回传接口
|
||||||
public static String DNUrl = "http://172.22.10.53:51000/RESTAdapter/sd023/api";
|
public static String DNUrl = "http://218.93.237.50:51000/RESTAdapter/sd023/api";
|
||||||
// 货物移动接口
|
// 货物移动接口
|
||||||
public static String materialChangeLocationUrl = "http://172.22.10.53:51000/RESTAdapter/mm067/api";
|
public static String materialChangeLocationUrl = "http://218.93.237.50:51000/RESTAdapter/mm067/api";
|
||||||
// 物料凭证冲销接口
|
// 物料凭证冲销接口
|
||||||
public static String materilUndoUrl = "http://172.22.10.53:51000/RESTAdapter/mm068/api";
|
public static String materilUndoUrl = "http://218.93.237.50:51000/RESTAdapter/mm068/api";
|
||||||
|
|
||||||
public static String userName = "";
|
public static String userName = "";
|
||||||
|
|
||||||
@ -511,6 +511,9 @@ public class ToSAPMessageUtil {
|
|||||||
|
|
||||||
|
|
||||||
public static String sendHttpPost(String url, String interfaceID, String JSONBody) throws Exception {
|
public static String sendHttpPost(String url, String interfaceID, String JSONBody) throws Exception {
|
||||||
|
log.info("*************************************************" );
|
||||||
|
log.info("*************************************************" );
|
||||||
|
log.info("******************开始发送******************" );
|
||||||
// 调用业务接口,需实时获取token
|
// 调用业务接口,需实时获取token
|
||||||
authStr = getAccessToken(baseUrl);
|
authStr = getAccessToken(baseUrl);
|
||||||
|
|
||||||
@ -528,6 +531,9 @@ public class ToSAPMessageUtil {
|
|||||||
response.close();
|
response.close();
|
||||||
httpClient.close();
|
httpClient.close();
|
||||||
log.info("Response:>>>>" + responseContent);
|
log.info("Response:>>>>" + responseContent);
|
||||||
|
log.info("******************发送结束******************" );
|
||||||
|
log.info("*************************************************" );
|
||||||
|
log.info("*************************************************" );
|
||||||
return responseContent;
|
return responseContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
61
zi-wms-pda/src/main/java/com/cim/idm/config/LogAspect.java
Normal file
61
zi-wms-pda/src/main/java/com/cim/idm/config/LogAspect.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package com.cim.idm.config;
|
||||||
|
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.Around;
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志切面类,用于记录方法的执行情况
|
||||||
|
*/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class LogAspect {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(LogAspect.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定义切点,匹配Service中的所有方法
|
||||||
|
*/
|
||||||
|
@Pointcut("execution(* com.cim.idm.service.Impl.*Impl.*(..))")
|
||||||
|
public void logPointCut() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环绕通知,记录方法执行前后的信息
|
||||||
|
*
|
||||||
|
* @param joinPoint 切入点
|
||||||
|
* @return 方法返回值
|
||||||
|
* @throws Throwable 如果方法抛出异常,则重新抛出
|
||||||
|
*/
|
||||||
|
@Around("logPointCut()")
|
||||||
|
@Transactional // 添加事务管理
|
||||||
|
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
try {
|
||||||
|
// 记录方法执行前的日志
|
||||||
|
logger.info("Method Name : {}", joinPoint.getSignature().getName());
|
||||||
|
logger.info("Class Name : {}", joinPoint.getTarget().getClass().getName());
|
||||||
|
logger.info("Arguments : {}", joinPoint.getArgs());
|
||||||
|
|
||||||
|
// 执行目标方法
|
||||||
|
Object result = joinPoint.proceed();
|
||||||
|
|
||||||
|
// 记录方法执行后的日志
|
||||||
|
logger.info("Result : {}", result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
// 捕获异常并记录错误日志
|
||||||
|
logger.error("Exception in {} occurred.", joinPoint.getSignature().getName(), e);
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
// 记录方法执行时间
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
|
logger.info("Execution Time : {} ms", (endTime - startTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,8 @@ import com.cim.idm.exception.GlobalException;
|
|||||||
import com.cim.idm.framework.IDMFrameServiceProxy;
|
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||||
import com.cim.idm.model.MaterialPacking;
|
import com.cim.idm.model.MaterialPacking;
|
||||||
import com.cim.idm.model.MaterialReceiveRequest;
|
import com.cim.idm.model.MaterialReceiveRequest;
|
||||||
|
import com.cim.idm.response.BaseResponse;
|
||||||
|
import com.cim.idm.response.RespGenerator;
|
||||||
import com.cim.idm.utils.AjaxResult;
|
import com.cim.idm.utils.AjaxResult;
|
||||||
import com.cim.idm.utils.CommonUtils;
|
import com.cim.idm.utils.CommonUtils;
|
||||||
import com.cim.idm.wmspackage.name.NameServiceProxy;
|
import com.cim.idm.wmspackage.name.NameServiceProxy;
|
||||||
@ -171,7 +173,7 @@ public class FGStockInController {
|
|||||||
* @throws Exception 如果处理过程中发生异常
|
* @throws Exception 如果处理过程中发生异常
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/FGStockIn", method = RequestMethod.POST)
|
@RequestMapping(value = "/FGStockIn", method = RequestMethod.POST)
|
||||||
public AjaxResult fgStockIn(@RequestBody JSONObject in) throws Exception {
|
public BaseResponse<Object> fgStockIn(@RequestBody JSONObject in) {
|
||||||
// 将输入的JSONObject转换为MaterialReceiveRequest对象
|
// 将输入的JSONObject转换为MaterialReceiveRequest对象
|
||||||
MaterialReceiveRequest sl = JSON.toJavaObject(in, MaterialReceiveRequest.class);
|
MaterialReceiveRequest sl = JSON.toJavaObject(in, MaterialReceiveRequest.class);
|
||||||
|
|
||||||
@ -187,11 +189,15 @@ public class FGStockInController {
|
|||||||
// 初始化接收请求实际编号为null
|
// 初始化接收请求实际编号为null
|
||||||
String ReceiveRequestActNo = null;
|
String ReceiveRequestActNo = null;
|
||||||
|
|
||||||
// 调用服务方法处理物料接收
|
// 调用手动入库的方法入库Box
|
||||||
ProductIntoServiceImpl.fgStockInNew(boxList, user, ReceiveRequestActNo, commitDate, opCode);
|
try {
|
||||||
|
ProductIntoServiceImpl.fgStockInByManul(boxList, user, ReceiveRequestActNo, commitDate, opCode);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return RespGenerator.returnError(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
// 返回成功结果
|
// 返回成功结果
|
||||||
return AjaxResult.me().setSuccess(true).setResultObj(null);
|
return RespGenerator.returnOK(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
21
zi-wms-pda/src/main/java/com/cim/idm/dao/FgStockInDao.java
Normal file
21
zi-wms-pda/src/main/java/com/cim/idm/dao/FgStockInDao.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
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 FgStockInDao {
|
||||||
|
|
||||||
|
//调用接口查询当前Box是否都是在库需要转库,传入List<MaterialPacking>
|
||||||
|
public List<MaterialPacking> getBoxList(@Param("boxList") List<MaterialPacking> boxList,@Param("erpFactory") String erpFactory
|
||||||
|
,@Param("erpLocation") String erpLocation,@Param("locationName") String locationName) throws Exception;
|
||||||
|
|
||||||
|
//批量更新BS_MES_SHIPPED表的ReceiveFlag和ReceiveTime
|
||||||
|
public void updateBsMesShipped(@Param("boxList") List<MaterialPacking> boxList) throws Exception;
|
||||||
|
}
|
24
zi-wms-pda/src/main/java/com/cim/idm/dao/ToSapDao.java
Normal file
24
zi-wms-pda/src/main/java/com/cim/idm/dao/ToSapDao.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package com.cim.idm.dao;
|
||||||
|
|
||||||
|
import com.cim.idm.framework.data.EventInfo;
|
||||||
|
import com.cim.idm.model.ToSAPFgStockInDto;
|
||||||
|
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 ToSapDao {
|
||||||
|
|
||||||
|
//通过箱号集合获取要成品入库的信息
|
||||||
|
public List<ToSAPFgStockInDto> getFgStockInInfo(@Param("boxList") List<MaterialPacking> boxList) throws Exception;
|
||||||
|
|
||||||
|
//基于boxList更新物料凭证及库存状态
|
||||||
|
public void updateStockState(@Param("boxList") List<MaterialPacking> boxList,@Param("stockState") String stockState,@Param("undoId") String undoId) throws Exception;
|
||||||
|
|
||||||
|
//基于boxList写入过账流水表
|
||||||
|
public void saveUnDoInfo(@Param("boxList") List<MaterialPacking> boxList, @Param("unDoID") String unDoID, @Param("commitDate") String commitDate) throws Exception;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.cim.idm.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ToSAPFgStockInDto {
|
||||||
|
|
||||||
|
|
||||||
|
// m.MATERIALSPECNAME ,
|
||||||
|
//
|
||||||
|
// m.PRODUCTORDER ,
|
||||||
|
// m.PACKINGGRADE ,
|
||||||
|
// m.ERPFACTORY ,
|
||||||
|
// m.ERPLOCATION ,
|
||||||
|
// m.UNIT ,
|
||||||
|
// m.PACKINGGRADE,
|
||||||
|
// m.MATERIALSPECTYPE,
|
||||||
|
// sum(m.MATERIALQUANTITY ) MATERIALQUANTITY
|
||||||
|
|
||||||
|
private String materialSpecName;
|
||||||
|
private String productOrder;
|
||||||
|
private String packingGrade;
|
||||||
|
private String erpFactory;
|
||||||
|
private String erpLocation;
|
||||||
|
private String unit;
|
||||||
|
private String materialSpecType;
|
||||||
|
private String materialQuantity;
|
||||||
|
}
|
@ -2,8 +2,10 @@ package com.cim.idm.service;
|
|||||||
|
|
||||||
import com.cim.idm.framework.data.EventInfo;
|
import com.cim.idm.framework.data.EventInfo;
|
||||||
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
||||||
|
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成品入库接口类
|
* 成品入库接口类
|
||||||
@ -17,4 +19,14 @@ public interface FGStockInService {
|
|||||||
String ReceiveRequestDetailName, String makeDate,
|
String ReceiveRequestDetailName, String makeDate,
|
||||||
String receiveActNo, String actType, String receiveQuantity,
|
String receiveActNo, String actType, String receiveQuantity,
|
||||||
String subMaterialSpecName) throws CustomException, ParseException;
|
String subMaterialSpecName) throws CustomException, ParseException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动入库,非自动入库包含转库和自动入库
|
||||||
|
* @param boxList
|
||||||
|
* @param user
|
||||||
|
* @param receiveRequestActNo
|
||||||
|
* @param commitDate
|
||||||
|
* @param opCode
|
||||||
|
*/
|
||||||
|
void fgStockInByManul(List<MaterialPacking> boxList, String user, String receiveRequestActNo, String commitDate, String opCode) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
package com.cim.idm.service.Impl;
|
package com.cim.idm.service.Impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.cim.idm.dao.FgStockInDao;
|
||||||
|
import com.cim.idm.dao.ToSapDao;
|
||||||
import com.cim.idm.exception.GlobalException;
|
import com.cim.idm.exception.GlobalException;
|
||||||
import com.cim.idm.framework.IDMFrameServiceProxy;
|
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||||
import com.cim.idm.framework.data.EventInfo;
|
import com.cim.idm.framework.data.EventInfo;
|
||||||
import com.cim.idm.framework.util.time.TimeStampUtil;
|
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||||
|
import com.cim.idm.model.ToSAPFgStockInDto;
|
||||||
import com.cim.idm.service.FGStockInService;
|
import com.cim.idm.service.FGStockInService;
|
||||||
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||||
import com.cim.idm.utils.CommonUtils;
|
import com.cim.idm.utils.CommonUtils;
|
||||||
import com.cim.idm.utils.EventInfoUtil;
|
import com.cim.idm.utils.EventInfoUtil;
|
||||||
|
import com.cim.idm.utils.MapUtils;
|
||||||
import com.cim.idm.wmsextend.generic.GenericServiceProxy;
|
import com.cim.idm.wmsextend.generic.GenericServiceProxy;
|
||||||
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
||||||
import com.cim.idm.wmspackage.material.MaterialServiceProxy;
|
import com.cim.idm.wmspackage.material.MaterialServiceProxy;
|
||||||
@ -42,6 +47,12 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ToSAPServiceImpl toSAPService;
|
private ToSAPServiceImpl toSAPService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FgStockInDao fgStockInDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ToSapDao toSapDao;
|
||||||
|
|
||||||
CommonUtils untils=new CommonUtils();
|
CommonUtils untils=new CommonUtils();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -124,137 +135,52 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
|||||||
IDMFrameServiceProxy.getSqlTemplate().update(sqlFU, bindMapFU);
|
IDMFrameServiceProxy.getSqlTemplate().update(sqlFU, bindMapFU);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动入库,非自动入库包含转库和自动入库
|
||||||
|
*
|
||||||
|
* @param boxList
|
||||||
|
* @param user
|
||||||
|
* @param receiveRequestActNo
|
||||||
|
* @param commitDate
|
||||||
|
* @param opCode
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void fgStockInNew (List<MaterialPacking> boxList, String user, String ReceiveRequestActNo,
|
public void fgStockInByManul(List<MaterialPacking> boxList, String user, String receiveRequestActNo, String commitDate, String opCode) throws Exception {
|
||||||
String commitDate, String opCode) throws Exception {
|
//调用mybatis查询当前要入库的信息是否是同一类型转库Or入库
|
||||||
|
List<MaterialPacking> packingList = fgStockInDao.getBoxList(boxList,boxList.get(0).getErpFactory(),boxList.get(0).getErpLocation(),boxList.get(0).getLocationName());
|
||||||
String pc = "(";
|
if(packingList.size()==0){
|
||||||
for (MaterialPacking materialPacking : boxList) {
|
throw new Exception("请选择正确的入库信息");
|
||||||
String materialPackingName = materialPacking.getMaterialPackingName();
|
|
||||||
pc += "'" + materialPackingName + "', ";
|
|
||||||
String locationName = materialPacking.getLocationName();
|
|
||||||
String erpFactory = materialPacking.getErpFactory();
|
|
||||||
String erpLocation = materialPacking.getErpLocation();
|
|
||||||
String materialspec=materialPacking.getMaterialSpecName();
|
|
||||||
String sql2 = "SELECT\r\n" +
|
|
||||||
" BMS.LOTNAME ,\r\n" +
|
|
||||||
" BMS.PRODUCTSPECNAME ,\r\n" +
|
|
||||||
" BMS.PHASE ,\r\n" +
|
|
||||||
" SS.SPECNAME ,\r\n" +
|
|
||||||
" m.DESC_CN ,\r\n" +
|
|
||||||
" BMS.QTY ,\r\n" +
|
|
||||||
" BMS.SHIPTIME ,\r\n" +
|
|
||||||
" SS.SDK_ID ,BMS .REQUESTNAME ,\r\n" +
|
|
||||||
" REGEXP_SUBSTR(BMS.LOTNAME , '[^|]+', 1, 5) AS CHARGE\r\n" +
|
|
||||||
"FROM\r\n" +
|
|
||||||
" BS_MES_SHIPPED BMS LEFT JOIN MATERIALSPEC m ON m.MATERIALSPECNAME = BMS.PRODUCTSPECNAME \r\n" +
|
|
||||||
" LEFT JOIN SDK_SPEC SS ON SS.SDK_ID = BMS.SDK_ID \r\n" +
|
|
||||||
"WHERE\r\n" +
|
|
||||||
" BMS.LOTNAME = :LOTNAME\r\n" +
|
|
||||||
" AND (BMS.RECEIVE_FLAG IS NULL\r\n" +
|
|
||||||
" OR BMS.RECEIVE_FLAG <> 'Y')";
|
|
||||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
|
||||||
bindMap.put("LOTNAME",materialPackingName);
|
|
||||||
List<Map<String,Object>> list2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql2, bindMap);
|
|
||||||
if(list2.size() < 1) {
|
|
||||||
throw new GlobalException( materialPackingName + "生产未完成入库,请联系生产确认!");
|
|
||||||
}
|
|
||||||
String phase = (list2.get(0).get("PHASE") == null || "".equals(list2.get(0).get("PHASE"))) ? "" : list2.get(0).get("PHASE").toString();
|
|
||||||
String sdk_id = (list2.get(0).get("SDK_ID") == null || "~".equals(list2.get(0).get("SDK_ID"))) ? "" : list2.get(0).get("SDK_ID").toString();
|
|
||||||
//根据入库信息获取完工报告
|
|
||||||
StringBuffer sql3 = new StringBuffer();
|
|
||||||
sql3.append(" ");
|
|
||||||
sql3.append(" SELECT ");
|
|
||||||
sql3.append(" M.RECEIVEREQUESTNAME, ");
|
|
||||||
sql3.append(" (M.REQUESTQUANTITY - M.RECEIVEDQUANTITY) MINUSQTY, ");
|
|
||||||
sql3.append(" M.RECEIVEREQUESTDETAILNAME ");
|
|
||||||
sql3.append(" FROM ");
|
|
||||||
sql3.append(" MATERIALRECEIVEREQUESTDETAIL M LEFT JOIN MATERIALRECEIVEREQUEST T ON M.RECEIVEREQUESTNAME = T.RECEIVEREQUESTNAME");
|
|
||||||
sql3.append(" WHERE ");
|
|
||||||
sql3.append(" (M.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME ");
|
|
||||||
sql3.append(" OR M.PRODUCTORDER = :RECEIVEREQUESTNAME ");
|
|
||||||
sql3.append(" OR M.PLANORDER = :RECEIVEREQUESTNAME) ");
|
|
||||||
sql3.append(" AND M.MATERIALSPECNAME = :MATERIALSPECNAME AND T.STOCKORGNO IS NOT NULL ");
|
|
||||||
if (!"".equals(sdk_id) && !"~".equals(sdk_id)) {
|
|
||||||
sql3.append(" AND M.SDK_ID = :SDK_ID ");
|
|
||||||
} else {
|
|
||||||
sql3.append(" AND M.SDK_ID is null ");
|
|
||||||
}
|
|
||||||
if (!"".equals(phase)) {
|
|
||||||
sql3.append(" AND M.PHASE = :PHASE ");
|
|
||||||
} else {
|
|
||||||
sql3.append(" AND M.PHASE is null ");
|
|
||||||
}
|
|
||||||
sql3.append(" AND M.REQUESTQUANTITY - M.RECEIVEDQUANTITY > 0 ORDER BY M.RECEIVEREQUESTNAME ASC ,M.RECEIVEREQUESTDETAILNAME ASC ");
|
|
||||||
|
|
||||||
bindMap.put("RECEIVEREQUESTNAME",list2.get(0).get("REQUESTNAME"));
|
|
||||||
bindMap.put("MATERIALSPECNAME",list2.get(0).get("PRODUCTSPECNAME"));
|
|
||||||
bindMap.put("PHASE",phase);
|
|
||||||
bindMap.put("SDK_ID",sdk_id);
|
|
||||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql3.toString(), bindMap);
|
|
||||||
if (queryForList == null || queryForList.size() < 1) {
|
|
||||||
throw new RuntimeException(materialPackingName.split("\\|")[0] + materialPackingName.split("\\|")[4] + "生产报告未完成,请联系生产确认!");
|
|
||||||
}
|
|
||||||
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("createfgBoxInfo", user, "createfgBoxInfo");
|
|
||||||
//IDMFrameServiceProxy.getTransactionManager().beginTransaction();
|
|
||||||
//更新订单数量
|
|
||||||
String qty=list2.get(0).get("QTY").toString();//批次数量
|
|
||||||
BigDecimal pcqty = new BigDecimal(qty);
|
|
||||||
// 获取订单号,订单行项,剩余数量
|
|
||||||
for (int i =0 ; i < queryForList.size(); ++ i) {
|
|
||||||
String rqn = queryForList.get(i).get("RECEIVEREQUESTNAME").toString(); //订单
|
|
||||||
String rqdn =queryForList.get(i).get("RECEIVEREQUESTDETAILNAME").toString(); //行项
|
|
||||||
String minusQty = queryForList.get(i).get("MINUSQTY").toString(); //剩余数量
|
|
||||||
// String rqn = map.get("RECEIVEREQUESTNAME").toString(); //订单
|
|
||||||
// String rqdn = map.get("RECEIVEREQUESTDETAILNAME").toString(); //行项
|
|
||||||
// String minusQty = map.get("MINUSQTY").toString(); //剩余数量
|
|
||||||
BigDecimal mqty = new BigDecimal(minusQty);
|
|
||||||
System.out.println(i + "****" + (queryForList.size() - 1));
|
|
||||||
if (i == queryForList.size() - 1 && mqty.compareTo(pcqty) < 0) {
|
|
||||||
throw new RuntimeException(materialPackingName + "报工单数量不足,无法入库 报工单号 : " + rqn + "数量:" + minusQty + "批次数量: " + pcqty);
|
|
||||||
}
|
|
||||||
String insertSql = "INSERT INTO MATERIALPACKINGSUB T (T.MATERIALPACKINGNAME,T.RECEIVEREQUESTNAME,T.RECEIVEREQUESTDETAILNAME,T.QTY) "
|
|
||||||
+ "VALUES (:MATERIALPACKINGNAME, :RECEIVEREQUESTNAME,:RECEIVEREQUESTDETAILNAME,:QTY)";
|
|
||||||
String updateSql = "UPDATE MATERIALRECEIVEREQUESTDETAIL T SET T.RECEIVEDQUANTITY = T.RECEIVEDQUANTITY + :QTY "
|
|
||||||
+ "WHERE T.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND T.RECEIVEREQUESTDETAILNAME = :RECEIVEREQUESTDETAILNAME";
|
|
||||||
//如果当前行项剩余数量满足,则只绑定当前订单和行项
|
|
||||||
if(mqty.compareTo(pcqty)>=0)
|
|
||||||
{
|
|
||||||
Map<String,Object> bp=new HashMap<>();
|
|
||||||
bp.put("RECEIVEREQUESTNAME", rqn);
|
|
||||||
bp.put("RECEIVEREQUESTDETAILNAME", rqdn);
|
|
||||||
bp.put("QTY", pcqty);
|
|
||||||
bp.put("MATERIALPACKINGNAME", materialPackingName);
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(insertSql, bp);
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(updateSql, bp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//如果当前行项数量不满足
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pcqty=pcqty.subtract(mqty);
|
|
||||||
Map<String,Object> bp=new HashMap<>();
|
|
||||||
bp.put("RECEIVEREQUESTNAME", rqn);
|
|
||||||
bp.put("RECEIVEREQUESTDETAILNAME", rqdn);
|
|
||||||
bp.put("QTY", mqty);
|
|
||||||
bp.put("MATERIALPACKINGNAME", materialPackingName);
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(insertSql, bp);
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(updateSql, bp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
receiveMesShippInfo(makeEventInfo, "SDK", materialPackingName, "", user,
|
|
||||||
materialPackingName, ReceiveRequestActNo, erpLocation, erpFactory, locationName,queryForList.get(0).get("RECEIVEREQUESTNAME").toString(), "","");
|
|
||||||
}
|
}
|
||||||
pc += "'')";
|
EventInfo eventInfo = EventInfoUtil.makeEventInfo("receiveMesShippInfo", user, "receiveMesShippInfo");
|
||||||
// boolean fgStockIn = fgStockInBySplitCharge(pc, user,commitDate,opCode);
|
//将查询的结果写入MaterialPacking表
|
||||||
boolean fgStockInBySplitCharge20241118 = fgStockInBySplitCharge20241118(pc, user, commitDate, opCode);
|
for(int i=0;i<packingList.size();i++){
|
||||||
|
//util将实体类中有值的放到map
|
||||||
|
Map<String, Object> stringObjectMap = MapUtils.entityToMap(packingList.get(i));
|
||||||
|
CreateInfo packingList1 = new CreateInfo();
|
||||||
|
packingList1.setSiteName("SDK");
|
||||||
|
packingList1.setMaterialPackingName(packingList.get(i).getMaterialPackingName());
|
||||||
|
packingList1.setUserColumns(stringObjectMap);
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().create(eventInfo, packingList1);
|
||||||
|
}
|
||||||
|
//调用Sap入库接口
|
||||||
|
List<ToSAPFgStockInDto> fgStockInInfo = toSapDao.getFgStockInInfo(boxList);
|
||||||
|
//封装为Json的字符串
|
||||||
|
String json = JSON.toJSONString(fgStockInInfo);
|
||||||
|
String undoID = toSAPService.FGStockInByManulIn(json, user);
|
||||||
|
|
||||||
|
|
||||||
|
//更新物料凭证和库存状态
|
||||||
|
toSapDao.updateStockState(boxList, "Stocked", undoID);
|
||||||
|
//更新过账流水
|
||||||
|
toSapDao.saveUnDoInfo( boxList, undoID, commitDate);
|
||||||
|
//更新接口表的标记和
|
||||||
|
fgStockInDao.updateBsMesShipped(boxList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*>
|
||||||
* @param eventInfo
|
* @param eventInfo
|
||||||
* @param siteName
|
* @param siteName
|
||||||
* @param materialPackingName
|
* @param materialPackingName
|
||||||
@ -489,87 +415,6 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 成品入库不拆完工报告
|
|
||||||
* @param pc
|
|
||||||
* @param eventUser
|
|
||||||
* @param commitDate
|
|
||||||
* @param opCode
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
@Transactional
|
|
||||||
public boolean fgStockInBySplitCharge20241118 (String pc, String eventUser,String commitDate,String opCode) throws Exception {
|
|
||||||
//根据入库单号查询有多少个完工报告,完工报告分开过账
|
|
||||||
String wgs = "SELECT DISTINCT t.ERPLOCATION FROM MATERIALPACKINGSUB m \r\n" +
|
|
||||||
" LEFT JOIN MATERIALPACKING T ON m.MATERIALPACKINGNAME =t.MATERIALPACKINGNAME \r\n" +
|
|
||||||
" WHERE m.MATERIALPACKINGNAME IN " + pc;
|
|
||||||
Map<String, Object> hashMap3 = new HashMap<String,Object> ();
|
|
||||||
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(wgs, hashMap3);
|
|
||||||
for (int i = 0; i < queryForList2.size(); i++) {
|
|
||||||
String erpLocation = queryForList2.get(i).get("ERPLOCATION").toString();
|
|
||||||
|
|
||||||
String billCode = toSAPService.FGStockIn(pc, eventUser,commitDate,opCode + i);
|
|
||||||
if (billCode == null) {
|
|
||||||
throw new GlobalException("报送ERP失败,请联系IT处理!");
|
|
||||||
}
|
|
||||||
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("FGStockIn", eventUser, "FGStockIn");
|
|
||||||
//更新抬头文本状态和Box状态
|
|
||||||
String sql = " SELECT DISTINCT M2.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKINGSUB M \r\n" +
|
|
||||||
" LEFT JOIN MATERIALPACKING m2 ON m.MATERIALPACKINGNAME = m2.MATERIALPACKINGNAME \r\n" +
|
|
||||||
" WHERE 1 = 1 \r\n" +
|
|
||||||
" AND m2.ERPLOCATION = :ERPLOCATION AND m.MATERIALPACKINGNAME IN " + pc;
|
|
||||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
|
||||||
hashMap.put("ERPLOCATION", erpLocation);
|
|
||||||
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);
|
|
||||||
|
|
||||||
//更新MES标识
|
|
||||||
String sql2 = "UPDATE BS_MES_SHIPPED T SET T.RECEIVE_FLAG = 'Y', 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);
|
|
||||||
}
|
|
||||||
untils.SaveUnDoInfoBySplitCharge(billCode,commitDate);
|
|
||||||
}
|
|
||||||
//更新Box状态为Stocked
|
|
||||||
String sqlu=" UPDATE MATERIALPACKING m SET m.STOCKSTATE =:STOCKSTATE\r\n" +
|
|
||||||
" WHERE m.SITENAME =:SITENAME AND MATERIALPACKINGNAME IN " + pc;
|
|
||||||
Map<String, Object> bpu=new HashMap<String, Object>();
|
|
||||||
bpu.put("STOCKSTATE", "Stocked");
|
|
||||||
bpu.put("SITENAME", "SDK");
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(sqlu, bpu);
|
|
||||||
|
|
||||||
|
|
||||||
//备份过账条码表的信息,并删除
|
|
||||||
String bfSql = "INSERT\r\n" +
|
|
||||||
" INTO\r\n" +
|
|
||||||
" MATERIALPACKINGSUBHISTORY T (T.MATERIALPACKINGNAME,\r\n" +
|
|
||||||
" T.RECEIVEREQUESTNAME,\r\n" +
|
|
||||||
" T.RECEIVEREQUESTDETAILNAME,\r\n" +
|
|
||||||
" T.QTY)\r\n" +
|
|
||||||
"SELECT\r\n" +
|
|
||||||
" M.MATERIALPACKINGNAME,\r\n" +
|
|
||||||
" M.RECEIVEREQUESTNAME,\r\n" +
|
|
||||||
" M.RECEIVEREQUESTDETAILNAME,\r\n" +
|
|
||||||
" M.QTY\r\n" +
|
|
||||||
"FROM\r\n" +
|
|
||||||
" MATERIALPACKINGSUB M\r\n" +
|
|
||||||
"WHERE M.MATERIALPACKINGNAME IN " + pc;
|
|
||||||
//删除拆分表MATERIALPACKINGSUB
|
|
||||||
String sqld=" DELETE FROM MATERIALPACKINGSUB m WHERE m.MATERIALPACKINGNAME IN " + pc;
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(bfSql, bpu);
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(sqld, bpu);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -606,70 +451,7 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//成品入库拆分批次时存储物料凭证。zd.2024.9.27
|
|
||||||
public void SaveUnDoInfoBySplitCharge( String undoid,String commitDate,String receiveRequestName) {
|
|
||||||
|
|
||||||
String insertUnDOMaterialPackingInfo = " insert into BS_MATERIALPACKINGUNDOINFO (unDoID,preundoid,UNDODETAILNAME,undoidstate,UNDOIDDATE, \r\n" +
|
|
||||||
" SITENAME, MATERIALPACKINGNAME, MATERIALPACKINGTYPE, CONTENTMATERIALTYPE, \r\n" +
|
|
||||||
" MATERIALTYPE, MATERIALSPECNAME, SUPERMATERIALPACKINGNAME, PACKINGGRADE, SUBPACKINGQUANTITY, MATERIALCREATEQUANTITY, \r\n" +
|
|
||||||
" MATERIALQUANTITY, PACKINGSTATE, OLDPACKINGSTATE, STOCKSTATE, OLDSTOCKSTATE, HOLDSTATE, AREANAME, LOCATIONNAME, \r\n" +
|
|
||||||
" DURABLENAME, MATERIALPROCESSGROUPNAME, LASTEVENTNAME, LASTEVENTTIMEKEY, LASTEVENTTIME, LASTEVENTUSER, \r\n" +
|
|
||||||
" LASTEVENTCOMMENT, CREATETIME, CREATEUSER, RECEIVEREQUESTNAME, RECEIVEREQUESTDETAILNAME, \r\n" +
|
|
||||||
" MAKEDATE, RECEIVEACTNO, STOCKINTYPE, RECEIVETIME, RECEIVEUSER, SHIPREQUESTNAME, SHIPREQUESTDETAILNAME, SHIPTIME, \r\n" +
|
|
||||||
" SHIPUSER, REASONCODETYPE, OQARESULTSTATE, OQARESULT, ERPLOCATION, ERPFACTORY, REASONCODE, CHARGE, SUPPLIERNAME,ETCSTATE,ERPEVENTTIME,NPFLAG) \r\n" +
|
|
||||||
" WITH MS AS (SELECT MATERIALPACKINGNAME,RECEIVEREQUESTNAME,sum(qty)QTY FROM MATERIALPACKINGSUB m WHERE m.MATERIALPACKINGNAME IN\r\n" +
|
|
||||||
" (SELECT MATERIALPACKINGNAME from MATERIALPACKING a where a.unDoID=:UNDOID ) AND m.RECEIVEREQUESTNAME =:RECEIVEREQUESTNAME\r\n" +
|
|
||||||
" GROUP BY MATERIALPACKINGNAME,RECEIVEREQUESTNAME)\r\n" +
|
|
||||||
" select unDoID,'' as preundoid,UNDODETAILNAME,'Completed' as undoidstate,:commitDate AS UNDOIDDATE, \r\n" +
|
|
||||||
" SITENAME, m.MATERIALPACKINGNAME, MATERIALPACKINGTYPE, CONTENTMATERIALTYPE, \r\n" +
|
|
||||||
" MATERIALTYPE, MATERIALSPECNAME, SUPERMATERIALPACKINGNAME, PACKINGGRADE, SUBPACKINGQUANTITY, MATERIALCREATEQUANTITY, \r\n" +
|
|
||||||
" MS.QTY , PACKINGSTATE, OLDPACKINGSTATE, STOCKSTATE, OLDSTOCKSTATE, HOLDSTATE, AREANAME, LOCATIONNAME, \r\n" +
|
|
||||||
" DURABLENAME, MATERIALPROCESSGROUPNAME, LASTEVENTNAME, LASTEVENTTIMEKEY, LASTEVENTTIME, LASTEVENTUSER, \r\n" +
|
|
||||||
" LASTEVENTCOMMENT, CREATETIME, CREATEUSER, :RECEIVEREQUESTNAME, m.RECEIVEREQUESTDETAILNAME, \r\n" +
|
|
||||||
" MAKEDATE, RECEIVEACTNO, STOCKINTYPE, RECEIVETIME, RECEIVEUSER, SHIPREQUESTNAME, SHIPREQUESTDETAILNAME, SHIPTIME, \r\n" +
|
|
||||||
" SHIPUSER, REASONCODETYPE, OQARESULTSTATE, OQARESULT, ERPLOCATION, ERPFACTORY, REASONCODE, CHARGE, SUPPLIERNAME,ETCSTATE,ERPEVENTTIME,NPFLAG \r\n" +
|
|
||||||
" from MATERIALPACKING m LEFT JOIN MS\r\n" +
|
|
||||||
" ON m.MATERIALPACKINGNAME=MS.MATERIALPACKINGNAME \r\n" +
|
|
||||||
" where m.unDoID=:UNDOID ";
|
|
||||||
|
|
||||||
Map<String, Object> bindMap_insert = new HashMap<String, Object>();
|
|
||||||
bindMap_insert.put("UNDOID", undoid);
|
|
||||||
bindMap_insert.put("commitDate", commitDate);
|
|
||||||
bindMap_insert.put("RECEIVEREQUESTNAME", receiveRequestName);
|
|
||||||
IDMFrameServiceProxy.getSqlTemplate()
|
|
||||||
.update(insertUnDOMaterialPackingInfo, bindMap_insert);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public EventInfo makeEventInfo( String eventName, String eventUser, String eventComment,
|
|
||||||
String reasonCodeType, String reasonCode )
|
|
||||||
{
|
|
||||||
EventInfo eventInfo = new EventInfo();
|
|
||||||
|
|
||||||
eventInfo.setBehaviorName( "" );
|
|
||||||
eventInfo.setEventName( eventName );
|
|
||||||
eventInfo.setEventUser( eventUser );
|
|
||||||
|
|
||||||
if ( eventComment == null )
|
|
||||||
eventComment = "";
|
|
||||||
|
|
||||||
eventInfo.setEventComment( eventComment );
|
|
||||||
eventInfo.setEventTime( TimeStampUtil.getCurrentTimestamp());
|
|
||||||
// Do Not Check TimeKey Validation
|
|
||||||
eventInfo.setCheckTimekeyValidation(false);
|
|
||||||
eventInfo.setEventTimeKey(TimeStampUtil.getCurrentEventTimeKey());
|
|
||||||
if ( reasonCodeType == null )
|
|
||||||
reasonCodeType = "";
|
|
||||||
|
|
||||||
eventInfo.setReasonCodeType( reasonCodeType );
|
|
||||||
|
|
||||||
if ( reasonCode == null )
|
|
||||||
reasonCode = "";
|
|
||||||
|
|
||||||
eventInfo.setReasonCode( reasonCode );
|
|
||||||
|
|
||||||
return eventInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保质期计算
|
* 保质期计算
|
||||||
|
32
zi-wms-pda/src/main/java/com/cim/idm/utils/MapUtils.java
Normal file
32
zi-wms-pda/src/main/java/com/cim/idm/utils/MapUtils.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package com.cim.idm.utils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class MapUtils {
|
||||||
|
/**
|
||||||
|
* 将实体类中有值的key和value放到map
|
||||||
|
*
|
||||||
|
* @param obj 实体类对象
|
||||||
|
* @return 包含实体类字段和值的map
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> entityToMap(Object obj) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
if (obj == null) {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
Field[] declaredFields = obj.getClass().getDeclaredFields();
|
||||||
|
for (Field field : declaredFields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
try {
|
||||||
|
if (field.get(obj) != null) {
|
||||||
|
map.put(field.getName(), field.get(obj));
|
||||||
|
}
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
<?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.FgStockInDao">
|
||||||
|
<!-- 更新入库标记-->
|
||||||
|
<update id="updateBsMesShipped" parameterType="java.util.List">
|
||||||
|
UPDATE BS_MES_SHIPPED T
|
||||||
|
SET
|
||||||
|
T.RECEIVE_FLAG = 'Y',
|
||||||
|
T.RECEIVETIME = SYSDATE
|
||||||
|
WHERE
|
||||||
|
T.LOTNAME IN
|
||||||
|
<foreach item="box" index="index" collection="boxList" open="(" separator="," close=")">
|
||||||
|
#{box.materialPackingName}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 获取所有待入库的信息-->
|
||||||
|
<select id="getBoxList"
|
||||||
|
resultType="com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking" parameterType="java.util.List">
|
||||||
|
SELECT
|
||||||
|
T.LOTNAME MATERIALPACKINGNAME,
|
||||||
|
T.LOTNAME LKMATERIALPACKINGNAME,
|
||||||
|
T.QTY MATERIALQUANTITY,
|
||||||
|
T.QTY SUBPACKINGQUANTITY,
|
||||||
|
T.QTY MaterialCreateQuantity,
|
||||||
|
'SDK' siteName,
|
||||||
|
'Released' PackingState,
|
||||||
|
'Created' stockState,
|
||||||
|
T.DURABLETYPE durableType,
|
||||||
|
#{erpFactory} ERPFactory,
|
||||||
|
#{erpLocation} ERPLOCATION,
|
||||||
|
#{locationName} LOCATIONNAME,
|
||||||
|
T.AREA areaName,
|
||||||
|
NVL(T.MAKEDATE, SYSDATE ) MAKEDATE ,
|
||||||
|
NVL(T.MAKEDATE, SYSDATE ) + NVL(M3.EXPIRATIONDAY, '9999') expiringDate,
|
||||||
|
SYSDATE ReceiveTime,
|
||||||
|
T.REQUESTNAME productOrder,
|
||||||
|
T.CAREER_ASSISTANCE ,
|
||||||
|
M3.MATERIALSPECTYPE ,
|
||||||
|
T.BUSINESS_UNIT,
|
||||||
|
T.SALESPERSON,
|
||||||
|
T.UNIT,
|
||||||
|
T.REQUESTNAME,
|
||||||
|
T.PRODUCTSPECNAME MATERIALSPECNAME,
|
||||||
|
SS.SPECNAME ,
|
||||||
|
T.SDK_ID ,
|
||||||
|
T.AREA ,
|
||||||
|
T.SHIPUSER ,
|
||||||
|
T.PACKINGGRADE ,
|
||||||
|
T.PACKINGGRADEDETAIL ,
|
||||||
|
T.SHIPTIME ,
|
||||||
|
M3.MATERIALTYPE ,
|
||||||
|
T.PHASE,
|
||||||
|
T.GXID,
|
||||||
|
T.MATERIALSPECTYPE
|
||||||
|
FROM
|
||||||
|
BS_MES_SHIPPED T
|
||||||
|
LEFT JOIN SDK_SPEC SS ON
|
||||||
|
T.SDK_ID = SS.SDK_ID
|
||||||
|
LEFT JOIN MATERIALSPEC M3 ON
|
||||||
|
T.PRODUCTSPECNAME = M3.MATERIALSPECNAME
|
||||||
|
WHERE
|
||||||
|
(T.RECEIVE_FLAG IS NULL
|
||||||
|
OR T.RECEIVE_FLAG !='Y')
|
||||||
|
AND T.LOTNAME IN
|
||||||
|
<foreach item="box" index="index" collection="boxList" open="(" separator="," close=")">
|
||||||
|
#{box.materialPackingName}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
66
zi-wms-pda/src/main/resources/com/cim/idm/dao/ToSapDao.xml
Normal file
66
zi-wms-pda/src/main/resources/com/cim/idm/dao/ToSapDao.xml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?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.ToSapDao">
|
||||||
|
|
||||||
|
<!-- 通过箱号集合获取要成品入库的信息 -->
|
||||||
|
<select id="getFgStockInInfo" resultType="com.cim.idm.model.ToSAPFgStockInDto" parameterType="java.util.List">
|
||||||
|
SELECT m.MATERIALSPECNAME ,
|
||||||
|
m.PRODUCTORDER ,
|
||||||
|
m.PACKINGGRADE ,
|
||||||
|
m.ERPFACTORY ,
|
||||||
|
m.ERPLOCATION ,
|
||||||
|
m.UNIT ,
|
||||||
|
m.MATERIALSPECTYPE,
|
||||||
|
sum(m.MATERIALQUANTITY ) MATERIALQUANTITY
|
||||||
|
FROM MATERIALPACKING m
|
||||||
|
LEFT JOIN BS_MES_SHIPPED bms ON m.materialpackingname = bms.lotname
|
||||||
|
WHERE bms.RECEIVE_FLAG != 'Y'
|
||||||
|
AND m.STOCKSTATE = 'Created'
|
||||||
|
AND m.materialpackingname IN
|
||||||
|
<foreach item="box" index="index" collection="boxList" open="(" separator="," close=")">
|
||||||
|
#{box.materialPackingName}
|
||||||
|
</foreach>
|
||||||
|
GROUP BY m.MATERIALSPECNAME ,m.PRODUCTORDER ,m.ERPFACTORY ,m.ERPLOCATION ,m.UNIT ,
|
||||||
|
m.PACKINGGRADE,m.MATERIALSPECTYPE
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 更新库存状态 -->
|
||||||
|
<update id="updateStockState" parameterType="map">
|
||||||
|
UPDATE MATERIALPACKING
|
||||||
|
SET STOCKSTATE = #{stockState},UNDOID = #{undoId}
|
||||||
|
WHERE MATERIALPACKINGNAME IN
|
||||||
|
<foreach item="box" index="index" collection="boxList" open="(" separator="," close=")">
|
||||||
|
#{box.materialPackingName}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<!-- 保存未完成信息 -->
|
||||||
|
<insert id="saveUnDoInfo" parameterType="map">
|
||||||
|
INSERT INTO BS_MATERIALPACKINGUNDOINFO (
|
||||||
|
unDoID, preundoid, UNDODETAILNAME, undoidstate, UNDOIDDATE,
|
||||||
|
SITENAME, MATERIALPACKINGNAME, MATERIALPACKINGTYPE, CONTENTMATERIALTYPE,
|
||||||
|
MATERIALTYPE, MATERIALSPECNAME, SUPERMATERIALPACKINGNAME, PACKINGGRADE, SUBPACKINGQUANTITY, MATERIALCREATEQUANTITY,
|
||||||
|
MATERIALQUANTITY, PACKINGSTATE, OLDPACKINGSTATE, STOCKSTATE, OLDSTOCKSTATE, HOLDSTATE, AREANAME, LOCATIONNAME,
|
||||||
|
DURABLENAME, MATERIALPROCESSGROUPNAME, LASTEVENTNAME, LASTEVENTTIMEKEY, LASTEVENTTIME, LASTEVENTUSER,
|
||||||
|
LASTEVENTCOMMENT, CREATETIME, CREATEUSER, RECEIVEREQUESTNAME, RECEIVEREQUESTDETAILNAME,
|
||||||
|
MAKEDATE, RECEIVEACTNO, STOCKINTYPE, RECEIVETIME, RECEIVEUSER, SHIPREQUESTNAME, SHIPREQUESTDETAILNAME, SHIPTIME,
|
||||||
|
SHIPUSER, REASONCODETYPE, OQARESULTSTATE, OQARESULT, ERPLOCATION, ERPFACTORY, REASONCODE, CHARGE, SUPPLIERNAME,ETCSTATE,ERPEVENTTIME,NPFLAG
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
#{unDoID}, '' as preundoid, UNDODETAILNAME, 'Completed' as undoidstate, #{commitDate} AS UNDOIDDATE,
|
||||||
|
SITENAME, MATERIALPACKINGNAME, MATERIALPACKINGTYPE, CONTENTMATERIALTYPE,
|
||||||
|
MATERIALTYPE, MATERIALSPECNAME, SUPERMATERIALPACKINGNAME, PACKINGGRADE, SUBPACKINGQUANTITY, MATERIALCREATEQUANTITY,
|
||||||
|
MATERIALQUANTITY, PACKINGSTATE, OLDPACKINGSTATE, STOCKSTATE, OLDSTOCKSTATE, HOLDSTATE, AREANAME, LOCATIONNAME,
|
||||||
|
DURABLENAME, MATERIALPROCESSGROUPNAME, LASTEVENTNAME, LASTEVENTTIMEKEY, LASTEVENTTIME, LASTEVENTUSER,
|
||||||
|
LASTEVENTCOMMENT, CREATETIME, CREATEUSER, RECEIVEREQUESTNAME, RECEIVEREQUESTDETAILNAME,
|
||||||
|
MAKEDATE, RECEIVEACTNO, STOCKINTYPE, RECEIVETIME, RECEIVEUSER, SHIPREQUESTNAME, SHIPREQUESTDETAILNAME, SHIPTIME,
|
||||||
|
SHIPUSER, REASONCODETYPE, OQARESULTSTATE, OQARESULT, ERPLOCATION, ERPFACTORY, REASONCODE, CHARGE, SUPPLIERNAME,ETCSTATE,ERPEVENTTIME,NPFLAG
|
||||||
|
FROM MATERIALPACKING
|
||||||
|
WHERE unDoID = #{unDoID}
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user