Compare commits
2 Commits
cb9790a951
...
00214095e4
Author | SHA1 | Date | |
---|---|---|---|
00214095e4 | |||
018fdef365 |
@ -38,7 +38,7 @@ public class ChargeSplitController {
|
|||||||
|
|
||||||
boolean moveTransformOut = ChargeSplitService.ChargeSplit(boxList, user);
|
boolean moveTransformOut = ChargeSplitService.ChargeSplit(boxList, user);
|
||||||
if (moveTransformOut != true) {
|
if (moveTransformOut != true) {
|
||||||
throw new RuntimeException("NC返回" + "过账数据为空");
|
throw new RuntimeException("拆分失败");
|
||||||
} else {
|
} else {
|
||||||
return AjaxResult.me().setSuccess(true).setResultObj(null);
|
return AjaxResult.me().setSuccess(true).setResultObj(null);
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,7 @@ import java.util.List;
|
|||||||
public interface ChargeSplitService extends CommonService<BSLabelKey, BSLabel> {
|
public interface ChargeSplitService extends CommonService<BSLabelKey, BSLabel> {
|
||||||
|
|
||||||
boolean ChargeSplit(List<MaterialPacking> boxList, String user);
|
boolean ChargeSplit(List<MaterialPacking> boxList, String user);
|
||||||
|
|
||||||
|
// 备货出库修改数量拆分条码
|
||||||
|
boolean packingChargeSplit(List<MaterialPacking> boxList, String user);
|
||||||
}
|
}
|
||||||
|
@ -220,6 +220,178 @@ public class ChargeSplitServiceImpl implements ChargeSplitService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 备货出库修改数量拆分条码
|
||||||
|
@Transactional
|
||||||
|
public boolean packingChargeSplit(List<MaterialPacking> boxList, String user) {
|
||||||
|
|
||||||
|
String condition="";
|
||||||
|
String newBoxId1 = boxList.get(1).getMaterialPackingName();
|
||||||
|
// String pc = "('" + materialpackingname + "')";
|
||||||
|
String sql = "SELECT 1 FROM MATERIALPACKING WHERE MATERIALPACKINGNAME IN (:MATERIALPACKINGNAME1, :MATERIALPACKINGNAME2)";
|
||||||
|
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||||
|
hashMap2.put("MATERIALPACKINGNAME1", newBoxId1);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap2);
|
||||||
|
List<MaterialPacking> MaterialPackingList = null;
|
||||||
|
if (queryForList != null && queryForList.size() > 0) {
|
||||||
|
String[] bindSet={newBoxId1};
|
||||||
|
condition="WHERE MATERIALPACKINGNAME IN (?,?)";
|
||||||
|
MaterialPackingList = MaterialPackingServiceProxy.getMaterialPackingService().select(condition, bindSet);
|
||||||
|
}
|
||||||
|
//解析条码,根据远条码信息更新目标条码数量和库存状态
|
||||||
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
EventInfoUtil eventInfoUtil = new EventInfoUtil();
|
||||||
|
makeEventInfo = eventInfoUtil.makeEventInfo("ChargeSplit", user, "ChargeSplit" );
|
||||||
|
//找到原来标签的相关信息
|
||||||
|
// String receiveTime = "";
|
||||||
|
// String makeDate = "";
|
||||||
|
// String expireDate = "";
|
||||||
|
String holdState = "";
|
||||||
|
String oqaResult = "";
|
||||||
|
String oqaResultState = "";
|
||||||
|
String packingGrade = "";
|
||||||
|
String trueGg = "";
|
||||||
|
String erpFactory = "";
|
||||||
|
String erpLocation = "";
|
||||||
|
String locationName = "";
|
||||||
|
String shelfName = "";
|
||||||
|
String areaName = "";
|
||||||
|
String durableName = "";;
|
||||||
|
String CAREER_ASSISTANCE = "";
|
||||||
|
String SALESPERSON = "";
|
||||||
|
String CUSTOMNO = "";
|
||||||
|
String DEVIATION = "";
|
||||||
|
String DIAMETER = "";
|
||||||
|
String WIDTH = "";
|
||||||
|
String WEIGHT = "";
|
||||||
|
String PRODUCTLINE = "";
|
||||||
|
String UNIT = "";
|
||||||
|
String MJPC = "";
|
||||||
|
String BUSINESS_UNIT = "";
|
||||||
|
|
||||||
|
String MATERIALSPECNAME = "";
|
||||||
|
// String SUBPACKINGQUANTITY = "";
|
||||||
|
// String MATERIALCREATEQUANTITY = "";
|
||||||
|
String CHARGE = "";
|
||||||
|
String SDK_ID = "";
|
||||||
|
String PHASE = "";
|
||||||
|
String RECEIVEREQUESTNAME = "";
|
||||||
|
String RECEIVEREQUESTDETAILNAME = "";
|
||||||
|
String REMARK = "";
|
||||||
|
|
||||||
|
String ypcSql = "SELECT M.RECEIVETIME,M.MAKEDATE,M.EXPIRINGDATE,M.HOLDSTATE,M.OQARESULTSTATE ,\r\n" +
|
||||||
|
" M.OQARESULT ,M.PACKINGGRADE ,M.TRUEGG ,M.ERPFACTORY ,M.ERPLOCATION ,M.LOCATIONNAME ,\r\n" +
|
||||||
|
" M.SHELFNAME ,M.AREANAME ,M.DURABLENAME ,M.CAREER_ASSISTANCE ,M.SALESPERSON ,M.CUSTOMNO,M.SDK_ID,M.PHASE,M.RECEIVEREQUESTNAME,M.RECEIVEREQUESTDETAILNAME,"
|
||||||
|
+ " M.DEVIATION ,M.DIAMETER ,M.WIDTH ,M.WEIGHT ,M.PRODUCTLINE,UNIT ,MJPC,BUSINESS_UNIT,M.MATERIALSPECNAME, M.SUBPACKINGQUANTITY, M.MATERIALCREATEQUANTITY, M.MATERIALQUANTITY, M.CHARGE, M.REMARK" +
|
||||||
|
" FROM MATERIALPACKING M WHERE M.MATERIALPACKINGNAME = :MATERIALPACKINGNAME AND M.CHARGE = :CHARGE ";
|
||||||
|
Map<String, Object> hashMap4 = new HashMap<String,Object> ();
|
||||||
|
hashMap4.put("MATERIALPACKINGNAME", boxList.get(0).getMaterialPackingName());
|
||||||
|
hashMap4.put("CHARGE", boxList.get(0).getCharge());
|
||||||
|
List<Map<String, Object>> queryForList3 = IDMFrameServiceProxy.getSqlTemplate().queryForList(ypcSql, hashMap4);
|
||||||
|
|
||||||
|
if (queryForList3 != null && queryForList3.size() > 0) {
|
||||||
|
Map<String, Object> map = queryForList3.get(0);
|
||||||
|
holdState = map.get("HOLDSTATE") == null ? "N" : map.get("HOLDSTATE").toString();
|
||||||
|
oqaResult = map.get("OQARESULT") == null ? "" : map.get("OQARESULT").toString();
|
||||||
|
oqaResultState = map.get("OQARESULTSTATE") == null ? "END" : map.get("OQARESULTSTATE").toString();
|
||||||
|
packingGrade = map.get("PACKINGGRADE") == null ? "" : map.get("PACKINGGRADE").toString();
|
||||||
|
trueGg = map.get("TRUEGG") == null ? "" : map.get("TRUEGG").toString();
|
||||||
|
erpFactory = map.get("ERPFACTORY") == null ? "" : map.get("ERPFACTORY").toString();
|
||||||
|
erpLocation = map.get("ERPLOCATION") == null ? "" : map.get("ERPLOCATION").toString();
|
||||||
|
locationName = map.get("LOCATIONNAME") == null ? "" : map.get("LOCATIONNAME").toString();
|
||||||
|
shelfName = map.get("SHELFNAME") == null ? "" : map.get("SHELFNAME").toString();
|
||||||
|
areaName = map.get("AREANAME") == null ? "" : map.get("AREANAME").toString();
|
||||||
|
durableName = map.get("DURABLENAME") == null ? "" : map.get("DURABLENAME").toString();
|
||||||
|
CAREER_ASSISTANCE = map.get("CAREER_ASSISTANCE") == null ? "" : map.get("CAREER_ASSISTANCE").toString();
|
||||||
|
SALESPERSON = map.get("SALESPERSON") == null ? "" : map.get("SALESPERSON").toString();
|
||||||
|
CUSTOMNO = map.get("CUSTOMNO") == null ? "" : map.get("CUSTOMNO").toString();
|
||||||
|
DEVIATION = map.get("DEVIATION") == null ? "" : map.get("DEVIATION").toString();
|
||||||
|
DIAMETER = map.get("DIAMETER") == null ? "" : map.get("DIAMETER").toString();
|
||||||
|
WIDTH = map.get("WIDTH") == null ? "" : map.get("WIDTH").toString();
|
||||||
|
WEIGHT = map.get("WEIGHT") == null ? "" : map.get("WEIGHT").toString();
|
||||||
|
PRODUCTLINE = map.get("PRODUCTLINE") == null ? "" : map.get("PRODUCTLINE").toString();
|
||||||
|
UNIT = map.get("UNIT") == null ? "" : map.get("UNIT").toString();
|
||||||
|
MJPC = map.get("MJPC") == null ? "" : map.get("MJPC").toString();
|
||||||
|
BUSINESS_UNIT = map.get("BUSINESS_UNIT") == null ? "" : map.get("BUSINESS_UNIT").toString();
|
||||||
|
MATERIALSPECNAME = map.get("MATERIALSPECNAME") == null ? "" : map.get("MATERIALSPECNAME").toString();
|
||||||
|
// SUBPACKINGQUANTITY = map.get("SUBPACKINGQUANTITY") == null ? "" : map.get("SUBPACKINGQUANTITY").toString();
|
||||||
|
// MATERIALCREATEQUANTITY = map.get("MATERIALCREATEQUANTITY") == null ? "" : map.get("MATERIALCREATEQUANTITY").toString();
|
||||||
|
CHARGE = map.get("CHARGE") == null ? "" : map.get("CHARGE").toString();
|
||||||
|
SDK_ID = map.get("SDK_ID") == null ? "" : map.get("SDK_ID").toString();
|
||||||
|
PHASE = map.get("PHASE") == null ? "" : map.get("PHASE").toString();
|
||||||
|
REMARK = map.get("REMARK") == null ? "" : map.get("REMARK").toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MaterialPackingList != null && MaterialPackingList.size() > 0) {
|
||||||
|
throw new RuntimeException("拆分批次的标签已存在!");
|
||||||
|
}else {
|
||||||
|
// 创建标签1
|
||||||
|
CreateInfo createInfo1 = new CreateInfo();
|
||||||
|
createInfo1.setSiteName("SDK");
|
||||||
|
createInfo1.setMaterialPackingName(newBoxId1);// 新生成的box id
|
||||||
|
createInfo1.setMaterialPackingType("Box");
|
||||||
|
createInfo1.setContentMaterialType("");
|
||||||
|
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("MaterialSpecName", MATERIALSPECNAME);
|
||||||
|
bindMap.put("PackingGrade", packingGrade);
|
||||||
|
bindMap.put("oqaResult", oqaResult);
|
||||||
|
bindMap.put("oqaResultState", oqaResultState);
|
||||||
|
bindMap.put("SubPackingQuantity",boxList.get(1).getMaterialQuantity());
|
||||||
|
bindMap.put("MaterialCreateQuantity",boxList.get(1).getMaterialQuantity());
|
||||||
|
bindMap.put("MaterialQuantity", boxList.get(1).getMaterialQuantity());// 数量
|
||||||
|
bindMap.put("PackingState", "Released");
|
||||||
|
bindMap.put("OldPackingState", "Released");
|
||||||
|
bindMap.put("stockState", "Stocked");
|
||||||
|
bindMap.put("OldStockState", "Created");
|
||||||
|
bindMap.put("HoldState", holdState);
|
||||||
|
bindMap.put("LocationName", locationName);
|
||||||
|
bindMap.put("charge",CHARGE);
|
||||||
|
bindMap.put("MaterialProcessGroupName","");
|
||||||
|
bindMap.put("LastEventTimeKey",TimeStampUtil.getCurrentEventTimeKey());
|
||||||
|
|
||||||
|
bindMap.put("MakeDate", queryForList3.get(0).get("MAKEDATE"));
|
||||||
|
bindMap.put("expiringDate", queryForList3.get(0).get("EXPIRINGDATE"));
|
||||||
|
bindMap.put("ReceiveTime", queryForList3.get(0).get("RECEIVETIME"));
|
||||||
|
bindMap.put("unit", queryForList3.get(0).get("UNIT"));
|
||||||
|
|
||||||
|
bindMap.put("ReceiveUser", makeEventInfo.getEventUser());
|
||||||
|
bindMap.put("ErpLocation", erpLocation);
|
||||||
|
bindMap.put("ErpFactory", erpFactory);
|
||||||
|
bindMap.put("locationName", locationName);
|
||||||
|
bindMap.put("StockInType", "Normal");
|
||||||
|
bindMap.put("SDK_ID", SDK_ID);
|
||||||
|
bindMap.put("PHASE", PHASE);
|
||||||
|
bindMap.put("remark", REMARK);
|
||||||
|
bindMap.put("ReceiveRequestName", RECEIVEREQUESTNAME);
|
||||||
|
bindMap.put("ReceiveRequestDetailName",RECEIVEREQUESTDETAILNAME);
|
||||||
|
|
||||||
|
bindMap.put("CAREER_ASSISTANCE", CAREER_ASSISTANCE);//业助信息
|
||||||
|
bindMap.put("BUSINESS_UNIT", BUSINESS_UNIT);//业务
|
||||||
|
bindMap.put("SALESPERSON", SALESPERSON);//事业部
|
||||||
|
bindMap.put("MJPC", MJPC);//母卷批次
|
||||||
|
bindMap.put("truegg", trueGg);
|
||||||
|
bindMap.put("durableName", durableName);
|
||||||
|
bindMap.put("areaName", areaName);
|
||||||
|
bindMap.put("PRODUCTLINE", PRODUCTLINE);
|
||||||
|
bindMap.put("WIDTH", WIDTH);
|
||||||
|
bindMap.put("DEVIATION", DEVIATION);
|
||||||
|
bindMap.put("WEIGHT", WEIGHT);
|
||||||
|
bindMap.put("DIAMETER", DIAMETER);
|
||||||
|
bindMap.put("shelfName", shelfName);
|
||||||
|
createInfo1.setUserColumns(bindMap);
|
||||||
|
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().create(makeEventInfo, createInfo1);
|
||||||
|
|
||||||
|
//更新原标签批次的库位状态为出库
|
||||||
|
// MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK",boxList.get(0).getMaterialPackingName());
|
||||||
|
// Map<String, Object> hashMap3 = new HashMap<String,Object> ();
|
||||||
|
// hashMap3.put("stockState", "StockOut");
|
||||||
|
// setEventInfo.setUserColumns(hashMap3);
|
||||||
|
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
//无来源转库拆分
|
//无来源转库拆分
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean NoLYChargeSplit(StorageSpec StorageSpec, String user, String locationNameCr) throws Exception {
|
public boolean NoLYChargeSplit(StorageSpec StorageSpec, String user, String locationNameCr) throws Exception {
|
||||||
|
@ -13,11 +13,13 @@ import com.cim.idm.mwmsextend.generic.util.CommonValidation;
|
|||||||
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
||||||
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceUtil;
|
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceUtil;
|
||||||
import com.cim.idm.mwmsextend.materialshiprequest.service.MaterialShipRequestServiceImpl;
|
import com.cim.idm.mwmsextend.materialshiprequest.service.MaterialShipRequestServiceImpl;
|
||||||
|
import com.cim.idm.service.ChargeSplitService;
|
||||||
import com.cim.idm.service.InvoiceService;
|
import com.cim.idm.service.InvoiceService;
|
||||||
import com.cim.idm.service.impl.MESServiceImpl;
|
import com.cim.idm.service.impl.MESServiceImpl;
|
||||||
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||||
import com.cim.idm.util.MessageLogUtil;
|
import com.cim.idm.util.MessageLogUtil;
|
||||||
import com.cim.idm.util.ToSAPMessageUtil;
|
import com.cim.idm.util.ToSAPMessageUtil;
|
||||||
|
import com.cim.idm.utils.AjaxResult;
|
||||||
import com.cim.idm.utils.CodeGenerator;
|
import com.cim.idm.utils.CodeGenerator;
|
||||||
import com.cim.idm.utils.CommonUtils;
|
import com.cim.idm.utils.CommonUtils;
|
||||||
import com.cim.idm.utils.EventInfoUtil;
|
import com.cim.idm.utils.EventInfoUtil;
|
||||||
@ -52,6 +54,9 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ToSAPServiceImpl toSAPService;
|
private ToSAPServiceImpl toSAPService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChargeSplitService ChargeSplitService;
|
||||||
|
|
||||||
private MaterialShipRequestServiceImpl ms = new MaterialShipRequestServiceImpl();
|
private MaterialShipRequestServiceImpl ms = new MaterialShipRequestServiceImpl();
|
||||||
|
|
||||||
private MaterialPackingServiceImpl mp = new MaterialPackingServiceImpl();
|
private MaterialPackingServiceImpl mp = new MaterialPackingServiceImpl();
|
||||||
@ -331,17 +336,21 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
//判断会有多少个仓库发货,不同仓库需要分开走账
|
//判断会有多少个仓库发货,不同仓库需要分开走账
|
||||||
StringBuffer cklx = new StringBuffer();
|
StringBuffer cklx = new StringBuffer();
|
||||||
// cklx.append("SELECT DISTINCT m.ERPLOCATION FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN ");
|
// cklx.append("SELECT DISTINCT m.ERPLOCATION FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN ");
|
||||||
cklx.append("SELECT m.MATERIALQUANTITY,m.MATERIALQUANTITY2,m.MATERIALPACKINGNAME,m.CHARGE FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN ");
|
// cklx.append("SELECT m.MATERIALQUANTITY,m.MATERIALQUANTITY2,m.MATERIALPACKINGNAME,m.CHARGE,m.SITENAME FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN ");
|
||||||
|
cklx.append("SELECT * FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME IN ");
|
||||||
String str = "";
|
String str = "";
|
||||||
str += "(";
|
str += "(";
|
||||||
for (String materialPacking : materialPackingKeyList) {
|
for (String materialPacking : materialPackingKeyList) {
|
||||||
str += "'" + materialPacking + "',";
|
str += "'" + materialPacking + "',";
|
||||||
}
|
}
|
||||||
str += "'')";
|
str += "'')";
|
||||||
|
Object[] bindSet = {};
|
||||||
// List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(cklx.toString() + str, hashMap);
|
// List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(cklx.toString() + str, hashMap);
|
||||||
|
|
||||||
// 查询MATERIALQUANTITY 与 MATERIALQUANTITY2是否相等,如果相等则未修改数量,不相等则修改数量
|
// 查询MATERIALQUANTITY 与 MATERIALQUANTITY2是否相等,如果相等则未修改数量,不相等则修改数量
|
||||||
List<Map<String, Object>> qtyQueryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(cklx.toString() + str, hashMap);
|
List<Map<String, Object>> qtyQueryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(cklx.toString() + str, hashMap);
|
||||||
|
// List<MaterialPacking> qtyQueryForList = MaterialPackingServiceProxy.getMaterialPackingService().select(cklx.toString() + str, bindSet,MaterialPacking.class);
|
||||||
|
|
||||||
String billCode = "";
|
String billCode = "";
|
||||||
switch (shipRequestType) {
|
switch (shipRequestType) {
|
||||||
case "NLCC" : //STO调拨出库
|
case "NLCC" : //STO调拨出库
|
||||||
@ -379,28 +388,57 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
// 查询MATERIALQUANTITY 与 MATERIALQUANTITY2是否相等,如果相等则未修改数量,不相等则修改数量
|
// 查询MATERIALQUANTITY 与 MATERIALQUANTITY2是否相等,如果相等则未修改数量,不相等则修改数量
|
||||||
// 如果已修改数量,则进行拆单
|
// 如果已修改数量,则进行拆单
|
||||||
// for (int z = 0; z < qtyQueryForList.size(); z++) {
|
// for (int z = 0; z < qtyQueryForList.size(); z++) {
|
||||||
// String qty = qtyQueryForList.get(z).get("MATERIALQUANTITY").toString();
|
//
|
||||||
// String qty2 = qtyQueryForList.get(z).get("MATERIALQUANTITY2") == null ? "0" : qtyQueryForList.get(z).get("MATERIALQUANTITY2").toString();
|
// String qty = String.valueOf(qtyQueryForList.get(z).getMaterialQuantity());
|
||||||
// String materialPackingName = qtyQueryForList.get(z).get("MATERIALPACKINGNAME").toString();
|
//
|
||||||
|
// String qty2 = new Double(qtyQueryForList.get(z).getMaterialQuantity2()) == null ? "0" : String.valueOf(qtyQueryForList.get(z).getMaterialQuantity2());
|
||||||
|
// String materialPackingName = qtyQueryForList.get(z).getMaterialPackingName();
|
||||||
|
// String charge = qtyQueryForList.get(z).getCharge();
|
||||||
// BigDecimal bigQty = new BigDecimal(qty);
|
// BigDecimal bigQty = new BigDecimal(qty);
|
||||||
// // 已拆数量
|
// // 已拆数量
|
||||||
// BigDecimal bigQty2 = new BigDecimal(qty2);
|
// BigDecimal bigQty2 = new BigDecimal(qty2);
|
||||||
//
|
//
|
||||||
// if(bigQty.compareTo(bigQty2) != 0) {
|
// // 如果已拆数量不等于原数量,并且已拆数量为0(未拆分数量)
|
||||||
|
// if(bigQty.compareTo(bigQty2) != 0 && !"0".equals(qty2)) {
|
||||||
// // 剩余数量
|
// // 剩余数量
|
||||||
// BigDecimal restQty = bigQty.subtract(bigQty2);
|
// BigDecimal restQty = bigQty.subtract(bigQty2);
|
||||||
// // 生成新的拆分条码
|
// // 生成新的拆分条码
|
||||||
// String stringBigQty2 = bigQty2.toString();
|
// String stringBigQty2 = bigQty2.toString();
|
||||||
// String newPalletNo = CodeGenerator.packingGenerateCode(materialPackingName,stringBigQty2);
|
// String newPalletNo = CodeGenerator.packingGenerateCode(materialPackingName,stringBigQty2,charge);
|
||||||
|
//
|
||||||
|
// // 写入拆分的新条码,更新原数据库
|
||||||
|
// List<MaterialPacking> boxList = new ArrayList<MaterialPacking>();
|
||||||
|
//// MaterialPackingKey materialpackingKey = new MaterialPackingKey();
|
||||||
|
// MaterialPacking materialpacking = new MaterialPacking();
|
||||||
|
//// materialpackingKey.setSiteName("SDK");
|
||||||
|
//// materialpackingKey.setMaterialPackingName(newPalletNo);
|
||||||
|
//// materialpacking.setKey(materialpackingKey);
|
||||||
|
// if (z < 0 || z >= qtyQueryForList.size()) {
|
||||||
|
// throw new IndexOutOfBoundsException("Invalid index z: " + z);
|
||||||
|
// }
|
||||||
|
// // 复制一个当前的原标签数据
|
||||||
|
// MaterialPacking materialpackingNew = qtyQueryForList.get(z);
|
||||||
|
// // 设置新为标签和数量
|
||||||
|
// materialpackingNew.setMaterialPackingName(newPalletNo);
|
||||||
|
// // bigQty2 转double类型
|
||||||
|
// materialpackingNew.setMaterialQuantity(bigQty2.doubleValue());
|
||||||
|
// boxList.add(qtyQueryForList.get(z));
|
||||||
|
// boxList.add(materialpackingNew);
|
||||||
|
// boolean moveTransformOut = ChargeSplitService.packingChargeSplit(boxList, eventUser);
|
||||||
|
// if (moveTransformOut != true) {
|
||||||
|
// throw new RuntimeException("修改数量拆分失败");
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
// // 原条码扣减
|
// // 原条码扣减
|
||||||
// SetEventInfo setEventInfo = new SetEventInfo();
|
// SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
// eventInfo = new EventInfoUtil().makeEventInfo("修改数量拆分条码", eventUser, "修改数量拆分条码");
|
// Map<String, Object> pakHashMap = new HashMap<>();
|
||||||
// setEventInfo.setUserColumns(hashMap3);
|
// pakHashMap.put("materialQuantity", restQty.doubleValue());
|
||||||
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey( queryForList.get(0).get("SITENAME").toString(),
|
//
|
||||||
// queryForList.get(0).get("MATERIALPACKINGNAME").toString()), eventInfo, setEventInfo);
|
// EventInfo eventInfo = new EventInfoUtil().makeEventInfo("修改数量拆分条码", eventUser, "修改数量拆分条码");
|
||||||
|
// setEventInfo.setUserColumns(pakHashMap);
|
||||||
|
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(new MaterialPackingKey( queryForList.get(z).get("SITENAME").toString(),
|
||||||
|
// queryForList.get(z).get("MATERIALPACKINGNAME").toString()), eventInfo, setEventInfo);
|
||||||
//
|
//
|
||||||
// // 写入拆分的新条码,更新原数据库
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
@ -477,7 +477,7 @@ public class MESToWMSServiceImpl implements MESToWMSService {
|
|||||||
MaterialPackingServiceImpl.checkMaterialPackingExist(lotname);
|
MaterialPackingServiceImpl.checkMaterialPackingExist(lotname);
|
||||||
|
|
||||||
EventInfo makeEventInfo = EventInfoUtil.makeEventInfo("createfgBoxInfo", "MES", "createfgBoxInfo", "", "");
|
EventInfo makeEventInfo = EventInfoUtil.makeEventInfo("createfgBoxInfo", "MES", "createfgBoxInfo", "", "");
|
||||||
productIntoServiceImpl.receiveMesShippInfo(makeEventInfo, "SDK", lotname, "", "MES",
|
productIntoServiceImpl.receiveMesShippInfo2(makeEventInfo, "SDK", lotname, "", "MES",
|
||||||
lotname, receiveActNo, erpLocation, erpFactory, locationName, requestName, "", "");
|
lotname, receiveActNo, erpLocation, erpFactory, locationName, requestName, "", "");
|
||||||
} else if ("MAT".equals(stockInType)) { // 生产退料入库
|
} else if ("MAT".equals(stockInType)) { // 生产退料入库
|
||||||
Map<String, Object> iqcBind = new HashMap<>();
|
Map<String, Object> iqcBind = new HashMap<>();
|
||||||
|
@ -580,6 +580,222 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mes创建批次,sap去除校验
|
||||||
|
@Transactional
|
||||||
|
public boolean receiveMesShippInfo2(EventInfo eventInfo,String siteName,String materialPackingName,
|
||||||
|
String durableName,String user,String palletName,String receiveActNo,
|
||||||
|
String erpLocation,String erpFactory,String locationName,String receiveRequestName,
|
||||||
|
String receiveRequestDetailName,String areaName) throws Exception {
|
||||||
|
StringBuffer sql = new StringBuffer();
|
||||||
|
sql.append(" ");
|
||||||
|
sql.append(" SELECT ");
|
||||||
|
sql.append(" T.LOTNAME MATERIALPACKINGNAME, ");
|
||||||
|
sql.append(" T.QTY MATERIALQUANTITY, ");
|
||||||
|
sql.append(" T.UNIT, ");
|
||||||
|
sql.append(" M2. RECEIVEREQUESTDETAILNAME,");
|
||||||
|
sql.append(" T.REQUESTNAME RECEIVEREQUESTNAME,");
|
||||||
|
sql.append(" T.PRODUCTSPECNAME MATERIALSPECNAME, ");
|
||||||
|
sql.append(" SS.SPECNAME , ");
|
||||||
|
sql.append(" REPLACE(T.SDK_ID, '~', '') SDK_ID, ");
|
||||||
|
sql.append(" M.ERPLOCATION , ");
|
||||||
|
sql.append(" T.AREA ,");
|
||||||
|
sql.append(" T.SHIPUSER , ");
|
||||||
|
sql.append(" T.PACKINGGRADE , ");
|
||||||
|
sql.append(" T.SHIPTIME , ");
|
||||||
|
sql.append(" M3.MATERIALTYPE , ");
|
||||||
|
sql.append(" T.REMARK,T.PHASE,T.CAREER_ASSISTANCE,T.DURABLETYPE ,T.BUSINESS_UNIT,T.SALESPERSON,T.MJPC ,T.TRUEGG,T.CHARGE,T.MAKEDATE, T.CUSTOMERNO ,"
|
||||||
|
+ "T.LK_DURABLENAME,T.LK_AREANAME,T.LK_PRODUCTLINE,T.LK_WIDTH ,T.LK_DEVIATION,T.LK_WEIGHT,T.LK_DIAMETER,T.LK_SHELFNAME ");
|
||||||
|
sql.append(" FROM ");
|
||||||
|
sql.append(" BS_MES_SHIPPED T ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEREQUEST M ON ");
|
||||||
|
sql.append(" T.REQUESTNAME = M.RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEREQUESTDETAIL M2 ON ");
|
||||||
|
sql.append(" T.REQUESTNAME = M2.RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" AND T.PRODUCTSPECNAME = M2.MATERIALSPECNAME ");
|
||||||
|
sql.append(" AND T.SDK_ID = M2.SDK_ID ");
|
||||||
|
sql.append(" LEFT JOIN SDK_SPEC SS ON T.SDK_ID = SS.SDK_ID ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALSPEC M3 ON T.PRODUCTSPECNAME = M3.MATERIALSPECNAME ");
|
||||||
|
sql.append(" WHERE (T.RECEIVE_FLAG IS NULL OR T.RECEIVE_FLAG <> 'Y') ");
|
||||||
|
sql.append(" AND T.LOTNAME = :MATERIALPACKINGNAME ");
|
||||||
|
// sql.append(" AND M.SITENAME = :SITENAME ");
|
||||||
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
|
hashMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
||||||
|
if(queryForList == null || queryForList.size() < 1) {
|
||||||
|
throw new RuntimeException("不存在要入库的信息");
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
materialSpecKey.setSiteName(siteName);
|
||||||
|
String is_oven = "N";
|
||||||
|
materialSpec = MaterialServiceProxy.getMaterialSpecService()
|
||||||
|
.selectByKey(materialSpecKey);
|
||||||
|
String maturationflag = materialSpec.getMATURATIONFLAG();//熟化标识
|
||||||
|
String is_CON_TEMP = materialSpec.getIS_CON_TEMP();//恒温恒湿
|
||||||
|
//判断仓库是否启用了货位,但货位为空
|
||||||
|
String sql2 = "SELECT be.USE_LOCATION,be.CONST_TEMP,be.IS_OVEN FROM BS_ERPLOCATION be WHERE be.ERPLOCATIONNAME = :ERPLOCATION";
|
||||||
|
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||||
|
hashMap2.put("ERPLOCATION", erpLocation);
|
||||||
|
hashMap2.put("LOCATIONNAME", locationName);
|
||||||
|
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql2, hashMap2);
|
||||||
|
if (queryForList2 == null || queryForList2.size() < 1) {
|
||||||
|
throw new RuntimeException("仓库不存在");
|
||||||
|
} else {
|
||||||
|
String string = queryForList2.get(0).get("USE_LOCATION") == null ? "" : queryForList2.get(0).get("USE_LOCATION").toString();//启用货位
|
||||||
|
// String const_temp = queryForList2.get(0).get("CONST_TEMP") == null ? "" : queryForList2.get(0).get("CONST_TEMP").toString(); //恒温标识
|
||||||
|
// is_oven = queryForList2.get(0).get("IS_OVEN") == null ? "" : queryForList2.get(0).get("IS_OVEN").toString(); //熟化标识
|
||||||
|
// if ("Y".equals(string) && ("".equals(locationName) || locationName == null )) {
|
||||||
|
// throw new RuntimeException("仓库启用了货位,但货位为空");
|
||||||
|
// }
|
||||||
|
// if ("N".equals(string) && (!"".equals(locationName) && locationName != null) ) {
|
||||||
|
// throw new RuntimeException("仓库未启用货位,但货位不为空");
|
||||||
|
// }
|
||||||
|
// if (!"".equals(locationName) && locationName != null) {
|
||||||
|
// String sql3 = "SELECT * FROM STORAGESPEC S WHERE S.STORAGENAME = :LOCATIONNAME AND S.ERPLOCATION = :ERPLOCATION ";
|
||||||
|
// List<Map<String, Object>> queryForList3 = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql3, hashMap2);
|
||||||
|
// if (queryForList3 == null || queryForList3.size() < 1) {
|
||||||
|
// throw new RuntimeException("仓库与货位对应关系不正确");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// String ckhw = "Y".equals(const_temp) ? "恒温恒湿" : "非恒温恒湿";
|
||||||
|
// String wlhw = "Y".equals(is_CON_TEMP) ? "恒温恒湿" : "非恒温恒湿";
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// String cksh = "Y".equals(is_oven) ? "熟化" : "非熟化";
|
||||||
|
// String wlsh = "Y".equals(maturationflag) ? "熟化" : "非熟化";
|
||||||
|
// //物料非熟化 不能进熟化仓
|
||||||
|
// if ("Y".equals(maturationflag)) {
|
||||||
|
//
|
||||||
|
// } else { //非熟化逻辑
|
||||||
|
// if ("Y".equals(is_oven)) {
|
||||||
|
// throw new RuntimeException("仓库" + cksh + "; 物料" + wlsh);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
//物料恒温 只能进恒温仓或熟化仓 2024.11
|
||||||
|
// String packingGrade = queryForList.get(0).get("PACKINGGRADE") == null ? "" : queryForList.get(0).get("PACKINGGRADE").toString();
|
||||||
|
// if (!"NG".equals(packingGrade)) {
|
||||||
|
// if ("Y".equals(is_CON_TEMP)) {
|
||||||
|
// if ("Y".equals(const_temp) || "Y".equals(is_oven)) {
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// throw new RuntimeException("仓库" + ckhw + "; 物料" + wlhw);
|
||||||
|
// }
|
||||||
|
// } else { //物料非恒温 不能进恒温仓
|
||||||
|
// if ("Y".equals(const_temp)) {
|
||||||
|
// throw new RuntimeException("仓库" + ckhw + "; 物料" + wlhw);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (!is_oven.equals(maturationflag)) {
|
||||||
|
// throw new RuntimeException("仓库" + cksh + "; 物料" + wlsh);
|
||||||
|
// }
|
||||||
|
// if (!"Y".equals(maturationflag)) {
|
||||||
|
// if (!const_temp.equals(is_CON_TEMP)) {
|
||||||
|
// throw new RuntimeException("仓库" + ckhw + "; 物料" + wlhw);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("lkMaterialPackingName", palletName);
|
||||||
|
bindMap.put("MaterialType", queryForList.get(0).get("MATERIALTYPE"));
|
||||||
|
bindMap.put("MaterialSpecName",materialSpecName);
|
||||||
|
|
||||||
|
// if ( materialSpecName.startsWith("4")) {
|
||||||
|
// packingGrade = "OK";
|
||||||
|
// }
|
||||||
|
String packingGrade = queryForList.get(0).get("PACKINGGRADE") == null ? "" : queryForList.get(0).get("PACKINGGRADE").toString();
|
||||||
|
if (!"".equals(packingGrade)) {
|
||||||
|
bindMap.put("oqaResultState", GenericServiceProxy.getConstantMap().OQA_State_End);
|
||||||
|
bindMap.put("oqaResult",packingGrade);
|
||||||
|
bindMap.put("packingGrade", packingGrade);
|
||||||
|
} else {
|
||||||
|
bindMap.put("oqaResultState",GenericServiceProxy.getConstantMap().OQA_State_Pre);
|
||||||
|
}
|
||||||
|
|
||||||
|
bindMap.put("SubPackingQuantity",queryForList.get(0).get("MATERIALQUANTITY"));
|
||||||
|
bindMap.put("MaterialCreateQuantity",
|
||||||
|
queryForList.get(0).get("MATERIALQUANTITY"));
|
||||||
|
bindMap.put("MaterialQuantity", queryForList.get(0).get("MATERIALQUANTITY"));// 数量
|
||||||
|
bindMap.put("PackingState", "Released");
|
||||||
|
bindMap.put("OldPackingState", "Released");
|
||||||
|
bindMap.put("stockState", "Created");
|
||||||
|
bindMap.put("OldStockState", "Created");
|
||||||
|
bindMap.put("HoldState", "N");
|
||||||
|
bindMap.put("areaName", areaName);
|
||||||
|
bindMap.put("durableType", queryForList.get(0).get("DURABLETYPE"));
|
||||||
|
bindMap.put("truegg", queryForList.get(0).get("TRUEGG"));
|
||||||
|
bindMap.put("unit", queryForList.get(0).get("UNIT"));
|
||||||
|
bindMap.put("LocationName", locationName);
|
||||||
|
bindMap.put("charge",queryForList.get(0).get("CHARGE"));
|
||||||
|
bindMap.put("DurableName", durableName);
|
||||||
|
bindMap.put("MaterialProcessGroupName","");
|
||||||
|
bindMap.put("LastEventTimeKey",
|
||||||
|
TimeStampUtil.getCurrentEventTimeKey());
|
||||||
|
bindMap.put("ReceiveRequestName", receiveRequestName);
|
||||||
|
bindMap.put("productOrder", receiveRequestName);
|
||||||
|
bindMap.put("ReceiveRequestDetailName",receiveRequestDetailName);
|
||||||
|
bindMap.put("MakeDate", queryForList.get(0).get("MAKEDATE"));
|
||||||
|
bindMap.put("expiringDate", getExpridate(queryForList.get(0).get("MAKEDATE") == null ? "" : queryForList.get(0).get("MAKEDATE").toString(), queryForList.get(0).get("MATERIALSPECNAME").toString()));
|
||||||
|
bindMap.put("ReceiveTime", eventInfo.getEventTime());
|
||||||
|
bindMap.put("ReceiveUser", eventInfo.getEventUser());
|
||||||
|
bindMap.put("ShipTime",queryForList.get(0).get("SHIPTIME"));
|
||||||
|
bindMap.put("ShipUser",queryForList.get(0).get("SHIPUSER"));
|
||||||
|
bindMap.put("ErpLocation", erpLocation);
|
||||||
|
bindMap.put("ErpFactory", erpFactory);
|
||||||
|
bindMap.put("receiveActNo", receiveActNo);
|
||||||
|
bindMap.put("locationName", locationName);
|
||||||
|
bindMap.put("StockInType", "Normal");
|
||||||
|
bindMap.put("SDK_ID", queryForList.get(0).get("SDK_ID"));
|
||||||
|
bindMap.put("PHASE", queryForList.get(0).get("PHASE"));
|
||||||
|
bindMap.put("CUSTOMNO",queryForList.get(0).get("CUSTOMERNO"));//客户
|
||||||
|
bindMap.put("CAREER_ASSISTANCE", queryForList.get(0).get("CAREER_ASSISTANCE"));//业助信息
|
||||||
|
bindMap.put("BUSINESS_UNIT", queryForList.get(0).get("BUSINESS_UNIT"));//业务
|
||||||
|
bindMap.put("SALESPERSON", queryForList.get(0).get("SALESPERSON"));//事业部
|
||||||
|
bindMap.put("MJPC", queryForList.get(0).get("MJPC"));//母卷批次
|
||||||
|
bindMap.put("remark", queryForList.get(0).get("REMARK"));//备注
|
||||||
|
if("Y".equals(is_oven)) {
|
||||||
|
bindMap.put("MATURATIONINTIME", eventInfo.getEventTime());//熟化入库时间
|
||||||
|
}
|
||||||
|
|
||||||
|
//增加立库相关信息T.LK_DURABLENAME,T.LK_AREANAME,T.LK_PRODUCTLINE,T.LK_WIDTH ,T.LK_DEVIATION,T.LK_WEIGHT,T.LK_DIAMETER,T.LK_SHELFNAME
|
||||||
|
bindMap.put("durableName", queryForList.get(0).get("LK_DURABLENAME"));
|
||||||
|
bindMap.put("areaName", queryForList.get(0).get("LK_AREANAME"));
|
||||||
|
bindMap.put("PRODUCTLINE", queryForList.get(0).get("LK_PRODUCTLINE"));
|
||||||
|
bindMap.put("WIDTH", queryForList.get(0).get("LK_WIDTH"));
|
||||||
|
bindMap.put("DEVIATION", queryForList.get(0).get("LK_DEVIATION"));
|
||||||
|
bindMap.put("WEIGHT", queryForList.get(0).get("LK_WEIGHT"));
|
||||||
|
bindMap.put("DIAMETER", queryForList.get(0).get("LK_DIAMETER"));
|
||||||
|
bindMap.put("shelfName", queryForList.get(0).get("LK_SHELFNAME"));
|
||||||
|
|
||||||
|
|
||||||
|
//查询库存是否存在,且状态为创建
|
||||||
|
String sql4 = "SELECT m.STOCKSTATE FROM MATERIALPACKING m WHERE m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME ";
|
||||||
|
List<Map<String, Object>> queryForList4 = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql4, hashMap);
|
||||||
|
if (queryForList4 != null && queryForList4.size() > 0) {
|
||||||
|
String stockState = queryForList4.get(0).get("STOCKSTATE").toString();
|
||||||
|
if ("Created".equals(stockState)) {
|
||||||
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
setEventInfo.setUserColumns(bindMap);
|
||||||
|
MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName, materialPackingName);
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, eventInfo, setEventInfo);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//入库信息存入库存表
|
||||||
|
CreateInfo createInfo = new CreateInfo();
|
||||||
|
createInfo.setSiteName(siteName);
|
||||||
|
createInfo.setMaterialPackingName(materialPackingName);// 新生成的box id
|
||||||
|
createInfo.setMaterialPackingType("Box");
|
||||||
|
createInfo.setContentMaterialType("");
|
||||||
|
createInfo.setUserColumns(bindMap);
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().create(
|
||||||
|
eventInfo, createInfo);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 成品入库不拆完工报告
|
* 成品入库不拆完工报告
|
||||||
@ -794,7 +1010,9 @@ public class ProductIntoServiceImpl implements FGStockInService {
|
|||||||
setEventInfo.setUserColumns(bindMap);
|
setEventInfo.setUserColumns(bindMap);
|
||||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
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";
|
String sql2 = "UPDATE BS_MES_SHIPPED T SET T.RECEIVE_FLAG = 'Z', T.RECEIVE_TIME = SYSDATE WHERE T.LOTNAME = :LOTNAME";
|
||||||
|
// String sql2 = "DELETE FROM BS_MES_SHIPPED T WHERE T.LOTNAME = :LOTNAME";
|
||||||
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||||
hashMap2.put("LOTNAME", map.get("MATERIALPACKINGNAME").toString());
|
hashMap2.put("LOTNAME", map.get("MATERIALPACKINGNAME").toString());
|
||||||
IDMFrameServiceProxy.getSqlTemplate().update(sql2, hashMap2);
|
IDMFrameServiceProxy.getSqlTemplate().update(sql2, hashMap2);
|
||||||
|
@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
// gf 生成流水码
|
||||||
@Component
|
@Component
|
||||||
public class CodeGenerator {
|
public class CodeGenerator {
|
||||||
|
|
||||||
@ -58,35 +59,82 @@ public class CodeGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改数量,条码里批次拆分获取流水码
|
// 修改数量,条码里批次拆分获取流水码
|
||||||
public static String packingGenerateCode(String materialpackingname,String qty2) throws CustomException {
|
public static String packingGenerateCode(String materialpackingname,String qty2,String Charge) throws CustomException {
|
||||||
|
|
||||||
// 3. 遍历结果集,生成新条码并更新数据库
|
|
||||||
List<Integer> idsToUpdate = new ArrayList<Integer>();
|
|
||||||
List<String> newNames = new ArrayList<String>();
|
|
||||||
int sequence = 1; // 假设从1开始计数,实际中可能需要从数据库获取当前最大值或使用其他逻辑
|
int sequence = 1; // 假设从1开始计数,实际中可能需要从数据库获取当前最大值或使用其他逻辑
|
||||||
|
|
||||||
String[] parts = materialpackingname.split("\\|");
|
// 查询当前批次下的所有条码,获取最大流水码,并在最大流水码基础上加1
|
||||||
if (parts.length < 7) {
|
String query = "SELECT MATERIALPACKINGNAME FROM MATERIALPACKING WHERE CHARGE = :CHARGE";
|
||||||
throw new IllegalArgumentException("Invalid barcode format: " + materialpackingname);
|
|
||||||
|
try {
|
||||||
|
Map<String, String> bindMap = new HashMap<String, String>();
|
||||||
|
bindMap.put("CHARGE", Charge);
|
||||||
|
List<Map<String, Object>> result = IDMFrameServiceProxy.getSqlTemplate().queryForList(query, bindMap);
|
||||||
|
|
||||||
|
// 如果存在流水码(同批次下,除开原条码还有新的条码)
|
||||||
|
if(result.size() > 1){
|
||||||
|
|
||||||
|
// 存储流水码
|
||||||
|
List<String> chargeNoList = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map<String, Object> map : result) {
|
||||||
|
String materialPackingName = map.get("MATERIALPACKINGNAME").toString();
|
||||||
|
String[] partsPak = materialPackingName.split("\\|");
|
||||||
|
if (partsPak.length < 7) {
|
||||||
|
throw new IllegalArgumentException("条码格式有误: " + materialPackingName);
|
||||||
|
}
|
||||||
|
String[] chargeNos = partsPak[4].split("-");
|
||||||
|
// 存在流水码的,最少能拆2个
|
||||||
|
if(chargeNos.length > 1){
|
||||||
|
// 获取chargeNos最后一个值(流水码)
|
||||||
|
String lastValue = chargeNos[chargeNos.length - 1];
|
||||||
|
|
||||||
|
// 正则匹配lastValue字符串的值,只能是1-9的单个字符串
|
||||||
|
if (lastValue.matches("[1-9]")) {
|
||||||
|
chargeNoList.add(lastValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//对储存的流水码chargeNoList,进行排序,获取最大流水码并加1赋值给sequence
|
||||||
|
Collections.sort(chargeNoList);
|
||||||
|
int max = Integer.parseInt(chargeNoList.get(chargeNoList.size() - 1));
|
||||||
|
sequence = max + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 遍历结果集,生成新条码并更新数据库
|
||||||
|
List<Integer> idsToUpdate = new ArrayList<Integer>();
|
||||||
|
List<String> newNames = new ArrayList<String>();
|
||||||
|
|
||||||
|
String[] parts = materialpackingname.split("\\|");
|
||||||
|
if (parts.length < 7) {
|
||||||
|
throw new IllegalArgumentException("条码格式有误: " + materialpackingname);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建新的条码部分,假设在第五部分(索引4,因为索引从0开始)后添加流水码
|
||||||
|
StringBuilder newBasePart = new StringBuilder();
|
||||||
|
for (int i = 0; i < parts.length - 4; i++) { // 不包括最后两个部分
|
||||||
|
newBasePart.append(parts[i]).append("|");
|
||||||
|
}
|
||||||
|
newBasePart.append(parts[4]).append("-").append(sequence++); // 在第五部分后添加流水码
|
||||||
|
// for (int i = 6; i < parts.length; i++) { // 添加最后两个部分
|
||||||
|
// newBasePart.append("|").append(parts[i]);
|
||||||
|
// }
|
||||||
|
// 添加倒数第二个部分(假设是日期)
|
||||||
|
newBasePart.append("|").append(parts[5]);
|
||||||
|
newBasePart.append("|").append(parts[6]);
|
||||||
|
// 添加新的数量部分
|
||||||
|
newBasePart.append("|").append(qty2); // 使用传入的新数量值
|
||||||
|
|
||||||
|
// idsToUpdate.add(id);
|
||||||
|
newNames.add(newBasePart.toString());
|
||||||
|
|
||||||
|
return newBasePart.toString();
|
||||||
|
|
||||||
|
|
||||||
|
}catch (Exception e) {
|
||||||
|
log.error("Failed to generate pallet number: " + e.getMessage());
|
||||||
|
throw new RuntimeException("生成流水码错误: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建新的条码部分,假设在第五部分(索引4,因为索引从0开始)后添加流水码
|
|
||||||
StringBuilder newBasePart = new StringBuilder();
|
|
||||||
for (int i = 0; i < parts.length - 2; i++) { // 不包括最后两个部分
|
|
||||||
newBasePart.append(parts[i]).append("|");
|
|
||||||
}
|
|
||||||
newBasePart.append(parts[4]).append("-").append(sequence++); // 在第五部分后添加流水码
|
|
||||||
// for (int i = 6; i < parts.length; i++) { // 添加最后两个部分
|
|
||||||
// newBasePart.append("|").append(parts[i]);
|
|
||||||
// }
|
|
||||||
// 添加倒数第二个部分(假设是日期)
|
|
||||||
newBasePart.append("|").append(parts[5]);
|
|
||||||
// 添加新的数量部分
|
|
||||||
newBasePart.append("|").append(qty2); // 使用传入的新数量值
|
|
||||||
|
|
||||||
// idsToUpdate.add(id);
|
|
||||||
newNames.add(newBasePart.toString());
|
|
||||||
|
|
||||||
return newBasePart.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user