Compare commits

...

2 Commits

Author SHA1 Message Date
44105d1e74 Merge remote-tracking branch 'origin/main' 2025-04-15 19:03:53 +08:00
3bc60997a4 feat pda 退料入库 2025-04-15 19:03:41 +08:00
8 changed files with 147 additions and 15 deletions

View File

@ -9,6 +9,7 @@ import java.util.List;
@Getter @Getter
public enum StorageRulesEnums { public enum StorageRulesEnums {
// S泗洪-老厂J泗洪-胶水P泗洪-PET // S泗洪-老厂J泗洪-胶水P泗洪-PET
GU_FEN("1010", new String[]{"S", "J", "P"}),
SI_HONG("1020", new String[]{"S", "J", "P"}), SI_HONG("1020", new String[]{"S", "J", "P"}),
// 太仓 // 太仓
TAI_CANG("1030", new String[]{"T"}), TAI_CANG("1030", new String[]{"T"}),

View File

@ -8,6 +8,7 @@ import com.cim.idm.framework.IDMFrameServiceProxy;
import com.cim.idm.framework.data.EventInfo; import com.cim.idm.framework.data.EventInfo;
import com.cim.idm.model.MaterialPacking; import com.cim.idm.model.MaterialPacking;
import com.cim.idm.model.po.MaterialReceiveRequest; import com.cim.idm.model.po.MaterialReceiveRequest;
import com.cim.idm.service.IProduceReturnService;
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.utils.EventInfoUtil; import com.cim.idm.utils.EventInfoUtil;
@ -16,10 +17,7 @@ import com.cim.idm.wmspackage.name.NameServiceProxy;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
@ -28,7 +26,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.cim.idm.service.Impl.ReturnStockIntoServiceImpl; import com.cim.idm.service.Impl.ReturnStockIntoServiceImpl;
import com.cim.idm.service.Impl.ProductIntoServiceImpl;
import javax.annotation.Resource;
/** /**
* 退料入库控制器 * 退料入库控制器
@ -40,19 +39,21 @@ import com.cim.idm.service.Impl.ProductIntoServiceImpl;
@EnableAutoConfiguration @EnableAutoConfiguration
public class ProduceReturnController { public class ProduceReturnController {
@Resource
private IProduceReturnService produceReturnService;
@Autowired @Autowired
private ReturnStockIntoServiceImpl ReturnStockIntoServiceImpl; private ReturnStockIntoServiceImpl ReturnStockIntoServiceImpl;
@Autowired CommonUtils untils = new CommonUtils();
private ProductIntoServiceImpl ProductIntoServiceImpl;
CommonUtils untils=new CommonUtils();
/** /**
* 获取单据信息 * 获取单据信息
* @param in * @param in
* @return * @return
*/ */
@RequestMapping(value = "/getBarCode", method = RequestMethod.POST) @RequestMapping(value = "/getBarCode-old", method = RequestMethod.POST)
@Deprecated
public AjaxResult getBarCode(@RequestBody JSONObject in ){ public AjaxResult getBarCode(@RequestBody JSONObject in ){
MaterialPacking materialPacking = JSON.toJavaObject(in, MaterialPacking.class); MaterialPacking materialPacking = JSON.toJavaObject(in, MaterialPacking.class);
@ -191,8 +192,36 @@ public class ProduceReturnController {
// return AjaxResult.me().setResultObj(list2); // return AjaxResult.me().setResultObj(list2);
} }
/**
* 获取单据信息
* @param in
* @return
*/
@PostMapping(value = "/getBarCode")
public AjaxResult getShipCode(@RequestBody JSONObject in ){
MaterialPacking materialPacking = JSON.toJavaObject(in, MaterialPacking.class);
String materialPackingName = materialPacking.getMaterialPackingName();
// 查看标签
List<Map<String, Object>> list2 = produceReturnService.getMaterialPacking(materialPackingName);
// 判断条码是否存在且状态是在库
if (list2.size() > 1) {
throw new GlobalException("条码不止一个!");
} else if(list2.isEmpty()) {
throw new GlobalException("未打印退库标签!");
} else {
for (Map<String, Object> map : list2) {
if (!"StockOut".equals(map.get("STOCKSTATE").toString())) {
throw new GlobalException("条码已存在且不为出库状态!");
}
}
}
// 查看单号
List<Map<String, Object>> list4 = produceReturnService.getMesShip(materialPackingName);
Map<String, Object> mapAll = new HashMap<>();
mapAll.put("list2",list2);
mapAll.put("list4",list4);
return AjaxResult.me().setResultObj(mapAll);
}
/** /**
* 生成入库单号 * 生成入库单号

View File

@ -0,0 +1,30 @@
package com.cim.idm.dao;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
@Mapper
public interface ProduceReturnDao {
/**
* 获取物料主数据
* @param materialPackingName 物料码
* @return 物料数据
*/
@MapKey("materialPacking")
List<Map<String,Object>> getMaterialPacking(@Param("name") String materialPackingName);
/**
* 获取 mes-ship
* @param materialPackingName
* @return mes-ship
*/
@MapKey("mesShip")
List<Map<String,Object>> getMesShip(@Param("name") String materialPackingName);
}

View File

@ -0,0 +1,22 @@
package com.cim.idm.service;
import java.util.List;
import java.util.Map;
public interface IProduceReturnService {
/**
* 获取物料主数据
* @param materialPackingName
* @return 物料数据
*/
List<Map<String,Object>> getMaterialPacking(String materialPackingName);
/**
* 获取 mes-ship
* @param materialPackingName
* @return mes-ship
*/
List<Map<String,Object>> getMesShip(String materialPackingName);
}

View File

@ -0,0 +1,26 @@
package com.cim.idm.service.Impl;
import com.cim.idm.dao.ProduceReturnDao;
import com.cim.idm.service.IProduceReturnService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class ProduceReturnServiceImpl implements IProduceReturnService {
@Resource
private ProduceReturnDao produceReturnDao;
@Override
public List<Map<String, Object>> getMaterialPacking(String materialPackingName) {
return produceReturnDao.getMaterialPacking(materialPackingName);
}
@Override
public List<Map<String, Object>> getMesShip(String materialPackingName) {
return produceReturnDao.getMesShip(materialPackingName);
}
}

View File

@ -544,7 +544,7 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
//判断批次是否数量是否满足单据需求 //判断批次是否数量是否满足单据需求
for (int i = 0; i < queryForList2.size(); i++) { for (int i = 0; i < queryForList2.size(); i++) {
String receiveRequestName = queryForList2.get(i).get("RECEIVEREQUESTNAME").toString(); String receiveRequestName = queryForList2.get(i).get("RECEIVEREQUESTNAME").toString();
String erpLocation = queryForList2.get(i).get("ERPLOCATION").toString(); // String erpLocation = queryForList2.get(i).get("ERPLOCATION").toString();
// String shipRequestType=queryForList2.get(i).get("SHIPREQUESTTYPE").toString(); // String shipRequestType=queryForList2.get(i).get("SHIPREQUESTTYPE").toString();
String billCode=""; String billCode="";
ToSAPServiceImpl.ReturnStockInNew("SDK", eventUser, receiveRequestName, commitDate,opCode); ToSAPServiceImpl.ReturnStockInNew("SDK", eventUser, receiveRequestName, commitDate,opCode);
@ -553,11 +553,13 @@ public class ReturnStockIntoServiceImpl implements ReturnStockInService {
} }
EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("ReturnStockIn", eventUser, "ReturnStockIn"); EventInfo makeEventInfo = new EventInfoUtil().makeEventInfo("ReturnStockIn", eventUser, "ReturnStockIn");
// 更新抬头文本状态和Box状态 // 更新抬头文本状态和Box状态
String sql = "SELECT M.SITENAME ,M.MATERIALPACKINGNAME FROM MATERIALPACKING M WHERE M.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND ERPLOCATION = :ERPLOCATION AND m.MATERIALPACKINGNAME IN " /*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 FROM MATERIALPACKING M WHERE M.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND m.MATERIALPACKINGNAME IN "
+ pc; + pc;
Map<String, Object> hashMap = new HashMap<String, Object>(); Map<String, Object> hashMap = new HashMap<String, Object>();
hashMap.put("RECEIVEREQUESTNAME", receiveRequestName); hashMap.put("RECEIVEREQUESTNAME", receiveRequestName);
hashMap.put("ERPLOCATION", erpLocation); // hashMap.put("ERPLOCATION", erpLocation);
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap); List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
for (Map<String, Object> map : queryForList) { for (Map<String, Object> map : queryForList) {
MaterialPackingKey materialPackingKey = new MaterialPackingKey(map.get("SITENAME").toString(), MaterialPackingKey materialPackingKey = new MaterialPackingKey(map.get("SITENAME").toString(),

View File

@ -0,0 +1,22 @@
<?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.ProduceReturnDao">
<select id="getMaterialPacking" resultType="map">
SELECT mp.MATERIALPACKINGNAME, mp.MATERIALSPECNAME, mp.PHASE, mp.PACKINGGRADE,
mp.STOCKSTATE, mp.RECEIVEACTNO, mp.CHARGE, m.DESC_CN,
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 LOTNAME = #{name}
GROUP BY bms.REQUESTNAME, bms.PRODUCTSPECNAME, bms.UNIT
</select>
</mapper>

View File

@ -52,7 +52,7 @@
STORAGENAME LIKE #{type}||'%' STORAGENAME LIKE #{type}||'%'
</foreach> </foreach>
<if test="storageName != null and storageName != ''"> <if test="storageName != null and storageName != ''">
AND STORAGENAME LIKE '%'||#{storageName}||'%' AND STORAGENAME LIKE #{storageName}||'%'
</if> </if>
</select> </select>
</mapper> </mapper>