Merge branch 'main' of http://162.14.99.253:3000/10539622/2025-03-JS-SDK-svr
# Conflicts: # zi-wms-pda/src/main/java/com/cim/idm/controller/MaterialReceiveActController.java
This commit is contained in:
commit
929ced5880
@ -141,6 +141,18 @@
|
|||||||
<version>1.5.22</version>
|
<version>1.5.22</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.12.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
|
<version>2.12.4</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -31,4 +31,11 @@ public enum ReceiveTypeEnums {
|
|||||||
str.add(Z004.getCode());
|
str.add(Z004.getCode());
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否采购订单
|
||||||
|
*/
|
||||||
|
public static Boolean isPurchase(String code) {
|
||||||
|
return getPurchase().contains(code);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class DeliveryController {
|
|||||||
deliveryName = byKey.getDeliveryName();
|
deliveryName = byKey.getDeliveryName();
|
||||||
// 到库单(找出该单据下的所有的采购单)
|
// 到库单(找出该单据下的所有的采购单)
|
||||||
nameList = deliveryService.getRelByDelivery(storeDetailDto)
|
nameList = deliveryService.getRelByDelivery(storeDetailDto)
|
||||||
.stream().map(MaterialDeliveryReceive::getReceiveRequestName).collect(Collectors.toList());
|
.stream().map(MaterialDeliveryReceive::getReceiveRequestName).distinct().collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
// 采购单
|
// 采购单
|
||||||
MaterialReceiveRequest receiveByKey = deliveryService.getReceiveByKey(storeDetailDto);
|
MaterialReceiveRequest receiveByKey = deliveryService.getReceiveByKey(storeDetailDto);
|
||||||
|
@ -3,6 +3,7 @@ package com.cim.idm.controller;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cim.idm.constants.delivery.DeliveryStateEnums;
|
import com.cim.idm.constants.delivery.DeliveryStateEnums;
|
||||||
|
import com.cim.idm.constants.receive.ReceiveTypeEnums;
|
||||||
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.model.dto.delivery.DeliveryEditDto;
|
import com.cim.idm.model.dto.delivery.DeliveryEditDto;
|
||||||
@ -520,9 +521,14 @@ public class MaterialReceiveActController {
|
|||||||
String siteName = request.getSiteName();
|
String siteName = request.getSiteName();
|
||||||
String erpFactory = request.getSTOCKORGNO();
|
String erpFactory = request.getSTOCKORGNO();
|
||||||
|
|
||||||
String undoId;
|
String undoId = null;
|
||||||
try {
|
try {
|
||||||
undoId = SendERPStockIn(receiveRequestName, siteName, user, opCode,commitDate,opCode);
|
// 采购订单
|
||||||
|
if (ReceiveTypeEnums.isPurchase(request.getReceiveRequestType())) {
|
||||||
|
Map<String,Object> args = new HashMap<>();
|
||||||
|
undoId = toSAPServiceImpl.PurStockIn(receiveRequestName, siteName, user, args);
|
||||||
|
}
|
||||||
|
// @TODO 其他订单
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
|
return AjaxResult.me().setSuccess(false).setMessage(e.toString());
|
||||||
@ -554,43 +560,4 @@ public class MaterialReceiveActController {
|
|||||||
}
|
}
|
||||||
return AjaxResult.me().setResultObj(null);
|
return AjaxResult.me().setResultObj(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String SendERPStockIn(String receiveRequestName, String siteName, String eventUser,String reActo,String commitDate,String opCode) throws Exception {
|
|
||||||
//判断单据类型调用不同的NC接口
|
|
||||||
String sql = "SELECT m.RECEIVEREQUESTTYPE,m.RECEIVEREQUESTDETAILTYPE FROM MATERIALRECEIVEREQUEST m WHERE m.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME";
|
|
||||||
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
|
||||||
hashMap.put("RECEIVEREQUESTNAME", receiveRequestName);
|
|
||||||
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
|
||||||
String billCode = "";
|
|
||||||
if (queryForList != null && queryForList.size() > 0) {
|
|
||||||
String type = queryForList.get(0).get("RECEIVEREQUESTTYPE").toString();
|
|
||||||
// String receiverequestdetailtype = queryForList.get(0).get("RECEIVEREQUESTDETAILTYPE").toString();
|
|
||||||
switch (type) {
|
|
||||||
case "Z001" : //采购入库
|
|
||||||
case "Z002" : //研发采购订单
|
|
||||||
case "Z003" : //非生产物资采购订单
|
|
||||||
case "Z004" : //固定资产、在建工程采购订单
|
|
||||||
Map<String,Object> args = new HashMap<>();
|
|
||||||
billCode = toSAPServiceImpl.PurStockIn(receiveRequestName, siteName, eventUser,
|
|
||||||
args/* ,overReceiveControls */);
|
|
||||||
break;
|
|
||||||
case "Z005" : //服务费用采购订单
|
|
||||||
case "Z006" : //股份 - 泗洪STO
|
|
||||||
case "Z007" : //股份泗洪-分子公司STO
|
|
||||||
break;
|
|
||||||
case "Z008" : //物资退货采购订单
|
|
||||||
break;
|
|
||||||
case "ZLR1" : //销售退料
|
|
||||||
billCode = toSAPServiceImpl.SaleReturn(receiveRequestName, "SDK", eventUser,commitDate, opCode);
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new CustomException("找不到单据" + receiveRequestName);
|
|
||||||
}
|
|
||||||
return billCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,818 @@
|
|||||||
|
package com.cim.idm.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cim.idm.constants.receive.ReceiveTypeEnums;
|
||||||
|
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||||
|
import com.cim.idm.framework.data.EventInfo;
|
||||||
|
import com.cim.idm.framework.exception.IDMFrameDBErrorSignal;
|
||||||
|
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||||
|
import com.cim.idm.model.dto.delivery.StoreDetailDto;
|
||||||
|
import com.cim.idm.model.po.MaterialReceiveRequest;
|
||||||
|
import com.cim.idm.model.po.delivery.MaterialDelivery;
|
||||||
|
import com.cim.idm.model.vo.DeliveryReceiveDetailVo;
|
||||||
|
import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceImpl;
|
||||||
|
import com.cim.idm.mwmsextend.materialreceiverequest.service.MaterialReceiveRequestServiceImpl;
|
||||||
|
import com.cim.idm.service.IDeliveryService;
|
||||||
|
import com.cim.idm.service.Impl.SDKMaterialPackingServiceImpl;
|
||||||
|
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||||
|
import com.cim.idm.utils.AjaxResult;
|
||||||
|
import com.cim.idm.utils.EventInfoUtil;
|
||||||
|
import com.cim.idm.wmsextend.generic.GenericServiceProxy;
|
||||||
|
import com.cim.idm.wmsextend.generic.errorHandler.CustomException;
|
||||||
|
import com.cim.idm.wmspackage.material.MaterialServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.material.management.data.MaterialSpec;
|
||||||
|
import com.cim.idm.wmspackage.material.management.data.MaterialSpecKey;
|
||||||
|
import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.materialpacking.management.info.CreateInfo;
|
||||||
|
import com.cim.idm.wmspackage.materialreceiverequestact.MaterialReceiveRequestActServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.materialreceiverequestact.management.info.CreateReceiveRequestBatchInfo;
|
||||||
|
import com.cim.idm.wmspackage.materialreceiverequestactdetail.MaterialReceiveRequestActDetailServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.materialreceiverequestactdetail.management.info.ActDetailIncreaseInfo;
|
||||||
|
import com.cim.idm.wmspackage.materialreceiverequestactdetail.management.info.CreateActDetailInfo;
|
||||||
|
import com.cim.idm.wmspackage.materialreceivetactdetail.management.data.MaterialReceiveActDetailKey;
|
||||||
|
import com.cim.idm.wmspackage.materialshiprequestdetail.MaterialShipRequestDetailServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.materialshiprequestdetail.management.data.MaterialShipRequestDetailKey;
|
||||||
|
import com.cim.idm.wmspackage.materialshiprequestdetail.management.info.MakeShipDetailIncreaseAssignedInfo;
|
||||||
|
import com.cim.idm.wmspackage.materialshiprequesttooem.MaterialShipRequestToOEMServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.materialshiprequesttooem.management.data.MaterialShipRequestToOEMKey;
|
||||||
|
import com.cim.idm.wmspackage.materialshiprequesttooem.management.info.MakeOEMDecreaseAssignedInfo;
|
||||||
|
import com.cim.idm.wmspackage.name.NameServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.receiverequestdetail.ReceiveRequestDetailServiceProxy;
|
||||||
|
import com.cim.idm.wmspackage.receiverequestdetail.management.data.MaterialReceiveRequestDetailKey;
|
||||||
|
import com.cim.idm.wmspackage.receiverequestdetail.management.info.MakeDetailIncreaseReceivedInfo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Api("不已批次管理入库")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/NoCharge")
|
||||||
|
@EnableAutoConfiguration
|
||||||
|
public class NoChargeStockIn {
|
||||||
|
|
||||||
|
private static Log log = LogFactory.getLog(MaterialReceiveRequestServiceImpl.class);
|
||||||
|
SDKMaterialPackingServiceImpl SDKMP = new SDKMaterialPackingServiceImpl();
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IDeliveryService deliveryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ToSAPServiceImpl toSAPServiceImpl;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@RequestMapping(value = "/NoChargeStockIn", method = RequestMethod.POST)
|
||||||
|
public AjaxResult NoChargeStockIn(@RequestBody JSONObject in ) throws Exception {
|
||||||
|
// 将字符串转换为JSONArray对象
|
||||||
|
|
||||||
|
String ERPFACTORY="";
|
||||||
|
String ERPLOCATION="";
|
||||||
|
String LOCATIONNAME="";
|
||||||
|
// String RECEIVEREQUESTNAME="";
|
||||||
|
// String RECEIVEREQUESTDETAILNAME="";
|
||||||
|
String MATERIALSPECNAME="";
|
||||||
|
String MATERIALUNITDESC="";
|
||||||
|
String MATERIALUNIT="";
|
||||||
|
String REQUESTQUANTITY="";
|
||||||
|
String RECEIVEDQUANTITY="";
|
||||||
|
String ThisAcceptNumber="";
|
||||||
|
String user="";
|
||||||
|
String SiteName="";
|
||||||
|
String MAKEDATE="";
|
||||||
|
String receiveAct="";
|
||||||
|
String sdkid="";
|
||||||
|
String commitDate = "";
|
||||||
|
String opCode = "";
|
||||||
|
String siteName = (String)in.get("SITENAME");
|
||||||
|
// 判定是否是到货单
|
||||||
|
StoreDetailDto storeDetailDto = new StoreDetailDto();
|
||||||
|
storeDetailDto.setSiteName(siteName);
|
||||||
|
storeDetailDto.setDocumentName((String)in.get("RECEIVEREQUESTNAME"));
|
||||||
|
MaterialDelivery byKey = deliveryService.getByKey(storeDetailDto);
|
||||||
|
Boolean isDelivery = Objects.nonNull(byKey);
|
||||||
|
//1、首先生成入库单
|
||||||
|
//获取抬头文本
|
||||||
|
try {
|
||||||
|
receiveAct=GenerateMaterialReceiveRequestName("SDK","NoPO");
|
||||||
|
} catch (CustomException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
user=(String) in.get("USER");
|
||||||
|
commitDate = in.get("commitDate").toString();
|
||||||
|
opCode = in.get("opCode") == null ? "" : in.get("commitDate").toString();
|
||||||
|
LinkedHashMap<String,String> linkedHashMap = ( LinkedHashMap<String,String>) in.get("BOXLIST");
|
||||||
|
EventInfo makeEventInfo=new EventInfoUtil().makeEventInfo("NoChargeStockIn", user, "NoChargeStockIn", "", "");
|
||||||
|
//3、遍历map中的值
|
||||||
|
Iterator it = linkedHashMap.entrySet().iterator();
|
||||||
|
//校验仓库和货位的对应关系是否存在
|
||||||
|
while (it.hasNext()) {
|
||||||
|
Map.Entry entry = (Map.Entry) it.next();
|
||||||
|
Map NoPoList=(Map) entry.getValue();
|
||||||
|
ERPFACTORY=(String) NoPoList.get("ERPFACTORY");
|
||||||
|
ERPLOCATION=(String) NoPoList.get("ERPLOCATION");
|
||||||
|
LOCATIONNAME= (NoPoList.get("LOCATIONNAME") == null || "null".equals(NoPoList.get("LOCATIONNAME").toString())) ? "" : NoPoList.get("LOCATIONNAME").toString();
|
||||||
|
MATERIALSPECNAME=(String) NoPoList.get("MATERIALSPECNAME");
|
||||||
|
RECEIVEDQUANTITY=(String) NoPoList.get("RECEIVEDQUANTITY").toString();
|
||||||
|
ThisAcceptNumber=(String) NoPoList.get("THISACCEPTNUMBER").toString();
|
||||||
|
BigDecimal freceiveQty = new BigDecimal(ThisAcceptNumber);//实收数量
|
||||||
|
// if (freceiveQty.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
// return AjaxResult.me().setSuccess(false).setMessage("接收数量不能小于0");
|
||||||
|
// }
|
||||||
|
String is_oven = "N";
|
||||||
|
MaterialSpec materialSpec = new MaterialSpec();
|
||||||
|
MaterialSpecKey materialSpecKey = new MaterialSpecKey();
|
||||||
|
materialSpecKey.setMaterialSpecName(MATERIALSPECNAME);
|
||||||
|
materialSpecKey.setSiteName("SDK");
|
||||||
|
|
||||||
|
materialSpec = MaterialServiceProxy.getMaterialSpecService()
|
||||||
|
.selectByKey(materialSpecKey);
|
||||||
|
String maturationflag = materialSpec.getMATURATIONFLAG();//熟化标识
|
||||||
|
String is_CON_TEMP = materialSpec.getIS_CON_TEMP();//恒温恒湿
|
||||||
|
//判断仓库是否启用了货位,但货位为空
|
||||||
|
String sql = "SELECT be.USE_LOCATION,be.CONST_TEMP,be.IS_OVEN FROM BS_ERPLOCATION be WHERE be.ERPLOCATIONNAME = :ERPLOCATION";
|
||||||
|
Map<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
|
hashMap.put("ERPLOCATION", ERPLOCATION);
|
||||||
|
hashMap.put("LOCATIONNAME", LOCATIONNAME);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, hashMap);
|
||||||
|
if (queryForList == null || queryForList.size() < 1) {
|
||||||
|
throw new RuntimeException("仓库不存在");
|
||||||
|
} else {
|
||||||
|
String string = queryForList.get(0).get("USE_LOCATION") == null ? "" : queryForList.get(0).get("USE_LOCATION").toString();//启用货位
|
||||||
|
String const_temp = queryForList.get(0).get("CONST_TEMP") == null ? "" : queryForList.get(0).get("CONST_TEMP").toString(); //恒温标识
|
||||||
|
is_oven = queryForList.get(0).get("IS_OVEN") == null ? "" : queryForList.get(0).get("IS_OVEN").toString(); //熟化标识
|
||||||
|
if ("Y".equals(string) && ("".equals(LOCATIONNAME) || LOCATIONNAME == null )) {
|
||||||
|
throw new RuntimeException("仓库启用了货位,但货位为空");
|
||||||
|
}
|
||||||
|
if ("N".equals(string) && (!"".equals(LOCATIONNAME)) ) {
|
||||||
|
throw new RuntimeException("仓库未启用货位,货位为空");
|
||||||
|
}
|
||||||
|
if (!"".equals(LOCATIONNAME)) {
|
||||||
|
String sql2 = "SELECT * FROM STORAGESPEC S WHERE S.STORAGENAME = :LOCATIONNAME AND S.ERPLOCATION = :ERPLOCATION ";
|
||||||
|
List<Map<String, Object>> queryForList2 = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql2, hashMap);
|
||||||
|
if (queryForList2 == null || queryForList2.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 (!const_temp.equals(is_CON_TEMP)) {
|
||||||
|
throw new RuntimeException("仓库" + ckhw + "; 物料" + wlhw);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_oven.equals(maturationflag)) {
|
||||||
|
throw new RuntimeException("仓库" + cksh + "; 物料" + wlsh);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Iterator its = linkedHashMap.entrySet().iterator();
|
||||||
|
while (its.hasNext()) {
|
||||||
|
Map.Entry entry = (Map.Entry) its.next();
|
||||||
|
Map NoPoList=(Map) entry.getValue();
|
||||||
|
ERPFACTORY=(String) NoPoList.get("ERPFACTORY");
|
||||||
|
ERPLOCATION=(String) NoPoList.get("ERPLOCATION");
|
||||||
|
LOCATIONNAME= (NoPoList.get("LOCATIONNAME") == null || "null".equals(NoPoList.get("LOCATIONNAME").toString())) ? "" : NoPoList.get("LOCATIONNAME").toString();
|
||||||
|
MATERIALSPECNAME=(String) NoPoList.get("MATERIALSPECNAME");
|
||||||
|
MATERIALUNITDESC=(String) NoPoList.get("MATERIALUNITDESC");
|
||||||
|
MATERIALUNIT=(String) NoPoList.get("MATERIALUNIT");
|
||||||
|
REQUESTQUANTITY=(String) NoPoList.get("REQUESTQUANTITY").toString();
|
||||||
|
RECEIVEDQUANTITY=(String) NoPoList.get("RECEIVEDQUANTITY").toString();
|
||||||
|
ThisAcceptNumber= NoPoList.get("THISACCEPTNUMBER").toString();
|
||||||
|
if ("0".equals(ThisAcceptNumber)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
SiteName=(String) NoPoList.get("SiteName");
|
||||||
|
MAKEDATE=NoPoList.get("MakeDate") == null ? TimeStampUtil.getCurrentTime("yyyy-MM-dd HH:mm:ss") : NoPoList.get("MakeDate").toString();
|
||||||
|
sdkid=(String) NoPoList.get("SDK_ID");
|
||||||
|
if(ThisAcceptNumber!=""&&ThisAcceptNumber!=null&&ThisAcceptNumber!="0")
|
||||||
|
{
|
||||||
|
// 获取单据详情
|
||||||
|
List<DeliveryReceiveDetailVo> receiveByMaterialSpec = deliveryService.getReceiveByMaterialSpec(storeDetailDto.getDocumentName(), MATERIALSPECNAME, isDelivery);
|
||||||
|
if (!receiveByMaterialSpec.isEmpty()) {
|
||||||
|
for (DeliveryReceiveDetailVo vo : receiveByMaterialSpec) {
|
||||||
|
//2、获取EventInfo
|
||||||
|
makeEventInfo = new EventInfoUtil().makeEventInfo("NoChargeStockIn", user, "NoChargeStockIn", "", "");
|
||||||
|
//4、写入入库单明细
|
||||||
|
try {
|
||||||
|
CreateMaterialReceiveRequestAct(makeEventInfo,"SDK",vo.getReceiveRequestName(),vo.getReceiveRequestDetailName(),MAKEDATE,receiveAct,"NoPO",ThisAcceptNumber,MATERIALSPECNAME);
|
||||||
|
} catch (CustomException | ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
//5、查询物料是否启用批次
|
||||||
|
String sql="SELECT CASE WHEN m.IS_BATCH = 'Y' THEN '是' WHEN m.IS_BATCH = '是' THEN '是' ELSE '否' END AS REPLACED_VALUE ,DECODE(m.IQCFLAG,'Y','是','否') IQCFLAG FROM MATERIALSPEC m WHERE m.MATERIALSPECNAME =:MATERIALSPECNAME";
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("MATERIALSPECNAME", MATERIALSPECNAME);
|
||||||
|
List<Map<String, Object>> list = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, bindMap);
|
||||||
|
String IsBatch=(String) list.get(0).get("REPLACED_VALUE");
|
||||||
|
String IQCFLAG=(String) list.get(0).get("IQCFLAG");
|
||||||
|
//6、创建标签
|
||||||
|
try {
|
||||||
|
Packing( makeEventInfo, "SDK","", ThisAcceptNumber, "1",ThisAcceptNumber, "N",vo.getReceiveRequestName(),vo.getReceiveRequestDetailName(),MATERIALSPECNAME,receiveAct, MAKEDATE, "","", "","", ERPLOCATION, ERPFACTORY,"", "", "","","",LOCATIONNAME,"","",MATERIALUNIT,IsBatch,IQCFLAG,sdkid);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//7、过账
|
||||||
|
// 采购单
|
||||||
|
List<MaterialReceiveRequest> requests = new ArrayList<>();
|
||||||
|
if (isDelivery) {
|
||||||
|
// 到货单据
|
||||||
|
requests = deliveryService.getReceiveByDelivery(storeDetailDto);
|
||||||
|
} else {
|
||||||
|
requests.add(deliveryService.getReceiveByKey(storeDetailDto));
|
||||||
|
}
|
||||||
|
for (MaterialReceiveRequest request : requests) {
|
||||||
|
String billcode = null;
|
||||||
|
// 采购订单
|
||||||
|
if (ReceiveTypeEnums.isPurchase(request.getReceiveRequestType())) {
|
||||||
|
Map<String,Object> args = new HashMap<>();
|
||||||
|
billcode = toSAPServiceImpl.PurStockIn(request.getReceiveRequestName(), siteName, user, args);
|
||||||
|
}
|
||||||
|
// @TODO 其他类型
|
||||||
|
if (billcode == null || "".equals(billcode)) {
|
||||||
|
return AjaxResult.me().setErrorCode(500).setSuccess(false).setMessage("NC过账失败");
|
||||||
|
}
|
||||||
|
//8、更新物料凭证
|
||||||
|
SDKMP.updateUndoID(receiveAct,makeEventInfo,billcode);
|
||||||
|
//9、接收ERP返回消息更新WMS凭证
|
||||||
|
// SDKMP.SaveUnDoInfo(receiveAct,billcode);
|
||||||
|
SDKMP.SaveUnDoInfo(billcode,commitDate);//传值错误,导致凭证信息未存储,已修改。zd.2024.9.24
|
||||||
|
//10、更新库存状态
|
||||||
|
SDKMP.updateStockState(receiveAct,makeEventInfo,billcode);
|
||||||
|
}
|
||||||
|
return AjaxResult.me().setMessage("入库成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name : GenerateMaterialReceiveRequestName Desc : This function is
|
||||||
|
* GenerateMaterialReceiveRequestName Author : boe cim dev. Date :
|
||||||
|
* 2016.02.17
|
||||||
|
*/
|
||||||
|
public static String GenerateMaterialReceiveRequestName( String siteName, String actType) throws CustomException {
|
||||||
|
// 获取系统当前时间
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
SimpleDateFormat f = new SimpleDateFormat(
|
||||||
|
"yyyyMMdd");
|
||||||
|
|
||||||
|
List<String> args = new ArrayList<String>();
|
||||||
|
String actType1 = "";
|
||||||
|
if (actType.equals("Normal") || actType.equals("Manual")|| actType.equals("ManualR")
|
||||||
|
||actType.equals("BMDTOEM") ||actType.equals("B5OEM")
|
||||||
|
|| actType.equals("Reserve") ||actType.equals("ERPReserve")|| actType.equals("NormalIDO")
|
||||||
|
|| actType.equals("NoPO")||actType.equals("SHIPOEM")) {
|
||||||
|
actType1 = "R";
|
||||||
|
}else if (actType.equals("RMA") || actType.equals("OEMReturn")) {
|
||||||
|
actType1 = "F";
|
||||||
|
}
|
||||||
|
else if (actType.equals("Scrapped")) {
|
||||||
|
actType1 = "B";
|
||||||
|
} else if (actType.equals("Refund") || actType.equals("RefundOEM")
|
||||||
|
|| actType.equals("WO") || actType.equals("POOEM")
|
||||||
|
|| actType.equals("ManualT")||actType.equals("MES")||actType.equals("MESRefund")) {
|
||||||
|
actType1 = "T";
|
||||||
|
} else if (actType.equals("STCO")) {
|
||||||
|
actType1 = "C";
|
||||||
|
}else if(actType.equals("PSO"))
|
||||||
|
{
|
||||||
|
actType1 = "S";
|
||||||
|
}
|
||||||
|
else if(actType.equals("unUsual"))
|
||||||
|
{
|
||||||
|
actType1="U";
|
||||||
|
}
|
||||||
|
if(siteName.equals("B10")){
|
||||||
|
siteName="BA";
|
||||||
|
}else if(siteName.equals("BMDT")){
|
||||||
|
siteName="BM";
|
||||||
|
}else if(siteName.equals("B11")){
|
||||||
|
siteName="BB";
|
||||||
|
}else if(siteName.equals("BMOT")){
|
||||||
|
siteName="BO";
|
||||||
|
}else if(siteName.equals("B17")){
|
||||||
|
siteName="BH";
|
||||||
|
} else if(siteName.equals("SDK")){
|
||||||
|
siteName="SDK";
|
||||||
|
}
|
||||||
|
args.add(siteName);
|
||||||
|
args.add(actType1);
|
||||||
|
args.add(f.format(c.getTime()));
|
||||||
|
|
||||||
|
String ReceiveRequestActNo;
|
||||||
|
|
||||||
|
ReceiveRequestActNo = NameServiceProxy.getNameRuleDefService()
|
||||||
|
.generateName("ReceiveActNo", args, 1).get(0);
|
||||||
|
try {
|
||||||
|
return ReceiveRequestActNo;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
args = new ArrayList<String>();
|
||||||
|
args.add(siteName);
|
||||||
|
args.add(actType);
|
||||||
|
args.add(f.format(c.getTime()));
|
||||||
|
ReceiveRequestActNo = NameServiceProxy.getNameRuleDefService()
|
||||||
|
.generateName("ReceiveActNo", args, 1).get(0);
|
||||||
|
return ReceiveRequestActNo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Name : CreateMaterialReceiveRequestAct Desc :
|
||||||
|
* CreateMaterialReceiveRequestAct Author : boe cim dev. Date : 2016.02.17
|
||||||
|
*/
|
||||||
|
public void CreateMaterialReceiveRequestAct(EventInfo eventInfo,
|
||||||
|
String siteName, String receiveRequestName,
|
||||||
|
String ReceiveRequestDetailName, String makeDate,
|
||||||
|
String receiveActNo, String actType, String receiveQuantity,
|
||||||
|
String subMaterialSpecName) throws CustomException, ParseException {
|
||||||
|
String actType1 = "";
|
||||||
|
String newReceiveRequestDetailName = "";
|
||||||
|
if (actType.equals("POOEM")) {
|
||||||
|
newReceiveRequestDetailName = ReceiveRequestDetailName + "_"
|
||||||
|
+ subMaterialSpecName;
|
||||||
|
}
|
||||||
|
// receiveRequestName="lixiaolongtest1";
|
||||||
|
// ReceiveRequestDetailName="lixiaolongtestDetail";
|
||||||
|
// makeDate="2016-02-17 20:17:59";
|
||||||
|
// receiveActNo="testabc1";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
* Timestamp date = (Timestamp) sdf.parse(makeDate);
|
||||||
|
*/
|
||||||
|
|
||||||
|
float ReceiveQuantity = Float.parseFloat(receiveQuantity);
|
||||||
|
|
||||||
|
// receiveActInfo
|
||||||
|
MaterialReceiveActDetailKey materialReceiveActDetailKey = new MaterialReceiveActDetailKey();
|
||||||
|
// MaterialReceiveActDetail materialReceiveActDetail = new
|
||||||
|
// MaterialReceiveActDetail();
|
||||||
|
CreateActDetailInfo createActDetailInfo = new CreateActDetailInfo();
|
||||||
|
//
|
||||||
|
materialReceiveActDetailKey.setSiteName(siteName);
|
||||||
|
materialReceiveActDetailKey.setReceiveRequestName(receiveRequestName);
|
||||||
|
if (actType.equals("POOEM")) {
|
||||||
|
materialReceiveActDetailKey.setReceiveRequestDetailName(newReceiveRequestDetailName);
|
||||||
|
} else {
|
||||||
|
materialReceiveActDetailKey.setReceiveRequestDetailName(ReceiveRequestDetailName);
|
||||||
|
}
|
||||||
|
|
||||||
|
materialReceiveActDetailKey.setReceiveActNO(receiveActNo);
|
||||||
|
materialReceiveActDetailKey.setMakeDate(Timestamp.valueOf(makeDate));
|
||||||
|
|
||||||
|
// materialReceiveActDetail=
|
||||||
|
// MaterialReceiveRequestActDetailServiceProxy.getMaterialReceiveRequestActDetailService().selectByKey(materialReceiveActDetailKey);
|
||||||
|
|
||||||
|
String sql = "SELECT * FROM materialreceiveactdetail WHERE sitename = :sitename AND receiveRequestName = :receiveRequestName and ReceiveRequestDetailName=:ReceiveRequestDetailName and receiveActNo=:receiveActNo";
|
||||||
|
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("sitename", siteName);
|
||||||
|
bindMap.put("receiveRequestName", receiveRequestName);
|
||||||
|
if (actType.equals("POOEM")) {
|
||||||
|
bindMap.put("ReceiveRequestDetailName", newReceiveRequestDetailName);
|
||||||
|
} else {
|
||||||
|
bindMap.put("ReceiveRequestDetailName", ReceiveRequestDetailName);
|
||||||
|
}
|
||||||
|
bindMap.put("receiveActNo", receiveActNo);
|
||||||
|
bindMap.put("makeDate", Timestamp.valueOf(makeDate));
|
||||||
|
|
||||||
|
List<Map<String, Object>> queryResult = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, bindMap);
|
||||||
|
|
||||||
|
String sql1 = "SELECT * FROM materialreceiveact "
|
||||||
|
+ "WHERE sitename = :sitename AND receiveRequestName = :receiveRequestName and receiveActNo=:receiveActNo ";
|
||||||
|
|
||||||
|
Map<String, Object> bindMap1 = new HashMap<String, Object>();
|
||||||
|
bindMap1.put("sitename", siteName);
|
||||||
|
bindMap1.put("receiveRequestName", receiveRequestName);
|
||||||
|
bindMap1.put("receiveActNo", receiveActNo);
|
||||||
|
|
||||||
|
List<Map<String, Object>> queryResult1 = IDMFrameServiceProxy
|
||||||
|
.getSqlTemplate()
|
||||||
|
.queryForList(sql1, bindMap1);
|
||||||
|
if (queryResult1.size() != 0) {
|
||||||
|
actType1 = queryResult1.get(0).get("ACTTYPE").toString();
|
||||||
|
}
|
||||||
|
if (queryResult1.size() == 0) {
|
||||||
|
CreateReceiveRequestBatchInfo createActBatchInfo = new CreateReceiveRequestBatchInfo();
|
||||||
|
List<CreateReceiveRequestBatchInfo> createReceiveRequestBatchInfo = new ArrayList<CreateReceiveRequestBatchInfo>();
|
||||||
|
|
||||||
|
Map<String, Object> bindMap2 = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
List<String> materialReceiveRequestAct;
|
||||||
|
// String quantity="10";
|
||||||
|
String product = "qwe";
|
||||||
|
String grade = "w";
|
||||||
|
String line = "q";
|
||||||
|
String revisionCode = "r";
|
||||||
|
|
||||||
|
createActBatchInfo.setSiteName(siteName);
|
||||||
|
createActBatchInfo.setReceiveRequestName(receiveRequestName);
|
||||||
|
createActBatchInfo.setReceiveactNO(receiveActNo);
|
||||||
|
createActBatchInfo.setReceiveActState("Created");
|
||||||
|
|
||||||
|
bindMap2.put("actType", actType);
|
||||||
|
// bindMap2.put("receiveActState", );
|
||||||
|
createActBatchInfo.setUserColumns(bindMap2);
|
||||||
|
|
||||||
|
createReceiveRequestBatchInfo.add(createActBatchInfo);
|
||||||
|
|
||||||
|
MaterialReceiveRequestActServiceProxy.getReceiveRequestBatchService().create(eventInfo,createReceiveRequestBatchInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (queryResult.size() == 0) {
|
||||||
|
createActDetailInfo.setReceiveActNO(receiveActNo);
|
||||||
|
createActDetailInfo.setReceiveRequestName(receiveRequestName);
|
||||||
|
if (actType.equals("POOEM")) {
|
||||||
|
createActDetailInfo
|
||||||
|
.setReceiveRequestDetailName(newReceiveRequestDetailName);
|
||||||
|
} else {
|
||||||
|
createActDetailInfo
|
||||||
|
.setReceiveRequestDetailName(ReceiveRequestDetailName);
|
||||||
|
}
|
||||||
|
createActDetailInfo.setSiteName(siteName);
|
||||||
|
|
||||||
|
// Date date1 = new Date();//获取当前时间
|
||||||
|
// SimpleDateFormat sdf = new
|
||||||
|
// SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// String str = sdf.format(date1);//时间存储为字符串
|
||||||
|
// System.out.println(str);
|
||||||
|
createActDetailInfo.setMakeDate(Timestamp.valueOf(makeDate));
|
||||||
|
createActDetailInfo.setReceiveQuantity(ReceiveQuantity);
|
||||||
|
|
||||||
|
Map<String, Object> bindMap3 = new HashMap<String, Object>();
|
||||||
|
bindMap3.put("receiveActState", "Created");
|
||||||
|
createActDetailInfo.setUserColumns(bindMap3);
|
||||||
|
|
||||||
|
MaterialReceiveRequestActDetailServiceProxy
|
||||||
|
.getMaterialReceiveRequestActDetailService().create(
|
||||||
|
eventInfo, createActDetailInfo);
|
||||||
|
|
||||||
|
// 因为float精度问题,再更新一次
|
||||||
|
try {
|
||||||
|
log.info("创建BOX点击,更新抬头文本明细行大数据 ==========> ");
|
||||||
|
String updateSql= " UPDATE MATERIALRECEIVEACTDETAIL SET RECEIVEQUANTITY = :QTY WHERE RECEIVEACTNO = :RECEIVEACTNO"
|
||||||
|
+ " AND RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME AND RECEIVEREQUESTDETAILNAME = :RECEIVEREQUESTDETAILNAME";
|
||||||
|
Map<String, Object> updateMap = new HashMap<String, Object>();
|
||||||
|
updateMap.put("QTY", receiveQuantity);
|
||||||
|
updateMap.put("RECEIVEACTNO", receiveActNo);
|
||||||
|
updateMap.put("RECEIVEREQUESTNAME", receiveRequestName);
|
||||||
|
updateMap.put("RECEIVEREQUESTDETAILNAME", createActDetailInfo.getReceiveRequestDetailName());
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(updateSql, updateMap);
|
||||||
|
} catch (IDMFrameDBErrorSignal e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
log.info("创建BOX,更新抬头文本明细行大数据时失败 ==========> ");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ActDetailIncreaseInfo actDetailIncreaseInfo = new ActDetailIncreaseInfo();
|
||||||
|
actDetailIncreaseInfo.setReceiveQuantity(ReceiveQuantity);
|
||||||
|
|
||||||
|
MaterialReceiveRequestActDetailServiceProxy
|
||||||
|
.getMaterialReceiveRequestActDetailService()
|
||||||
|
.increaseReceivedQuantity(materialReceiveActDetailKey,
|
||||||
|
eventInfo, actDetailIncreaseInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actType.equals("NoPO") || actType1.equals("NoPO")
|
||||||
|
|| actType.equals("Normal") || actType1.equals("Normal")
|
||||||
|
|| actType.equals("NormalIDO") || actType1.equals("NormalIDO")) {
|
||||||
|
//if(!siteName.equals("B7")){
|
||||||
|
if(siteName.equals("B7")){
|
||||||
|
MakeDetailIncreaseReceivedInfo makeDetailIncreaseReceivedInfo = new MakeDetailIncreaseReceivedInfo();
|
||||||
|
MaterialReceiveRequestDetailKey materialReceiveRequestDetailKey = new MaterialReceiveRequestDetailKey();
|
||||||
|
materialReceiveRequestDetailKey
|
||||||
|
.setReceiveRequestName(receiveRequestName);
|
||||||
|
materialReceiveRequestDetailKey.setSiteName(siteName);
|
||||||
|
materialReceiveRequestDetailKey
|
||||||
|
.setReceiveRequestDetailName(ReceiveRequestDetailName);
|
||||||
|
|
||||||
|
makeDetailIncreaseReceivedInfo.setIncreaseQuantity(ReceiveQuantity);
|
||||||
|
|
||||||
|
ReceiveRequestDetailServiceProxy.getReceiveRequestDetailService()
|
||||||
|
.increaseReceivedQuantity(materialReceiveRequestDetailKey,
|
||||||
|
eventInfo, makeDetailIncreaseReceivedInfo);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
//float型计算精度缺失问题
|
||||||
|
Map<String, Object> bindMapF = new HashMap<String, Object>();
|
||||||
|
Map<String, Object> bindMapFU = new HashMap<String, Object>();
|
||||||
|
String receivedQuantiryF="";
|
||||||
|
bindMapF.put("receiveRequestName",receiveRequestName);
|
||||||
|
bindMapF.put("ReceiveRequestDetailName", ReceiveRequestDetailName);
|
||||||
|
bindMapF.put("sitename", siteName);
|
||||||
|
String sqlF="SELECT RECEIVEDQUANTITY FROM MATERIALRECEIVEREQUESTDETAIL WHERE SITENAME=:sitename AND RECEIVEREQUESTNAME=:receiveRequestName AND RECEIVEREQUESTDETAILNAME=:ReceiveRequestDetailName";
|
||||||
|
String sqlFU="UPDATE MATERIALRECEIVEREQUESTDETAIL SET RECEIVEDQUANTITY=:receivedQuantity WHERE SITENAME=:sitename AND RECEIVEREQUESTNAME=:receiveRequestName AND RECEIVEREQUESTDETAILNAME=:ReceiveRequestDetailName";
|
||||||
|
List<Map<String, Object>> queryResultF = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlF, bindMapF);
|
||||||
|
if(queryResultF.size()!=0){
|
||||||
|
receivedQuantiryF=queryResultF.get(0).get("RECEIVEDQUANTITY").toString();
|
||||||
|
}
|
||||||
|
// BigDecimal receivequantity=new BigDecimal(String.valueOf(ReceiveQuantity));
|
||||||
|
BigDecimal receivequantity=new BigDecimal(String.valueOf(receiveQuantity));
|
||||||
|
BigDecimal receivedQuantiry=new BigDecimal(receivedQuantiryF);
|
||||||
|
bindMapFU.put("receivedQuantity", receivequantity.add(receivedQuantiry).doubleValue());
|
||||||
|
bindMapFU.put("sitename", siteName);
|
||||||
|
bindMapFU.put("receiveRequestName", receiveRequestName);
|
||||||
|
bindMapFU.put("ReceiveRequestDetailName", ReceiveRequestDetailName);
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(sqlFU, bindMapFU);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
// else if(actType.equals("POOEM"))
|
||||||
|
// {
|
||||||
|
// MakeOEMIncreaseInfo makeOEMIncreaseInfo =new MakeOEMIncreaseInfo();
|
||||||
|
// MaterialShipRequestToOEMKey materialShipRequestToOEMKey =new
|
||||||
|
// MaterialShipRequestToOEMKey();
|
||||||
|
// materialShipRequestToOEMKey.setReceiveRequestName(receiveRequestName);
|
||||||
|
// materialShipRequestToOEMKey.setSiteName(siteName);
|
||||||
|
// materialShipRequestToOEMKey.setReceiveRequestDetailName(ReceiveRequestDetailName);
|
||||||
|
//
|
||||||
|
// makeOEMIncreaseInfo.setIncreaseQuantity(ReceiveQuantity);
|
||||||
|
//
|
||||||
|
// MaterialShipRequestToOEMServiceProxy.getMaterialShipRequestToOEMService().in(materialShipRequestToOEMKey,
|
||||||
|
// eventInfo, makeOEMIncreaseInfo);
|
||||||
|
// }
|
||||||
|
else if (actType.equals("POOEM") || actType1.equals("POOEM")) {
|
||||||
|
|
||||||
|
MakeOEMDecreaseAssignedInfo makeOEMDecreaseAssignedInfo = new MakeOEMDecreaseAssignedInfo();
|
||||||
|
MaterialShipRequestToOEMKey materialShipRequestToOEMKey = new MaterialShipRequestToOEMKey();
|
||||||
|
materialShipRequestToOEMKey
|
||||||
|
.setReceiveRequestName(receiveRequestName);
|
||||||
|
materialShipRequestToOEMKey.setSiteName(siteName);
|
||||||
|
materialShipRequestToOEMKey
|
||||||
|
.setReceiveRequestDetailName(ReceiveRequestDetailName);
|
||||||
|
materialShipRequestToOEMKey
|
||||||
|
.setSubMaterialSpecName(subMaterialSpecName);
|
||||||
|
makeOEMDecreaseAssignedInfo.setAssignedQuantity(ReceiveQuantity);
|
||||||
|
|
||||||
|
MaterialShipRequestToOEMServiceProxy
|
||||||
|
.getMaterialShipRequestToOEMService()
|
||||||
|
.decreaseAssignedQuantity(materialShipRequestToOEMKey,
|
||||||
|
eventInfo, makeOEMDecreaseAssignedInfo);
|
||||||
|
}
|
||||||
|
// else if(!actType.equals("POOEM")||!actType1.equals("POOEM"))
|
||||||
|
else {
|
||||||
|
if(siteName.equals("B7")){
|
||||||
|
MakeShipDetailIncreaseAssignedInfo makeShipDetailIncreaseAssignedInfo = new MakeShipDetailIncreaseAssignedInfo();
|
||||||
|
MaterialShipRequestDetailKey materialShipRequestDetailKey = new MaterialShipRequestDetailKey();
|
||||||
|
materialShipRequestDetailKey.setShipRequestName(receiveRequestName);
|
||||||
|
materialShipRequestDetailKey.setSiteName(siteName);
|
||||||
|
materialShipRequestDetailKey
|
||||||
|
.setShipRequestDetailName(ReceiveRequestDetailName);
|
||||||
|
|
||||||
|
makeShipDetailIncreaseAssignedInfo
|
||||||
|
.setAssignedQuantity(ReceiveQuantity);
|
||||||
|
|
||||||
|
MaterialShipRequestDetailServiceProxy
|
||||||
|
.getMaterialShipRequestDetailService()
|
||||||
|
.increaseAssignedQuantity(materialShipRequestDetailKey,
|
||||||
|
makeShipDetailIncreaseAssignedInfo);
|
||||||
|
}else{
|
||||||
|
//float型计算精度缺失问题
|
||||||
|
Map<String, Object> bindMapF = new HashMap<String, Object>();
|
||||||
|
Map<String, Object> bindMapFU = new HashMap<String, Object>();
|
||||||
|
String receivedQuantiryF="";
|
||||||
|
bindMapF.put("shipRequestName",receiveRequestName);
|
||||||
|
bindMapF.put("shipRequestDetailName", ReceiveRequestDetailName);
|
||||||
|
bindMapF.put("sitename", siteName);
|
||||||
|
String sqlF="SELECT ASSIGNEDQUANTITY FROM MATERIALSHIPREQUESTDETAIL WHERE SITENAME=:sitename AND SHIPREQUESTNAME=:shipRequestName AND SHIPREQUESTDETAILNAME=:shipRequestDetailName";
|
||||||
|
String sqlFU="UPDATE MATERIALSHIPREQUESTDETAIL SET ASSIGNEDQUANTITY=:receivedQuantity WHERE SITENAME=:sitename AND SHIPREQUESTNAME=:shipRequestName AND SHIPREQUESTDETAILNAME=:shipRequestDetailName";
|
||||||
|
List<Map<String, Object>> queryResultF = IDMFrameServiceProxy.getSqlTemplate().queryForList(sqlF, bindMapF);
|
||||||
|
if(queryResultF.size()!=0){
|
||||||
|
receivedQuantiryF=queryResultF.get(0).get("ASSIGNEDQUANTITY").toString();
|
||||||
|
}
|
||||||
|
// BigDecimal receivequantity=new BigDecimal(String.valueOf(ReceiveQuantity));
|
||||||
|
BigDecimal receivequantity=new BigDecimal(String.valueOf(receiveQuantity));
|
||||||
|
BigDecimal receivedQuantiry=new BigDecimal(receivedQuantiryF);
|
||||||
|
bindMapFU.put("receivedQuantity", receivequantity.add(receivedQuantiry).doubleValue());
|
||||||
|
bindMapFU.put("sitename", siteName);
|
||||||
|
bindMapFU.put("shipRequestName", receiveRequestName);
|
||||||
|
bindMapFU.put("shipRequestDetailName", ReceiveRequestDetailName);
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(sqlFU, bindMapFU);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String Packing(EventInfo eventInfo, String siteName,
|
||||||
|
String areaName, String receiveQty, String boxQuantity,
|
||||||
|
String EveryBoxQuantity, String boxFlag, String receiveRequestName,
|
||||||
|
String receiveRequestDetailName, String materialSpecName,
|
||||||
|
String receiveActNo, String makeDate, String shipRequestName,
|
||||||
|
String shipRequestDetailName, String reasonCodeType,
|
||||||
|
String reasonCode, String erpLocation, String erpFactory,
|
||||||
|
String charge, String supplierName, String NPFlag,String expirationDay,String supplierCharge,
|
||||||
|
String locationName,String phase,String specName,String materialUnit,
|
||||||
|
String IS_BATCH,String IQCFLAG,String sdkid) throws Exception {
|
||||||
|
|
||||||
|
String receiveActNo1 = receiveActNo.substring(5);
|
||||||
|
String lastEventTimeKey = "";
|
||||||
|
List<CreateInfo> listMaterialPacking = new ArrayList<CreateInfo>();
|
||||||
|
SimpleDateFormat sDateFormat=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
|
List<String> boxId;
|
||||||
|
float EveryBoxQuantity1 = 0;
|
||||||
|
BigDecimal everyQty = new BigDecimal(receiveQty);
|
||||||
|
BigDecimal sumQty = BigDecimal.ZERO;
|
||||||
|
try {
|
||||||
|
if (boxFlag.equals("Y")) {
|
||||||
|
float tempV = Math.round((Float.valueOf(receiveQty) - (Float
|
||||||
|
.valueOf(boxQuantity) - 1)
|
||||||
|
* Float.valueOf(EveryBoxQuantity)) * 100);
|
||||||
|
// float v=(float) (tempV/100.00);
|
||||||
|
EveryBoxQuantity1 = (float) (tempV / 100.00);
|
||||||
|
// float num=(float)(Math.round(totalPrice*100)/100)
|
||||||
|
}
|
||||||
|
|
||||||
|
boxId = MaterialPackingServiceImpl.generateBoxID("LabelId", siteName,
|
||||||
|
boxQuantity, makeDate,"WL",erpFactory);
|
||||||
|
|
||||||
|
MaterialSpec materialSpec = new MaterialSpec();
|
||||||
|
MaterialSpecKey materialSpecKey = new MaterialSpecKey();
|
||||||
|
materialSpecKey.setMaterialSpecName(materialSpecName);
|
||||||
|
materialSpecKey.setSiteName(siteName);
|
||||||
|
|
||||||
|
materialSpec = MaterialServiceProxy.getMaterialSpecService()
|
||||||
|
.selectByKey(materialSpecKey);
|
||||||
|
|
||||||
|
// try{
|
||||||
|
// materialSpec=MaterialSpecServiceProxy.getMaterialSpecService().selectByKey(materialSpecKey);
|
||||||
|
// }
|
||||||
|
// catch(NotFoundSignal e)
|
||||||
|
// {
|
||||||
|
// e.s
|
||||||
|
// }
|
||||||
|
Map<String, Object> box_quantity = new HashMap<String, Object>();
|
||||||
|
int i = 0;
|
||||||
|
for (; i < boxId.size(); i++) {
|
||||||
|
CreateInfo materialPacking = new CreateInfo();
|
||||||
|
if (i == boxId.size() - 1) {
|
||||||
|
EveryBoxQuantity = Float.valueOf(receiveQty) - Float.valueOf(EveryBoxQuantity) * (boxId.size() - 1) + "";
|
||||||
|
}
|
||||||
|
//470110856|1|C|75mm*1000m|SHBP01JT1202305240009|20230524|11|75
|
||||||
|
String newBoxId = materialSpecName + "|1|" + phase + "|" + specName + "|" + boxId.get(i) + "|"
|
||||||
|
+ makeDate.replace("-", "").substring(0, 8) + "|" + materialUnit + "|" + EveryBoxQuantity;
|
||||||
|
materialPacking.setMaterialPackingName(newBoxId);
|
||||||
|
materialPacking.setSiteName(siteName);
|
||||||
|
materialPacking.setContentMaterialType("");
|
||||||
|
materialPacking.setMaterialPackingType("Box");
|
||||||
|
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("materialQuantity", EveryBoxQuantity);
|
||||||
|
bindMap.put("materialCreateQuantity", EveryBoxQuantity);
|
||||||
|
bindMap.put("packingState", "Created");// 标记Box是刚创建的
|
||||||
|
bindMap.put("materialType", materialSpec.getMaterialType());
|
||||||
|
bindMap.put("materialSpecName", materialSpecName);
|
||||||
|
bindMap.put("stockState", "");
|
||||||
|
bindMap.put("holdState", "N");
|
||||||
|
bindMap.put("areaName", areaName);
|
||||||
|
bindMap.put("createUser", eventInfo.getEventUser());
|
||||||
|
bindMap.put("createTime", eventInfo.getEventTime());
|
||||||
|
receiveRequestName = receiveRequestName.equals("") ? shipRequestName
|
||||||
|
: receiveRequestName;
|
||||||
|
receiveRequestDetailName = receiveRequestDetailName.equals("") ? shipRequestDetailName
|
||||||
|
: receiveRequestDetailName;
|
||||||
|
bindMap.put("ReceiveTime", eventInfo.getEventTime());
|
||||||
|
bindMap.put("ReceiveUser", eventInfo.getEventUser());
|
||||||
|
bindMap.put("receiveRequestName", receiveRequestName);
|
||||||
|
bindMap.put("receiveRequestDetailName",
|
||||||
|
receiveRequestDetailName);
|
||||||
|
bindMap.put("receiveRequestDetailName",
|
||||||
|
receiveRequestDetailName);
|
||||||
|
bindMap.put("SDK_ID", sdkid);
|
||||||
|
// bindMap.put("receiveRequestName", shipRequestName);
|
||||||
|
// bindMap.put("receiveRequestDetailName",
|
||||||
|
// shipRequestDetailName);
|
||||||
|
if(expirationDay==null||expirationDay.equals(""))
|
||||||
|
{
|
||||||
|
if(materialSpec.getExpirationDay()>0)
|
||||||
|
{
|
||||||
|
Date endTime=sDateFormat.parse(makeDate);
|
||||||
|
Calendar rightNow = Calendar.getInstance();
|
||||||
|
rightNow.setTime(endTime);
|
||||||
|
if(siteName.equals("TM1"))
|
||||||
|
{
|
||||||
|
rightNow.add(Calendar.MONTH, materialSpec.getExpirationDay());
|
||||||
|
rightNow.set(Calendar.DAY_OF_MONTH,rightNow.get(Calendar.DAY_OF_MONTH)-1);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
rightNow.add(Calendar.MONTH, materialSpec.getExpirationDay());
|
||||||
|
}
|
||||||
|
Date dt1 = rightNow.getTime();
|
||||||
|
expirationDay = sDateFormat.format(dt1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Date endTime=sDateFormat.parse(makeDate);
|
||||||
|
Calendar rightNow = Calendar.getInstance();
|
||||||
|
rightNow.setTime(endTime);
|
||||||
|
rightNow.add(Calendar.MONTH, 48);
|
||||||
|
Date dt1 = rightNow.getTime();
|
||||||
|
expirationDay = "2099-12-31 00:00:00";
|
||||||
|
|
||||||
|
//endTime.add(Calendar.MONTH, materialSpec.getExpirationDay());
|
||||||
|
//endTime = (endTime).(materialSpec.getExpirationDay());
|
||||||
|
}
|
||||||
|
//endTime.add(Calendar.MONTH, materialSpec.getExpirationDay());
|
||||||
|
//endTime = (endTime).(materialSpec.getExpirationDay());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//this.txtEndTime.Text = dt.ToString("yyyy年MM月dd日", System.Globalization.DateTimeFormatInfo.InvariantInfo);
|
||||||
|
bindMap.put("makeDate", makeDate);
|
||||||
|
bindMap.put("expiringDate", expirationDay.substring(0,expirationDay.indexOf(" "))+" 00:00:00");
|
||||||
|
bindMap.put("receiveActNo", receiveActNo);
|
||||||
|
bindMap.put("reasonCodeType", reasonCodeType);
|
||||||
|
bindMap.put("reasonCode", reasonCode);
|
||||||
|
bindMap.put("erpLocation", erpLocation);
|
||||||
|
bindMap.put("erpFactory", erpFactory);
|
||||||
|
bindMap.put("stockInType", "");
|
||||||
|
bindMap.put("unit", materialUnit);
|
||||||
|
if ("是".equals(IS_BATCH)) {
|
||||||
|
bindMap.put("charge", boxId.get(i));
|
||||||
|
}
|
||||||
|
if ("否".equals(IQCFLAG)) {
|
||||||
|
bindMap.put("oqaResultState", GenericServiceProxy.getConstantMap().OQA_State_End);
|
||||||
|
bindMap.put("oqaResult","OK");
|
||||||
|
bindMap.put("packingGrade", "OK");
|
||||||
|
} else {
|
||||||
|
bindMap.put("oqaResultState",GenericServiceProxy.getConstantMap().OQA_State_Pre);
|
||||||
|
}
|
||||||
|
bindMap.put("phase", phase);
|
||||||
|
//bindMap.put("supplierCharge", supplierCharge);
|
||||||
|
bindMap.put("supplierName", supplierName);
|
||||||
|
bindMap.put("npFlag", NPFlag);
|
||||||
|
bindMap.put("locationName", locationName);
|
||||||
|
materialPacking.setUserColumns(bindMap);
|
||||||
|
|
||||||
|
listMaterialPacking.add(materialPacking);
|
||||||
|
|
||||||
|
box_quantity.put(boxId.get(i), EveryBoxQuantity); // 防大数据float精度丢失
|
||||||
|
|
||||||
|
/** 计算最后一箱的数量 */
|
||||||
|
// BigDecimal nextQty = new BigDecimal(EveryBoxQuantity);
|
||||||
|
// sumQty = sumQty.add(nextQty);
|
||||||
|
// if(nextQty.compareTo(everyQty.subtract(sumQty)) > 0) {
|
||||||
|
// EveryBoxQuantity = everyQty.subtract(sumQty).toString();
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (EveryBoxQuantity1 > 0) {
|
||||||
|
CreateInfo materialPacking = new CreateInfo();
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("materialQuantity", EveryBoxQuantity1);
|
||||||
|
bindMap.put("materialCreateQuantity", EveryBoxQuantity1);
|
||||||
|
bindMap.put("packingState", "Created");// 标记Box是刚创建的
|
||||||
|
|
||||||
|
materialPacking = listMaterialPacking.get(boxId.size() - 1);
|
||||||
|
materialPacking.setUserColumns(bindMap);
|
||||||
|
|
||||||
|
listMaterialPacking.remove(boxId.size() - 1);
|
||||||
|
listMaterialPacking.add(materialPacking);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().create(
|
||||||
|
eventInfo, listMaterialPacking);
|
||||||
|
|
||||||
|
// 因为float精度问题,再更新一次
|
||||||
|
try {
|
||||||
|
// for(CreateInfo creatInfo : listMaterialPacking) {
|
||||||
|
// String updateSql= " UPDATE MATERIALPACKING SET MATERIALCREATEQUANTITY = :QTY,MATERIALQUANTITY = :QTY"
|
||||||
|
// + " WHERE MATERIALPACKINGNAME = :MATERIALPACKINGNAME AND SITENAME = :SITENAME";
|
||||||
|
// Map<String, Object> updateMap = new HashMap<String, Object>();
|
||||||
|
// updateMap.put("QTY", box_quantity.get(creatInfo.getMaterialPackingName()));
|
||||||
|
// updateMap.put("MATERIALPACKINGNAME", creatInfo.getMaterialPackingName());
|
||||||
|
// updateMap.put("SITENAME", siteName);
|
||||||
|
// IDMFrameServiceProxy.getSqlTemplate().update(updateSql, updateMap);
|
||||||
|
// }
|
||||||
|
} catch (IDMFrameDBErrorSignal e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
log.info("创建BOX,更新大数据时失败 ==========> ");
|
||||||
|
}
|
||||||
|
|
||||||
|
lastEventTimeKey = eventInfo.getEventTimeKey();
|
||||||
|
|
||||||
|
} catch (CustomException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return lastEventTimeKey;
|
||||||
|
}
|
||||||
|
}
|
@ -84,6 +84,24 @@ public interface DeliveryDao {
|
|||||||
*/
|
*/
|
||||||
List<MaterialReceiveRequest> getReceiveByDelivery(@Param("dto") StoreDetailDto storeDetailDto);
|
List<MaterialReceiveRequest> getReceiveByDelivery(@Param("dto") StoreDetailDto storeDetailDto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据单号和物料获取单据详情
|
||||||
|
* @param documentName 单据
|
||||||
|
* @param materialSpec 物料
|
||||||
|
* @return 单据详情
|
||||||
|
*/
|
||||||
|
List<DeliveryReceiveDetailVo> getReceiveByMaterialSpec(@Param("documentName") String documentName,
|
||||||
|
@Param("materialSpec") String materialSpec);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据单号和物料获取到货单单据详情
|
||||||
|
* @param documentName 单据
|
||||||
|
* @param materialSpec 物料
|
||||||
|
* @return 单据详情
|
||||||
|
*/
|
||||||
|
List<DeliveryReceiveDetailVo> getDeliveryByMaterialSpec(@Param("documentName") String documentName,
|
||||||
|
@Param("materialSpec") String materialSpec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据到库单获取采购单名称
|
* 根据到库单获取采购单名称
|
||||||
* @param nameList 到库单
|
* @param nameList 到库单
|
||||||
|
@ -16,6 +16,13 @@ public class AllExceptionHandler {
|
|||||||
.setMessage(e.getMessage());
|
.setMessage(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ResponseBody
|
||||||
|
@ExceptionHandler(RuntimeException.class) // 捕获运行时异常
|
||||||
|
public AjaxResult runtimeExceptionHandle(RuntimeException e){
|
||||||
|
return AjaxResult.me().setSuccess(false)
|
||||||
|
.setErrorCode(500)
|
||||||
|
.setMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
//捕获系统异常
|
//捕获系统异常
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ -26,6 +33,4 @@ public class AllExceptionHandler {
|
|||||||
.setErrorCode(500)
|
.setErrorCode(500)
|
||||||
.setMessage(e.getMessage() == null ? "系统异常" : e.getMessage());
|
.setMessage(e.getMessage() == null ? "系统异常" : e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -10,6 +10,8 @@ public class DeliveryRelationDto {
|
|||||||
private Integer deliveryNum = 0;
|
private Integer deliveryNum = 0;
|
||||||
// 采购单名称
|
// 采购单名称
|
||||||
private String receiveRequestName;
|
private String receiveRequestName;
|
||||||
|
// 采购单明细
|
||||||
|
private String receiveRequestDetailName;
|
||||||
// 料号
|
// 料号
|
||||||
private String materialSpecName;
|
private String materialSpecName;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ public class MaterialDeliveryReceive {
|
|||||||
private String deliveryNum;
|
private String deliveryNum;
|
||||||
// 采购单号
|
// 采购单号
|
||||||
private String receiveRequestName;
|
private String receiveRequestName;
|
||||||
|
// 采购单明细号
|
||||||
|
private String receiveRequestDetailName;
|
||||||
// 料号
|
// 料号
|
||||||
private String materialSpecName;
|
private String materialSpecName;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
public class DeliveryReceiveDetailVo {
|
public class DeliveryReceiveDetailVo {
|
||||||
|
|
||||||
private String receiveRequestName;
|
private String receiveRequestName;
|
||||||
|
private String receiveRequestDetailName;
|
||||||
private String materialSpecName;
|
private String materialSpecName;
|
||||||
private double requestQuantity;
|
private double requestQuantity;
|
||||||
private double deliveryNum;
|
private double deliveryNum;
|
||||||
|
@ -79,6 +79,16 @@ public interface IDeliveryService {
|
|||||||
*/
|
*/
|
||||||
List<MaterialReceiveRequest> getReceiveByDelivery(StoreDetailDto storeDetailDto);
|
List<MaterialReceiveRequest> getReceiveByDelivery(StoreDetailDto storeDetailDto);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据单号和物料获取单据详情
|
||||||
|
* @param documentName 单据
|
||||||
|
* @param materialSpec 物料
|
||||||
|
* @param isDelivery 是否到库
|
||||||
|
* @return 单据详情
|
||||||
|
*/
|
||||||
|
List<DeliveryReceiveDetailVo> getReceiveByMaterialSpec(String documentName, String materialSpec, Boolean isDelivery);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据到库单获取采购单名称
|
* 根据到库单获取采购单名称
|
||||||
* @param nameList 到库单
|
* @param nameList 到库单
|
||||||
|
@ -103,6 +103,18 @@ public class DeliveryServiceImpl implements IDeliveryService {
|
|||||||
return deliveryDao.getReceiveByDelivery(storeDetailDto);
|
return deliveryDao.getReceiveByDelivery(storeDetailDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeliveryReceiveDetailVo> getReceiveByMaterialSpec(String documentName, String materialSpec, Boolean isDelivery) {
|
||||||
|
List<DeliveryReceiveDetailVo> voList;
|
||||||
|
if (Boolean.TRUE.equals(isDelivery)) {
|
||||||
|
// 到货单
|
||||||
|
voList = deliveryDao.getDeliveryByMaterialSpec(documentName, materialSpec);
|
||||||
|
} else {
|
||||||
|
voList = deliveryDao.getReceiveByMaterialSpec(documentName, materialSpec);
|
||||||
|
}
|
||||||
|
return voList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeliveryReceiveDetailVo> getReceiveDetail(List<String> nameList) {
|
public List<DeliveryReceiveDetailVo> getReceiveDetail(List<String> nameList) {
|
||||||
return deliveryDao.getReceiveDetail(nameList);
|
return deliveryDao.getReceiveDetail(nameList);
|
||||||
|
@ -0,0 +1,427 @@
|
|||||||
|
package com.cim.idm.service.Impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||||
|
import com.cim.idm.framework.util.time.TimeStampUtil;
|
||||||
|
import com.cim.idm.model.ErpMessageLog;
|
||||||
|
import com.cim.idm.service.NCWService;
|
||||||
|
import com.cim.idm.util.NCHttpUtil;
|
||||||
|
import com.cim.idm.wmsextend.generic.util.ConvertUtil;
|
||||||
|
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.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentHelper;
|
||||||
|
import org.jdom.Element;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
//@Service
|
||||||
|
public class NCWServiceImpl implements NCWService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
NCHttpUtil ncHttpUtil;
|
||||||
|
|
||||||
|
// 192.168.1.35:8079 NC量产环境
|
||||||
|
private static String baseUrl = "http://192.168.1.35:8079/service/ToNCServlet";
|
||||||
|
|
||||||
|
private static String djUrl = "http://192.168.1.30:8079/uapws/rest/nc/api/freezeThaw/freeze";
|
||||||
|
|
||||||
|
private String vbillcode;
|
||||||
|
|
||||||
|
// 其他入
|
||||||
|
private static String qtr = "http://192.168.1.30:8079/uapws/rest/nc/api/ortherIn/insert";
|
||||||
|
|
||||||
|
public String qtrNoInvoice(String receiveRequestName, String siteName, String reActo, String user, String commitDate, String opCode) {
|
||||||
|
String rcode;
|
||||||
|
String rmsg = null;
|
||||||
|
String vbillcode = null;
|
||||||
|
StringBuffer sql = new StringBuffer();
|
||||||
|
sql.append(" ");
|
||||||
|
sql.append(" SELECT 'ZK4A' billtype,'4A-01' iotype, ");
|
||||||
|
sql.append(" M2.STOCKORGNO org, T.ERPFACTORY, ");
|
||||||
|
sql.append(" 'Y' issign, ");
|
||||||
|
sql.append(" T.ERPLOCATION store, ");
|
||||||
|
sql.append(" :commitDate billtime, ");
|
||||||
|
sql.append(" T.LASTEVENTUSER manager, ");
|
||||||
|
sql.append(" T.LASTEVENTUSER maker, ");
|
||||||
|
sql.append(" M2.ERPID srcbillid, ");
|
||||||
|
sql.append(" 'N' freplenishflag, ");
|
||||||
|
sql.append(" M.ERPDETAILID srcbillbid, ");
|
||||||
|
sql.append(" T.MATERIALSPECNAME mat, ");
|
||||||
|
sql.append(" '1' matversion, ");
|
||||||
|
sql.append(" M.MATERIALUNIT unit, ");
|
||||||
|
sql.append(" M.MATERIALUNIT astunit, ");
|
||||||
|
sql.append(" '1.00/1.00' changerate, ");
|
||||||
|
sql.append(" TO_CHAR(T.MAKEDATE, 'YYYY-MM-DD HH24:MI:SS') proddate, ");
|
||||||
|
sql.append(" TO_CHAR(T.EXPIRINGDATE, 'YYYY-MM-DD HH24:MI:SS') expdate, ");
|
||||||
|
sql.append(" T.CHARGE batchcode, ");
|
||||||
|
sql.append(" T.MATERIALQUANTITY num, ");
|
||||||
|
sql.append(" T.MATERIALQUANTITY astnum, ");
|
||||||
|
sql.append(" TO_CHAR(T.RECEIVETIME, 'YYYY-MM-DD HH24:MI:SS') indate, ");
|
||||||
|
sql.append(" T.PHASE jd, ");
|
||||||
|
sql.append(" NVL( T.SDK_ID,'~') sdk, ");
|
||||||
|
sql.append(" T.LOCATIONNAME loc ");
|
||||||
|
sql.append(" FROM MATERIALPACKING T ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEREQUESTDETAIL M ");
|
||||||
|
sql.append(" ON T.RECEIVEREQUESTNAME = M.RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" AND T.RECEIVEREQUESTDETAILNAME = M.RECEIVEREQUESTDETAILNAME ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEREQUEST M2 ");
|
||||||
|
sql.append(" ON T.RECEIVEREQUESTNAME = M2.RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEACT M3 ON T.RECEIVEACTNO = M3.RECEIVEACTNO ");
|
||||||
|
sql.append(" WHERE T.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" AND T.SITENAME = :SITENAME ");
|
||||||
|
sql.append(" AND T.RECEIVEACTNO = :RECEIVEACTNO ");
|
||||||
|
sql.append(" AND M3.RECEIVEACTSTATE = 'Created' ");
|
||||||
|
Map<String, Object> hashMap = new HashMap<String, Object>();
|
||||||
|
hashMap.put("RECEIVEREQUESTNAME", receiveRequestName);
|
||||||
|
hashMap.put("SITENAME", siteName);
|
||||||
|
hashMap.put("RECEIVEACTNO", reActo);
|
||||||
|
hashMap.put("commitDate", commitDate);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject2 = new JSONObject(true);
|
||||||
|
JSONArray dataArray = new JSONArray();
|
||||||
|
JSONObject main = new JSONObject(true);
|
||||||
|
main.put("orgcode", queryForList.get(0).get("ERPFACTORY"));
|
||||||
|
main.put("storecode", queryForList.get(0).get("STORE"));
|
||||||
|
main.put("dbilldate", TimeStampUtil.getCurrentTime("yyyy-MM-dd hh:mm:ss"));
|
||||||
|
main.put("ctrantype", "4A-01");
|
||||||
|
main.put("manager", user);
|
||||||
|
main.put("issign", "Y");
|
||||||
|
main.put("opcode", opCode);
|
||||||
|
JSONObject mains = new JSONObject(true);
|
||||||
|
mains.put("main", main);
|
||||||
|
|
||||||
|
|
||||||
|
JSONArray itemArray = new JSONArray();
|
||||||
|
|
||||||
|
for (Map<String, Object> mm : queryForList) {
|
||||||
|
JSONObject item = new JSONObject(true);
|
||||||
|
item.put("material", mm.get("MAT"));
|
||||||
|
item.put("location", mm.get("LOC"));
|
||||||
|
item.put("dbizdate", mm.get("INDATE"));
|
||||||
|
item.put("dproducedate", mm.get("PRODDATE"));
|
||||||
|
item.put("dvalidate", mm.get("EXPDATE"));
|
||||||
|
item.put("vbatchcode", mm.get("BATCHCODE"));
|
||||||
|
item.put("sdk", mm.get("SDK"));
|
||||||
|
item.put("wmsid", UUID.randomUUID() + "");
|
||||||
|
item.put("stage", mm.get("JD"));
|
||||||
|
item.put("num", mm.get("NUM") + "");
|
||||||
|
itemArray.add(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
jsonObject2.put("user_code", user);
|
||||||
|
mains.put("items", itemArray);
|
||||||
|
dataArray.add(mains);
|
||||||
|
jsonObject2.put("data", dataArray);
|
||||||
|
String httpPost = NCHttpUtil.httpPost(qtr, jsonObject2.toJSONString());
|
||||||
|
org.json.JSONObject jsonObject = new org.json.JSONObject(httpPost);
|
||||||
|
rcode = jsonObject.get("code").toString();
|
||||||
|
rmsg = jsonObject.get("message").toString();
|
||||||
|
vbillcode = jsonObject.get("vbillcode").toString();
|
||||||
|
Thread t = new Thread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
// run方法具体重写
|
||||||
|
UUID uuid = UUID.randomUUID();
|
||||||
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
|
erplog.setEventUser("");
|
||||||
|
erplog.setServerName("WmsToErp");
|
||||||
|
erplog.setEventName("qtr");
|
||||||
|
erplog.setId(uuid.toString());
|
||||||
|
erplog.setSendMsg(jsonObject2.toJSONString());
|
||||||
|
erplog.setInterfaceTime(ConvertUtil.getCurrTime("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
erplog.setMessageId(reActo);
|
||||||
|
erplog.setSendMsg2(jsonObject2.toJSONString());
|
||||||
|
erplog.setReturnMsg2(httpPost);
|
||||||
|
erplog.setResultCode(rcode);
|
||||||
|
saveMessageLog(erplog);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.start();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("NC返回" + rmsg);
|
||||||
|
}
|
||||||
|
if (!"1".equals(rcode)) {
|
||||||
|
throw new RuntimeException("NC返回" + rmsg);
|
||||||
|
}
|
||||||
|
return vbillcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String hold(List<Element> m, String siteName, String user) {
|
||||||
|
String rcode;
|
||||||
|
// pk_org String 是 库存组织
|
||||||
|
// cwarehouseid String 是 仓库
|
||||||
|
// clocationid String 是 货位
|
||||||
|
// cmaterialvid String 是 物料编码
|
||||||
|
// vbatchcode String 是 批次号
|
||||||
|
// vfree1 String 是 sdk规格
|
||||||
|
// vfree2 String 是 阶段
|
||||||
|
// nfrznum String 是 冻结主数量
|
||||||
|
// nfrzastnum String 是 冻结数量
|
||||||
|
// cfreezerid String 是 冻结人
|
||||||
|
// dfreezedate String 是 冻结日期
|
||||||
|
String rmsg = "";
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject2 = new JSONObject(true);
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
for (Element mm : m) {
|
||||||
|
String textTrim = mm.getTextTrim();
|
||||||
|
MaterialPacking materialPacking = MaterialPackingServiceProxy.getMaterialPackingService().selectByKey(new MaterialPackingKey(siteName, mm.getTextTrim()));
|
||||||
|
JSONObject jsonObject = new JSONObject(true);
|
||||||
|
jsonObject.put("orgcode", materialPacking.getErpFactory());
|
||||||
|
jsonObject.put("storecode", materialPacking.getErpLocation());
|
||||||
|
jsonObject.put("material", materialPacking.getMaterialSpecName());
|
||||||
|
jsonObject.put("vbatchcode", materialPacking.getCharge());
|
||||||
|
jsonObject.put("wmsid", UUID.randomUUID() + "");
|
||||||
|
jsonArray.add(jsonObject);
|
||||||
|
}
|
||||||
|
jsonObject2.put("user_code", user);
|
||||||
|
jsonObject2.put("head", jsonArray);
|
||||||
|
String httpPost = NCHttpUtil.httpPost(djUrl, jsonObject2.toJSONString());
|
||||||
|
org.json.JSONObject jsonObject = new org.json.JSONObject(httpPost);
|
||||||
|
rcode = jsonObject.get("code").toString();
|
||||||
|
rmsg = jsonObject.get("message").toString();
|
||||||
|
// vbillcode= jsonObject.get("vbillcode") == null ? "" : jsonObject.get("vbillcode").toString();
|
||||||
|
Thread t = new Thread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
// run方法具体重写
|
||||||
|
UUID uuid = UUID.randomUUID();
|
||||||
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
|
erplog.setEventUser("");
|
||||||
|
erplog.setServerName("WmsToErp");
|
||||||
|
erplog.setEventName("hold");
|
||||||
|
erplog.setId(uuid.toString());
|
||||||
|
erplog.setInterfaceTime(ConvertUtil.getCurrTime("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
erplog.setMessageId(m.toString());
|
||||||
|
erplog.setSendMsg(jsonArray.toJSONString());
|
||||||
|
erplog.setReturnMsg2(httpPost);
|
||||||
|
erplog.setResultCode(rcode);
|
||||||
|
saveMessageLog(erplog);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.start();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("NC返回" + rmsg);
|
||||||
|
}
|
||||||
|
return vbillcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不按批次采购入库接口
|
||||||
|
*
|
||||||
|
* @param receiveRequestName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
// @Override
|
||||||
|
public String PurStockIn(String receiveRequestName, String siteName, String eventUser, String receiveActno, String commitDate, String opCode) throws Exception {
|
||||||
|
StringBuffer sql = new StringBuffer();
|
||||||
|
sql.append(" ");
|
||||||
|
sql.append(" SELECT '45' billtype,'45-01' iotype, ");
|
||||||
|
sql.append(" M2.STOCKORGNO org, ");
|
||||||
|
sql.append(" 'Y' issign, ");
|
||||||
|
sql.append(" T.ERPLOCATION store, ");
|
||||||
|
sql.append(" :commitDate billtime, ");
|
||||||
|
sql.append(" T.LASTEVENTUSER manager, ");
|
||||||
|
sql.append(" T.LASTEVENTUSER maker, ");
|
||||||
|
sql.append(" M2.ERPID srcbillid, ");
|
||||||
|
sql.append(" 'N' freplenishflag, ");
|
||||||
|
sql.append(" M.ERPDETAILID srcbillbid, ");
|
||||||
|
sql.append(" T.MATERIALSPECNAME mat, ");
|
||||||
|
sql.append(" '1' matversion, ");
|
||||||
|
sql.append(" M.MATERIALUNIT unit, ");
|
||||||
|
sql.append(" M.MATERIALUNIT astunit, ");
|
||||||
|
sql.append(" '1.00/1.00' changerate, ");
|
||||||
|
sql.append(" TO_CHAR(T.MAKEDATE, 'YYYY-MM-DD') proddate, ");
|
||||||
|
sql.append(" TO_CHAR(T.EXPIRINGDATE, 'YYYY-MM-DD') expdate, ");
|
||||||
|
sql.append(" T.CHARGE batchcode, ");
|
||||||
|
sql.append(" T.MATERIALQUANTITY num, ");
|
||||||
|
sql.append(" T.MATERIALQUANTITY astnum, ");
|
||||||
|
sql.append(" TO_CHAR(SYSDATE, 'YYYY-MM-DD') indate, ");
|
||||||
|
sql.append(" T.PHASE jd, ");
|
||||||
|
sql.append(" T.SDK_ID sdk, ");
|
||||||
|
sql.append(" T.LOCATIONNAME loc ");
|
||||||
|
sql.append(" FROM MATERIALPACKING T ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEREQUESTDETAIL M ");
|
||||||
|
sql.append(" ON T.RECEIVEREQUESTNAME = M.RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" AND T.RECEIVEREQUESTDETAILNAME = M.RECEIVEREQUESTDETAILNAME ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEREQUEST M2 ");
|
||||||
|
sql.append(" ON T.RECEIVEREQUESTNAME = M2.RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" LEFT JOIN MATERIALRECEIVEACT M3 ON T.RECEIVEACTNO = M3.RECEIVEACTNO ");
|
||||||
|
sql.append(" WHERE T.RECEIVEREQUESTNAME = :RECEIVEREQUESTNAME ");
|
||||||
|
sql.append(" AND T.SITENAME = :SITENAME ");
|
||||||
|
sql.append(" AND T.RECEIVEACTNO = :RECEIVEACTNO ");
|
||||||
|
sql.append(" AND M3.RECEIVEACTSTATE = 'Created' ");
|
||||||
|
Map<String, Object> hashMap = new HashMap<String, Object>();
|
||||||
|
hashMap.put("RECEIVEREQUESTNAME", receiveRequestName);
|
||||||
|
hashMap.put("SITENAME", siteName);
|
||||||
|
hashMap.put("RECEIVEACTNO", receiveActno);
|
||||||
|
hashMap.put("commitDate", commitDate);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
||||||
|
if (queryForList == null || queryForList.size() < 1) {
|
||||||
|
throw new Exception("NC返回" + "无需过账");
|
||||||
|
}
|
||||||
|
String makePurStockInXML = makePurStockInXML(queryForList, eventUser, opCode);
|
||||||
|
String replaceAll = makePurStockInXML.replace("<LinkedHashMap>", "").replace("</LinkedHashMap>", "");
|
||||||
|
String httpPost = NCHttpUtil.httpPost(baseUrl, replaceAll);
|
||||||
|
Document document1 = DocumentHelper.parseText(httpPost);
|
||||||
|
org.dom4j.Element rootElement = document1.getRootElement();
|
||||||
|
String rcode = rootElement.elementText("rcode");
|
||||||
|
String rmsg = rootElement.elementText("rmsg");
|
||||||
|
String billcode = rootElement.elementText("billcode");
|
||||||
|
|
||||||
|
Thread t = new Thread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
// run方法具体重写
|
||||||
|
UUID uuid = UUID.randomUUID();
|
||||||
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
|
erplog.setEventUser(eventUser);
|
||||||
|
erplog.setServerName("WmsToErp");
|
||||||
|
erplog.setEventName("PurStockIn");
|
||||||
|
erplog.setId(uuid.toString());
|
||||||
|
erplog.setInterfaceTime(ConvertUtil.getCurrTime("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
erplog.setMessageId(receiveActno.toString());
|
||||||
|
erplog.setSendMsg2(replaceAll.toString());
|
||||||
|
erplog.setSendMsg(replaceAll.toString());
|
||||||
|
erplog.setReturnMsg2(rmsg.toString());
|
||||||
|
erplog.setResultCode(rcode.toString());
|
||||||
|
saveMessageLog(erplog);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
t.start();
|
||||||
|
if ("-1".equals(rcode)) {
|
||||||
|
throw new Exception("NC返回" + rmsg);
|
||||||
|
}
|
||||||
|
return billcode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购入库
|
||||||
|
* @param list
|
||||||
|
* @param eventUser
|
||||||
|
* @return
|
||||||
|
* @throws JsonMappingException
|
||||||
|
* @throws JsonProcessingException
|
||||||
|
*/
|
||||||
|
public String makePurStockInXML (List<Map<String, Object>> list, String eventUser, String opcode) throws JsonMappingException, JsonProcessingException {
|
||||||
|
|
||||||
|
if (list == null || list.size() < 1) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
// billtype String 是 单据类型
|
||||||
|
// org String 是 库存组织
|
||||||
|
// issign String 是 是否签字
|
||||||
|
// Y 是
|
||||||
|
// N否
|
||||||
|
// iotype String 是 出入库类型编码
|
||||||
|
// store String 是 仓库编码
|
||||||
|
// billtime String 是 制单日期
|
||||||
|
// manager String 是 库管员
|
||||||
|
// maker String 是 制单人
|
||||||
|
// srcbillid String 是 上游单据到货单主表id
|
||||||
|
// freplenishflag
|
||||||
|
// String 是 N
|
||||||
|
//先保存成json再转xml
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
XmlMapper xmlMapper = new XmlMapper();
|
||||||
|
JSONObject bill = new JSONObject(true);
|
||||||
|
JSONObject billBody = new JSONObject(true);
|
||||||
|
billBody.put("billtype", list.get(0).get("BILLTYPE"));
|
||||||
|
billBody.put("org", list.get(0).get("ORG"));
|
||||||
|
billBody.put("issign", list.get(0).get("ISSIGN"));
|
||||||
|
billBody.put("iotype", list.get(0).get("IOTYPE"));
|
||||||
|
billBody.put("store", list.get(0).get("STORE"));
|
||||||
|
billBody.put("opcode",opcode);
|
||||||
|
billBody.put("billtime", list.get(0).get("BILLTIME"));
|
||||||
|
billBody.put("manager", eventUser);
|
||||||
|
billBody.put("maker", eventUser);
|
||||||
|
billBody.put("srcbillid", list.get(0).get("SRCBILLID"));
|
||||||
|
billBody.put("freplenishflag", list.get(0).get("FREPLENISHFLAG"));
|
||||||
|
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
JSONArray itemH = new JSONArray();
|
||||||
|
JSONObject detail = new JSONObject(true);
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
// srcbillbid String 是 上游单据生产报告子表id
|
||||||
|
// mat String 是 物料编码
|
||||||
|
// matversion String 是 物料版本默认1
|
||||||
|
// unit String 是 主单位
|
||||||
|
// astunit String 是 辅单位
|
||||||
|
// changerate String 是 换算率
|
||||||
|
// proddate String 是 生产日期
|
||||||
|
// expdate String 是 失效日期
|
||||||
|
// batchcode String 是 批次号
|
||||||
|
// num String 是 主数量
|
||||||
|
// astnum String 是 辅数量
|
||||||
|
// indate String 是 入库日期
|
||||||
|
// jd String 是 阶段
|
||||||
|
// sdk String 否 sdk规格(看具体物料)
|
||||||
|
// loc String 是 货位
|
||||||
|
JSONObject itemD = new JSONObject(true);
|
||||||
|
itemD.put("srcbillbid", list.get(i).get("SRCBILLBID"));
|
||||||
|
itemD.put("mat", list.get(i).get("MAT"));
|
||||||
|
itemD.put("matversion", list.get(i).get("MATVERSION"));
|
||||||
|
itemD.put("unit", list.get(i).get("UNIT"));
|
||||||
|
itemD.put("astunit", list.get(i).get("ASTUNIT"));
|
||||||
|
itemD.put("changerate", list.get(i).get("CHANGERATE"));
|
||||||
|
itemD.put("proddate", list.get(i).get("PRODDATE"));
|
||||||
|
itemD.put("expdate", list.get(i).get("EXPDATE"));
|
||||||
|
if ( !"105010002".equals(list.get(i).get("MAT"))) {
|
||||||
|
|
||||||
|
itemD.put("batchcode", list.get(i).get("BATCHCODE"));
|
||||||
|
}
|
||||||
|
|
||||||
|
itemD.put("num", list.get(i).get("NUM"));
|
||||||
|
itemD.put("astnum", list.get(i).get("ASTNUM"));
|
||||||
|
itemD.put("indate", list.get(0).get("BILLTIME"));
|
||||||
|
|
||||||
|
itemD.put("jd", list.get(i).get("JD"));
|
||||||
|
itemD.put("sdk", list.get(i).get("SDK"));
|
||||||
|
itemD.put("loc", list.get(i).get("LOC"));
|
||||||
|
itemH.add(itemD);
|
||||||
|
}
|
||||||
|
detail.put("item", itemH);
|
||||||
|
billBody.put("detail", detail);
|
||||||
|
bill.put("bill", billBody);
|
||||||
|
Object readValue = objectMapper.readValue(bill.toJSONString(), Object.class);
|
||||||
|
String writeValueAsString = xmlMapper.writeValueAsString(readValue);
|
||||||
|
return writeValueAsString;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志保存
|
||||||
|
* @param log
|
||||||
|
*/
|
||||||
|
public static void saveMessageLog(ErpMessageLog log) {
|
||||||
|
|
||||||
|
String sql = "INSERT INTO BS_ERPMESSAGELOG(INTERFACETIME,SERVERNAME, EVENTNAME, EVENTTIMEKEY, EVENTUSER, MESSAGELOG2,RESULTCODE,MESSAGEID,RESULTMESSAGE,MESSAGELOG,RESULTMESSAGE2)\r\n"
|
||||||
|
+ "VALUES(TO_DATE(:INTERFACETIME,'yyyy-mm-dd hh24:mi:ss'),:SERVERNAME, :EVENTNAME, :EVENTTIMEKEY, :EVENTUSER, :MESSAGELOG2,:RESULTCODE,:MESSAGEID,:RESULTMESSAGE,:MESSAGELOG,:RESULTMESSAGE2)";
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("SERVERNAME", log.getServerName());
|
||||||
|
bindMap.put("EVENTNAME", log.getEventName());
|
||||||
|
bindMap.put("EVENTTIMEKEY", log.getId());
|
||||||
|
bindMap.put("EVENTUSER", log.getEventUser());
|
||||||
|
bindMap.put("MESSAGEID", log.getMessageId());
|
||||||
|
bindMap.put("INTERFACETIME", log.getInterfaceTime());
|
||||||
|
bindMap.put("RESULTCODE", log.getResultCode());
|
||||||
|
bindMap.put("MESSAGELOG", log.getSendMsg());// 推送ERP的json
|
||||||
|
bindMap.put("RESULTMESSAGE", log.getReturnMsg());// 返回结果的json
|
||||||
|
bindMap.put("MESSAGELOG2", null);// 推送ERP的json
|
||||||
|
bindMap.put("RESULTMESSAGE2", log.getReturnMsg2());// 返回结果的json
|
||||||
|
IDMFrameServiceProxy.getSqlTemplate().update(sql, bindMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
11
zi-wms-pda/src/main/java/com/cim/idm/service/NCWService.java
Normal file
11
zi-wms-pda/src/main/java/com/cim/idm/service/NCWService.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.cim.idm.service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description TODO
|
||||||
|
* @Author li
|
||||||
|
* @Date 2024/4/28 8:29
|
||||||
|
*/
|
||||||
|
public interface NCWService {
|
||||||
|
|
||||||
|
}
|
@ -10,7 +10,7 @@
|
|||||||
<insert id="createRelation">
|
<insert id="createRelation">
|
||||||
INSERT ALL
|
INSERT ALL
|
||||||
<foreach item="item" index="index" collection="receiveList">
|
<foreach item="item" index="index" collection="receiveList">
|
||||||
INTO MATERIALDELIVERYRECEIVE (RECEIVEREQUESTNAME, DELIVERYNAME, DELIVERYNUM, MATERIALSPECNAME) VALUES (#{item.receiveRequestName}, #{item.deliveryName}, #{item.deliveryNum}, #{item.materialSpecName})
|
INTO MATERIALDELIVERYRECEIVE (RECEIVEREQUESTNAME, DELIVERYNAME, DELIVERYNUM, MATERIALSPECNAME, RECEIVEREQUESTDETAILNAME) VALUES (#{item.receiveRequestName}, #{item.deliveryName}, #{item.deliveryNum}, #{item.materialSpecName}, #{item.receiveRequestDetailName})
|
||||||
</foreach>
|
</foreach>
|
||||||
SELECT * FROM dual
|
SELECT * FROM dual
|
||||||
</insert>
|
</insert>
|
||||||
@ -74,6 +74,7 @@
|
|||||||
AND m.ORDERDATE BETWEEN TO_DATE( #{dto.fromDate}, 'YYYY/MM/DDHH24MISS' )
|
AND m.ORDERDATE BETWEEN TO_DATE( #{dto.fromDate}, 'YYYY/MM/DDHH24MISS' )
|
||||||
AND TO_DATE( #{dto.toDate}, 'YYYY/MM/DDHH24MISS' )
|
AND TO_DATE( #{dto.toDate}, 'YYYY/MM/DDHH24MISS' )
|
||||||
</if>
|
</if>
|
||||||
|
AND ms.IS_BATCH = #{isBatch}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- GetInvoiceDetailInformationRow Z10006_SAP -->
|
<!-- GetInvoiceDetailInformationRow Z10006_SAP -->
|
||||||
@ -279,7 +280,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getRelByDelivery" resultType="com.cim.idm.model.po.delivery.MaterialDeliveryReceive">
|
<select id="getRelByDelivery" resultType="com.cim.idm.model.po.delivery.MaterialDeliveryReceive">
|
||||||
SELECT md.DELIVERYNAME, md.DELIVERYNUM, md.RECEIVEREQUESTNAME, md.MATERIALSPECNAME
|
SELECT md.DELIVERYNAME, md.DELIVERYNUM, md.RECEIVEREQUESTNAME, md.MATERIALSPECNAME, md.RECEIVEREQUESTDETAILNAME
|
||||||
FROM MATERIALDELIVERYRECEIVE md
|
FROM MATERIALDELIVERYRECEIVE md
|
||||||
WHERE md.DELIVERYNAME = #{dto.documentName}
|
WHERE md.DELIVERYNAME = #{dto.documentName}
|
||||||
</select>
|
</select>
|
||||||
@ -296,14 +297,28 @@
|
|||||||
AND m.RECEIVEREQUESTNAME = md.RECEIVEREQUESTNAME
|
AND m.RECEIVEREQUESTNAME = md.RECEIVEREQUESTNAME
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getReceiveByMaterialSpec" resultType="com.cim.idm.model.vo.DeliveryReceiveDetailVo">
|
||||||
|
SELECT receiveRequestName, receiveRequestDetailName
|
||||||
|
FROM MATERIALRECEIVEREQUESTDETAIL
|
||||||
|
WHERE RECEIVEREQUESTNAME = #{documentName}
|
||||||
|
AND MATERIALSPECNAME = #{materialSpec}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDeliveryByMaterialSpec" resultType="com.cim.idm.model.vo.DeliveryReceiveDetailVo">
|
||||||
|
SELECT receiveRequestName, receiveRequestDetailName
|
||||||
|
FROM MATERIALDELIVERYRECEIVE
|
||||||
|
WHERE DELIVERYNAME = #{documentName}
|
||||||
|
AND MATERIALSPECNAME = #{materialSpec}
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getReceiveDetail" resultType="com.cim.idm.model.vo.DeliveryReceiveDetailVo">
|
<select id="getReceiveDetail" resultType="com.cim.idm.model.vo.DeliveryReceiveDetailVo">
|
||||||
SELECT receiveRequestName, materialSpecName, requestQuantity, requestQuantity as deliveryNum
|
SELECT receiveRequestName, materialSpecName, requestQuantity, requestQuantity as deliveryNum, RECEIVEREQUESTDETAILNAME
|
||||||
FROM MATERIALRECEIVEREQUESTDETAIL
|
FROM MATERIALRECEIVEREQUESTDETAIL
|
||||||
WHERE RECEIVEREQUESTNAME in
|
WHERE RECEIVEREQUESTNAME in
|
||||||
<foreach item="name" index="index" collection="nameList" open="(" separator="," close=")">
|
<foreach item="name" index="index" collection="nameList" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
order by RECEIVEREQUESTNAME
|
order by RECEIVEREQUESTDETAILNAME
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDeliveryList" resultType="com.cim.idm.model.po.delivery.MaterialDelivery">
|
<select id="getDeliveryList" resultType="com.cim.idm.model.po.delivery.MaterialDelivery">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user