fix:修改移库接口
This commit is contained in:
parent
06e7015374
commit
bafdd39945
@ -4,10 +4,17 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cim.idm.exception.GlobalException;
|
||||
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||
import com.cim.idm.framework.data.EventInfo;
|
||||
import com.cim.idm.model.MaterialPacking;
|
||||
import com.cim.idm.model.MoveInDto;
|
||||
import com.cim.idm.service.Impl.InvoiceServiceImpl;
|
||||
import com.cim.idm.utils.AjaxResult;
|
||||
import com.cim.idm.utils.CommonUtils;
|
||||
import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy;
|
||||
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey;
|
||||
import com.cim.idm.wmspackage.materialpacking.management.info.MaterialPackingAssignShipRequestInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -16,10 +23,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
import com.cim.idm.service.Impl.MoveInServiceImpl;
|
||||
|
||||
|
||||
@ -165,6 +170,31 @@ public class MoveInController {
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/AllCommitMoveInInvoice", method = RequestMethod.POST)
|
||||
public AjaxResult AllCommitMoveInInvoice(@RequestBody JSONObject in ) throws Exception {
|
||||
MoveInDto materialPacking = JSON.toJavaObject(in, MoveInDto.class);
|
||||
String locationName = materialPacking.getLocationName();
|
||||
// String charge = materialPacking.getCharge();
|
||||
String materialPackingName = materialPacking.getMaterialPackingName();
|
||||
// String materialSpecName = materialPacking.getMaterialSpecName();
|
||||
String shipRequestName = materialPacking.getShipRequestName();
|
||||
String shipRequestDetailName = materialPacking.getShipRequestDetailName();
|
||||
String user = materialPacking.getUser();
|
||||
String commitDate = materialPacking.getCommitDate();
|
||||
String opCode = materialPacking.getOpCode();
|
||||
List<com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking> boxList = materialPacking.getBoxList();
|
||||
boolean bindBarCodeToMoveIn = MoveInServiceImpl.BindBarCodeToMoveIn2(boxList,materialPackingName, user, shipRequestName, shipRequestDetailName,locationName);
|
||||
if (!bindBarCodeToMoveIn) {
|
||||
throw new GlobalException("货位绑定到条码失败!");
|
||||
}
|
||||
boolean commitMoveInInvoice = MoveInServiceImpl.CommitMoveInInvoice(shipRequestName, user,commitDate,opCode);
|
||||
if (!commitMoveInInvoice) {
|
||||
throw new GlobalException("过账失败!");
|
||||
}
|
||||
return AjaxResult.me().setResultObj(null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
23
zi-wms-pda/src/main/java/com/cim/idm/model/MoveInDto.java
Normal file
23
zi-wms-pda/src/main/java/com/cim/idm/model/MoveInDto.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.cim.idm.model;
|
||||
|
||||
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class MoveInDto {
|
||||
|
||||
private String ShipRequestName;
|
||||
private String ShipRequestDetailName;
|
||||
private String siteName;
|
||||
private String user;
|
||||
private String eventName;
|
||||
private String MaterialPackingName;
|
||||
private String erpfactory;
|
||||
private String erplocation;
|
||||
private String locationName;
|
||||
private String commitDate;
|
||||
private String opCode;
|
||||
private List<MaterialPacking> boxList;
|
||||
}
|
@ -2046,4 +2046,148 @@ public class InvoiceServiceImpl implements InvoiceService {
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void Reserve5 (MaterialPacking materialPacking, String shipReuqestName,
|
||||
String materialSpecName, String sdk_id, String phase,
|
||||
String type, String siteName, String user, String materialQuantity2, String fifoFlag) throws CustomException {
|
||||
String materialPackingName = materialPacking.getMaterialPackingName();//条码
|
||||
// float materialQuantity = materialPacking.getMaterialQuantity();
|
||||
// float mqty2 = materialPacking.getMaterialQuantity2();
|
||||
// String charge = materialPacking.getCharge();//批次
|
||||
EventInfo makeEventInfo;
|
||||
//1.绑定
|
||||
//校验Box有没有被其他订单绑过
|
||||
if ("Assign".equals(type)) {
|
||||
makeEventInfo = new EventInfoUtil().makeEventInfo("AssiginShipRequest", user, "AssiginShipRequest");
|
||||
String sql = "SELECT SHIPREQUESTNAME,MATERIALQUANTITY,SDK_ID,PHASE FROM MATERIALPACKING T WHERE T.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||
hashMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||
List<Map<String,Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||
if (queryForList == null || queryForList.size() < 1) {
|
||||
throw new CustomException("条码在系统中不存在");
|
||||
} else {
|
||||
String invoice = queryForList.get(0).get("SHIPREQUESTNAME") == null ? "" : queryForList.get(0).get("SHIPREQUESTNAME").toString().toString();
|
||||
if (!"".equals(invoice) && !invoice.equals(shipReuqestName)) {
|
||||
throw new CustomException("条码已被" + invoice + "备货");
|
||||
}
|
||||
phase = queryForList.get(0).get("PHASE") == null ? "" :queryForList.get(0).get("PHASE").toString();
|
||||
//更新Box绑定关系、Box发货数量、拆分到条码明细表
|
||||
// SetEventInfo setEventInfo = new SetEventInfo();
|
||||
// Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||
// //更新实际实际出库数量到库存表
|
||||
// MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName, materialPackingName);
|
||||
// hashMap2.put("shipRequestName", shipReuqestName);
|
||||
// hashMap2.put("fifoFlag", fifoFlag);
|
||||
// hashMap2.put("materialQuantity2", queryForList.get(0).get("MATERIALQUANTITY").toString());//先将Box数量记录至materialQuantity2
|
||||
// setEventInfo.setUserColumns(hashMap2);
|
||||
// hashMap2.put("fifoFlag", fifoFlag);
|
||||
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
||||
hashMap.put("materialQuantity2", queryForList.get(0).get("MATERIALQUANTITY").toString());
|
||||
hashMap.put("fifoFlag", fifoFlag);
|
||||
hashMap.put("shipRequestName", shipReuqestName);
|
||||
hashMap.put("SITENAME", siteName);
|
||||
|
||||
String upMkSql = "UPDATE\r\n" +
|
||||
" MATERIALPACKING m\r\n" +
|
||||
"SET\r\n" +
|
||||
" m.MATERIALQUANTITY2 = :materialQuantity2,\r\n" +
|
||||
" m.FIFOFLAG = :fifoFlag,\r\n" +
|
||||
" m.SHIPREQUESTNAME = :shipRequestName\r\n" +
|
||||
"WHERE\r\n" +
|
||||
" m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME\r\n" +
|
||||
" AND m.SITENAME = :SITENAME";
|
||||
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(upMkSql, hashMap);
|
||||
|
||||
|
||||
//更新备货数量
|
||||
// BigDecimal QTY = new BigDecimal(materialQuantity);
|
||||
String updateSql= " UPDATE MATERIALSHIPREQUESTDETAIL m SET m.ASSIGNEDQUANTITY = m.ASSIGNEDQUANTITY + :QTY WHERE m.SITENAME = :SITENAME"
|
||||
+ " AND m.SHIPREQUESTNAME = :SHIPREQUESTNAME AND m.MATERIALSPECNAME = :MATERIALSPECNAME "
|
||||
+ " AND (:SDK_ID IS NULL OR SDK_ID = :SDK_ID) " +
|
||||
// "AND (:PHASE IS NULL OR PHASE = :PHASE) " +
|
||||
"AND ROWNUM = 1 ";
|
||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||
bindMap.put("QTY", queryForList.get(0).get("MATERIALQUANTITY").toString());
|
||||
bindMap.put("SITENAME", siteName);
|
||||
bindMap.put("SHIPREQUESTNAME", shipReuqestName);
|
||||
bindMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||
bindMap.put("MATERIALSPECNAME", materialSpecName);
|
||||
bindMap.put("SDK_ID", sdk_id);
|
||||
bindMap.put("PHASE", phase);
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(updateSql, bindMap);
|
||||
}
|
||||
|
||||
} else if ("Dessign".equals(type)) {
|
||||
//解绑根据查询出的materil信息拿到SDKID和阶段
|
||||
// sdk_id = materialPacking.getSDK_ID();
|
||||
// phase = materialPacking.getPHASE();
|
||||
makeEventInfo = new EventInfoUtil().makeEventInfo("DessiginShipRequest", user, "DessiginShipRequest");
|
||||
String sql = "SELECT SHIPREQUESTNAME,CASE WHEN MATERIALQUANTITY2 > 0 THEN MATERIALQUANTITY2 ELSE MATERIALQUANTITY END MATERIALQUANTITY2,SDK_ID,PHASE FROM MATERIALPACKING T WHERE T.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||
hashMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||
List<Map<String,Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||
if (queryForList == null || queryForList.size() < 1) {
|
||||
throw new CustomException("条码在系统中不存在");
|
||||
} else {
|
||||
|
||||
sdk_id = queryForList.get(0).get("SDK_ID") == null ? "" : queryForList.get(0).get("SDK_ID").toString();
|
||||
phase = queryForList.get(0).get("PHASE") == null ? "" : queryForList.get(0).get("PHASE") .toString();
|
||||
|
||||
|
||||
String invoice = queryForList.get(0).get("SHIPREQUESTNAME") == null ? "" : queryForList.get(0).get("SHIPREQUESTNAME").toString().toString();
|
||||
if (!"".equals(shipReuqestName) && !invoice.equals(shipReuqestName)) {
|
||||
throw new CustomException("条码已被" + invoice + "备货");
|
||||
}
|
||||
|
||||
//更新Box绑定关系、Box发货数量、拆分到条码明细表
|
||||
// SetEventInfo setEventInfo = new SetEventInfo();
|
||||
// Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||
// //更新实际实际出库数量到库存表
|
||||
// MaterialPackingKey materialPackingKey = new MaterialPackingKey(siteName, materialPackingName);
|
||||
// hashMap2.put("shipRequestName", "");
|
||||
// hashMap2.put("fifoFlag", "");
|
||||
// hashMap2.put("shipRequestDetailName", "");
|
||||
// hashMap2.put("materialQuantity2", "0");
|
||||
// setEventInfo.setUserColumns(hashMap2);
|
||||
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
||||
//更新备货数量
|
||||
// BigDecimal QTY = new BigDecimal(materialQuantity);
|
||||
hashMap.put("shipRequestName", "");
|
||||
hashMap.put("fifoFlag", "");
|
||||
hashMap.put("shipRequestDetailName", "");
|
||||
hashMap.put("materialQuantity2", "0");
|
||||
hashMap.put("SITENAME", siteName);
|
||||
String upMkSql = "UPDATE\r\n" +
|
||||
" MATERIALPACKING m\r\n" +
|
||||
"SET\r\n" +
|
||||
" m.MATERIALQUANTITY2 = :materialQuantity2,\r\n" +
|
||||
" m.FIFOFLAG = :fifoFlag,\r\n" +
|
||||
" m.SHIPREQUESTNAME = :shipRequestName,\r\n" +
|
||||
" m.SHIPREQUESTDETAILNAME = :shipRequestDetailName\r\n" +
|
||||
"WHERE\r\n" +
|
||||
" m.MATERIALPACKINGNAME = :MATERIALPACKINGNAME\r\n" +
|
||||
" AND m.SITENAME = :SITENAME";
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(upMkSql, hashMap);
|
||||
|
||||
|
||||
String updateSql= " UPDATE MATERIALSHIPREQUESTDETAIL m SET m.ASSIGNEDQUANTITY = m.ASSIGNEDQUANTITY - :QTY WHERE m.SITENAME = :SITENAME"
|
||||
+ " AND m.SHIPREQUESTNAME = :SHIPREQUESTNAME AND m.MATERIALSPECNAME = :MATERIALSPECNAME "
|
||||
+ "AND (:SDK_ID IS NULL OR SDK_ID = :SDK_ID) " +
|
||||
// "AND (:PHASE IS NULL OR PHASE = :PHASE)" +
|
||||
" AND ROWNUM = 1 ";
|
||||
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||
//bindMap.put("QTY", materialQuantity2);
|
||||
bindMap.put("QTY", queryForList.get(0).get("MATERIALQUANTITY2").toString());
|
||||
bindMap.put("SITENAME", siteName);
|
||||
bindMap.put("SHIPREQUESTNAME", shipReuqestName);
|
||||
bindMap.put("MATERIALPACKINGNAME", materialPackingName);
|
||||
bindMap.put("MATERIALSPECNAME", materialSpecName);
|
||||
bindMap.put("SDK_ID", sdk_id);
|
||||
bindMap.put("PHASE", phase);
|
||||
IDMFrameServiceProxy.getSqlTemplate().update(updateSql, bindMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||
import com.cim.idm.utils.EventInfoUtil;
|
||||
import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy;
|
||||
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
|
||||
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPackingKey;
|
||||
import com.cim.idm.wmspackage.materialpacking.management.info.SetEventInfo;
|
||||
import com.cim.idm.wmspackage.storage.StorageServiceProxy;
|
||||
import com.cim.idm.wmspackage.storage.management.data.StorageSpec;
|
||||
@ -81,6 +82,63 @@ public class MoveInServiceImpl implements MoveInService {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* pc端移库绑定条码
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean BindBarCodeToMoveIn2(List<MaterialPacking> boxList, String materialPackingName, String user,
|
||||
String shipRequestName, String shipRequestDetailName, String locationName) throws GlobalException {
|
||||
//解析条码,根据远条码信息更新目标条码数量和库存状态
|
||||
String condition="WHERE CHARGE=? AND MATERIALSPECNAME=? ";
|
||||
// String[] bindSet={charge,materialspecName};
|
||||
// List<MaterialPacking> MaterialPackingList = MaterialPackingServiceProxy.getMaterialPackingService().select(condition, bindSet);
|
||||
SetEventInfo setEventInfo = new SetEventInfo();
|
||||
EventInfoUtil eventInfoUtil = new EventInfoUtil();
|
||||
makeEventInfo = eventInfoUtil.makeEventInfo("BarCodeToMoveIn", user, "BarCodeToMoveIn", "", "");
|
||||
String sql = "select * from STORAGESPEC WHERE STORAGENAME = :STORAGENAME" ;
|
||||
Map<String, Object> hashMap2 = new HashMap<String,Object> ();
|
||||
hashMap2.put("STORAGENAME", locationName);
|
||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap2);
|
||||
if (queryForList == null || queryForList.size() < 1) {
|
||||
throw new GlobalException(locationName + "库位不存在!");
|
||||
}
|
||||
//根据货位找到ERP库位和组织
|
||||
condition="WHERE STORAGENAME=? ";
|
||||
String[] indSet={locationName};
|
||||
List<StorageSpec> select = StorageServiceProxy.getStorageSpecService().select(condition, indSet);
|
||||
String erpFactory = "";
|
||||
String erpLocation = "";
|
||||
for (StorageSpec storageSpec : select) {
|
||||
erpLocation = storageSpec.getErpLocation();
|
||||
erpFactory = storageSpec.getErpFactory();
|
||||
}
|
||||
if ("".equals(erpLocation) || "".equals(erpFactory)) {
|
||||
throw new GlobalException(locationName + "库位不存在!");
|
||||
}
|
||||
// String[] split = materialPackingName.split("\\|");
|
||||
for (MaterialPacking materialPacking : boxList) {
|
||||
//更新批次,数量,库位状态
|
||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||
// hashMap.put("shipRequestName", shipRequestName);
|
||||
// hashMap.put("shipRequestDetailName", shipRequestDetailName);
|
||||
hashMap.put("erpLocation", erpLocation);
|
||||
hashMap.put("erpFactory", erpFactory);
|
||||
hashMap.put("locationName", locationName);
|
||||
setEventInfo.setUserColumns(hashMap);
|
||||
MaterialPackingKey key = new MaterialPackingKey("SDK",materialPacking.getMaterialPackingName());
|
||||
// MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPacking.getKey(), makeEventInfo, setEventInfo);
|
||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(key, makeEventInfo, setEventInfo);
|
||||
|
||||
// String sql2 = "UPDATE MATERIALSHIPREQUESTDETAIL T SET T.ASSIGNEDQUANTITY = T.ASSIGNEDQUANTITY + :materialQuantity "
|
||||
// + "WHERE T.SHIPREQUESTNAME = :shipRequestName AND T.SHIPREQUESTDETAILNAME = :shipRequestDetailName ";
|
||||
// hashMap.put("materialQuantity", split[7]);
|
||||
// IDMFrameServiceProxy.getSqlTemplate().update(sql2, hashMap);
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean CommitMoveInInvoice(String shipRequestName,String user,String commitDate,String opCode) throws Exception {
|
||||
EventInfoUtil eventInfoUtil = new EventInfoUtil();
|
||||
|
@ -1,5 +1,11 @@
|
||||
package com.cim.idm.service;
|
||||
|
||||
import com.cim.idm.exception.GlobalException;
|
||||
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MoveInService {
|
||||
|
||||
/**
|
||||
@ -11,6 +17,10 @@ public interface MoveInService {
|
||||
String shipRequestName,String shipRequestDetailName,String locationName) throws Exception;
|
||||
|
||||
|
||||
@Transactional
|
||||
boolean BindBarCodeToMoveIn2(List<MaterialPacking> boxList, String materialPackingName, String user,
|
||||
String shipRequestName, String shipRequestDetailName, String locationName) throws GlobalException;
|
||||
|
||||
/**
|
||||
* 调拨入库提交
|
||||
* @param shipRequestName
|
||||
|
Loading…
x
Reference in New Issue
Block a user