pda出入库功能
This commit is contained in:
parent
ea1eea5b69
commit
e3a98e4d25
@ -5132,7 +5132,8 @@ public class ToSAPServiceImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//物料报废/降级品出库 (Z07)
|
//物料报废/降级品出库 (Z07)
|
||||||
public String MaterialScrapStockOut(List<MaterialPackingKey> all, String siteName, String user,String commitDate,String opCode) throws Exception {
|
public String MaterialScrapStockOut(List<MaterialPackingKey> all, String siteName, String user,String commitDate,
|
||||||
|
String opCode,String qtc,String costName) throws Exception {
|
||||||
String rcode;
|
String rcode;
|
||||||
String undoId = "";
|
String undoId = "";
|
||||||
String rmsg = null;
|
String rmsg = null;
|
||||||
@ -5212,7 +5213,8 @@ public class ToSAPServiceImpl {
|
|||||||
// LGORT 发货库存地点
|
// LGORT 发货库存地点
|
||||||
item.put("LGORT", mm.get("ERPLOCATION"));
|
item.put("LGORT", mm.get("ERPLOCATION"));
|
||||||
//BWART 移动类型
|
//BWART 移动类型
|
||||||
item.put("BWART", "Z07");
|
item.put("BWART", qtc);
|
||||||
|
item.put("KOSTL", costName);
|
||||||
//MENGE 数量
|
//MENGE 数量
|
||||||
item.put("MENGE", mm.get("MATERIALQUANTITY"));
|
item.put("MENGE", mm.get("MATERIALQUANTITY"));
|
||||||
//MENGE 单位
|
//MENGE 单位
|
||||||
@ -6071,6 +6073,116 @@ public class ToSAPServiceImpl {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过账
|
||||||
|
* @param srPk
|
||||||
|
* @param qtc 判断盘亏 qtc, 盘盈 qtr
|
||||||
|
* @param user 用户
|
||||||
|
* @param commitDate 过账时间
|
||||||
|
* @param opCode
|
||||||
|
* @param costName 成本中心
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String qtcrNoInvoiceForCheckPlanApp(List<Map<String, Object>> srPk, String qtc, String user, String commitDate,
|
||||||
|
String opCode, String costName, String lifnr) {
|
||||||
|
String rcode;
|
||||||
|
String undoId = "";
|
||||||
|
String rmsg = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
JSONObject sendData = new JSONObject(true);
|
||||||
|
JSONObject header = new JSONObject(true);
|
||||||
|
sendData.put("HEAD", header);
|
||||||
|
JSONObject body = new JSONObject(true);
|
||||||
|
sendData.put("BODY", body);
|
||||||
|
JSONArray itemArray = new JSONArray();
|
||||||
|
|
||||||
|
/*
|
||||||
|
HEAD
|
||||||
|
*/
|
||||||
|
header.put("INTF_ID", "MM067");
|
||||||
|
String uniqueID = UUID.randomUUID().toString();
|
||||||
|
header.put("REQ_KEYID", uniqueID);
|
||||||
|
header.put("SRC_MSGID", uniqueID);
|
||||||
|
header.put("SRC_SYSTEM", "WMS");
|
||||||
|
header.put("DEST_SYSTEM", "SAP");
|
||||||
|
header.put("REQUSER", user);
|
||||||
|
|
||||||
|
/*
|
||||||
|
BODY
|
||||||
|
*/
|
||||||
|
body.put("ITEM", itemArray);
|
||||||
|
body.put("ITEMID", uniqueID);
|
||||||
|
|
||||||
|
SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
SimpleDateFormat outputFormat = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
Date date = inputFormat.parse(commitDate);
|
||||||
|
String outputDate = outputFormat.format(date);
|
||||||
|
//过账日期
|
||||||
|
body.put("BUDAT", outputDate);
|
||||||
|
//凭证日期
|
||||||
|
body.put("BLDAT", outputDate);
|
||||||
|
//凭证抬头文本
|
||||||
|
body.put("BKTXT", uniqueID);
|
||||||
|
//用户名
|
||||||
|
body.put("USNAM", user);
|
||||||
|
|
||||||
|
for (Map<String, Object> auditBox : srPk) {
|
||||||
|
|
||||||
|
JSONObject item = new JSONObject(true);
|
||||||
|
|
||||||
|
//BWART 移动类型
|
||||||
|
item.put("BWART", qtc);
|
||||||
|
// MATNR 发货物料号
|
||||||
|
item.put("MATNR", auditBox.get("MATERIALSPECNAME"));
|
||||||
|
// WERKS 发货工厂
|
||||||
|
item.put("WERKS", auditBox.get("ERPFACTORY"));
|
||||||
|
// LGORT 发货库存地点
|
||||||
|
item.put("LGORT", auditBox.get("ERPLOCATION"));
|
||||||
|
//MENGE 数量
|
||||||
|
item.put("MENGE", auditBox.get("MATERIALQUANTITY"));
|
||||||
|
//MENGE 单位
|
||||||
|
item.put("MEINS", auditBox.get("UNIT"));
|
||||||
|
// 供应商编码
|
||||||
|
item.put("LIFNR", lifnr);
|
||||||
|
//KOSTL 成本中心
|
||||||
|
item.put("KOSTL", costName);
|
||||||
|
itemArray.add(item);
|
||||||
|
}
|
||||||
|
log.info("SendTOSAP >>>>" + sendData);
|
||||||
|
String sapreturn = toSAPMessageUtil.sendHttpPost(toSAPMessageUtil.materialChangeLocationUrl, "", sendData.toJSONString());
|
||||||
|
org.json.JSONObject receiveJsonObject = new org.json.JSONObject(sapreturn);
|
||||||
|
org.json.JSONObject returnJsonObject = (org.json.JSONObject) receiveJsonObject.get("RETURN");
|
||||||
|
rcode = returnJsonObject.get("STATUS").toString();
|
||||||
|
rmsg = returnJsonObject.get("MSGTXT").toString();
|
||||||
|
|
||||||
|
if ("S".equals(rcode)) {
|
||||||
|
undoId = returnJsonObject.get("MBLNR").toString()+"_"+returnJsonObject.get("MJAHR").toString();//将物料凭证号与凭证年度拼在一起
|
||||||
|
}
|
||||||
|
//将log写到表里
|
||||||
|
ErpMessageLog erplog = new ErpMessageLog();
|
||||||
|
erplog.setEventUser("");
|
||||||
|
erplog.setServerName("WmsToErp");
|
||||||
|
erplog.setEventName("盘点");
|
||||||
|
erplog.setInterfaceTime(TimeStampUtil.getCurrentTime(TimeStampUtil.FORMAT_DEFAULT));
|
||||||
|
erplog.setMessageId(UUID.randomUUID().toString());
|
||||||
|
erplog.setSendMsg(sendData.toJSONString());
|
||||||
|
erplog.setSendMsg2(sendData.toJSONString());
|
||||||
|
erplog.setReturnMsg2(sapreturn);
|
||||||
|
erplog.setResultCode(rcode);
|
||||||
|
MessageLogUtil.writeMessageLog(erplog);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.info(e.getMessage(), e);
|
||||||
|
throw new RuntimeException("SAP返回" + rmsg);
|
||||||
|
}
|
||||||
|
if (!"S".equals(rcode)) {
|
||||||
|
throw new RuntimeException("SAP返回" + rmsg);
|
||||||
|
}
|
||||||
|
return undoId;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String qtcrNoInvoiceForCheckPlan(List<Map<String, Object>> srPk, String qtc, String user, String commitDate, String opCode, String costName) {
|
public String qtcrNoInvoiceForCheckPlan(List<Map<String, Object>> srPk, String qtc, String user, String commitDate, String opCode, String costName) {
|
||||||
String rcode;
|
String rcode;
|
||||||
String undoId = "";
|
String undoId = "";
|
||||||
|
@ -177,6 +177,38 @@ public class NoInvoiceManagerContoller {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/getQTCOutList", method = RequestMethod.POST)
|
||||||
|
public AjaxResult getQTCOutList(@RequestBody JSONObject in ){
|
||||||
|
MaterialPacking materialPacking = JSON.toJavaObject(in, MaterialPacking.class);
|
||||||
|
|
||||||
|
String sql = "SELECT\r\n" +
|
||||||
|
" M.*,\r\n" +
|
||||||
|
" CASE\r\n" +
|
||||||
|
" WHEN M.MATURATIONINTIME IS NOT NULL THEN SYSDATE - M.MATURATIONINTIME - m2.MATURATIONTIME\r\n" +
|
||||||
|
" ELSE 1\r\n" +
|
||||||
|
" END FLAG,\r\n" +
|
||||||
|
" bsn.DESCRIPTION\r\n" +
|
||||||
|
"FROM\r\n" +
|
||||||
|
" MATERIALPACKING M\r\n" +
|
||||||
|
"LEFT JOIN MATERIALSPEC m2 ON\r\n" +
|
||||||
|
" M.MATERIALSPECNAME = m2.MATERIALSPECNAME\r\n" +
|
||||||
|
"LEFT JOIN BS_ERPLOCATION bsn ON\r\n" +
|
||||||
|
" bsn.ERPLOCATIONNAME = M.ERPLOCATION\r\n" +
|
||||||
|
"WHERE\r\n" +
|
||||||
|
" M.STOCKSTATE = 'Stocked'\r\n" +
|
||||||
|
" AND M.MATERIALPACKINGNAME = :MATERIALPACKINGNAME";
|
||||||
|
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("MATERIALPACKINGNAME", materialPacking.getMaterialPackingName());
|
||||||
|
List<Map<String,Object>> list = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql, bindMap);
|
||||||
|
|
||||||
|
if(Objects.isNull(list) || list.isEmpty()) {
|
||||||
|
throw new GlobalException("未找到对应的数据!");
|
||||||
|
}
|
||||||
|
return AjaxResult.me().setResultObj(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报废出提交
|
* 报废出提交
|
||||||
@ -194,7 +226,10 @@ public class NoInvoiceManagerContoller {
|
|||||||
String commitDatesString = sl.getCommitDate();
|
String commitDatesString = sl.getCommitDate();
|
||||||
String commitDate = commitDatesString + " 00:00:00";
|
String commitDate = commitDatesString + " 00:00:00";
|
||||||
String opCode = sl.getOpCode();
|
String opCode = sl.getOpCode();
|
||||||
|
// 移动类型
|
||||||
|
String qtc = sl.getQtc();
|
||||||
|
// 成本中心
|
||||||
|
String costName = sl.getCostName();
|
||||||
ArrayList<MaterialPackingKey> arrayList = new ArrayList<>();
|
ArrayList<MaterialPackingKey> arrayList = new ArrayList<>();
|
||||||
for(MaterialPacking map : boxList) {
|
for(MaterialPacking map : boxList) {
|
||||||
// String supplierCharge = map.get("SUPPLIERCHARGE") == null ? "" : map.get("SUPPLIERCHARGE").toString();
|
// String supplierCharge = map.get("SUPPLIERCHARGE") == null ? "" : map.get("SUPPLIERCHARGE").toString();
|
||||||
@ -204,7 +239,7 @@ public class NoInvoiceManagerContoller {
|
|||||||
String undoId = "";
|
String undoId = "";
|
||||||
try {
|
try {
|
||||||
// NoInvoiceManagerServiceImpl.QTC(boxList,user,siteName,commitDate,opCode);
|
// NoInvoiceManagerServiceImpl.QTC(boxList,user,siteName,commitDate,opCode);
|
||||||
undoId = toSAPService.MaterialScrapStockOut(arrayList,siteName,user,commitDate,opCode);
|
undoId = toSAPService.MaterialScrapStockOut(arrayList,siteName,user,commitDate,opCode,qtc,costName);
|
||||||
} 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());
|
||||||
@ -234,8 +269,10 @@ public class NoInvoiceManagerContoller {
|
|||||||
// arrayList.add(selectByKey);
|
// arrayList.add(selectByKey);
|
||||||
|
|
||||||
String commitDate = commitDateString + " 00:00:00";
|
String commitDate = commitDateString + " 00:00:00";
|
||||||
|
String costName = sl.getCostName();
|
||||||
NoInvoiceManagerServiceImpl.QTR(boxList,user2,commitDate,opCode);
|
String lifnr = sl.getLifnr();
|
||||||
|
String qtc = sl.getQtc();
|
||||||
|
NoInvoiceManagerServiceImpl.QTR(boxList,user2,commitDate,opCode,costName,lifnr,qtc);
|
||||||
|
|
||||||
return AjaxResult.me().setResultObj(null);
|
return AjaxResult.me().setResultObj(null);
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ public class MaterialReceiveRequest {
|
|||||||
private String phase;
|
private String phase;
|
||||||
private String CUSTOMNO;
|
private String CUSTOMNO;
|
||||||
private String truegg;
|
private String truegg;
|
||||||
|
private String costName;
|
||||||
|
private String lifnr;
|
||||||
|
private String qtc;
|
||||||
/**销售订单*/
|
/**销售订单*/
|
||||||
private String SALESHIPREQUESTNAME;
|
private String SALESHIPREQUESTNAME;
|
||||||
/**销售订单行号*/
|
/**销售订单行号*/
|
||||||
|
@ -4,6 +4,7 @@ import com.cim.idm.exception.GlobalException;
|
|||||||
import com.cim.idm.framework.IDMFrameServiceProxy;
|
import com.cim.idm.framework.IDMFrameServiceProxy;
|
||||||
import com.cim.idm.framework.data.EventInfo;
|
import com.cim.idm.framework.data.EventInfo;
|
||||||
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||||
|
import com.cim.idm.utils.CommonUtils;
|
||||||
import com.cim.idm.utils.EventInfoUtil;
|
import com.cim.idm.utils.EventInfoUtil;
|
||||||
import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy;
|
import com.cim.idm.wmspackage.materialpacking.MaterialPackingServiceProxy;
|
||||||
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
|
import com.cim.idm.wmspackage.materialpacking.management.data.MaterialPacking;
|
||||||
@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -21,15 +23,22 @@ import java.util.Map;
|
|||||||
public class NoInvoiceManagerServiceImpl {
|
public class NoInvoiceManagerServiceImpl {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ToSAPServiceImpl toSAPService;
|
private ToSAPServiceImpl toSAPService;
|
||||||
|
@Autowired
|
||||||
|
private ToSAPServiceImpl toSAPServiceImpl;
|
||||||
|
@Autowired
|
||||||
|
private CommonUtils commonUtils;
|
||||||
|
|
||||||
private SDKMaterialPackingServiceImpl SDKMaterialPackingServiceImpl = new SDKMaterialPackingServiceImpl();
|
private SDKMaterialPackingServiceImpl SDKMaterialPackingServiceImpl = new SDKMaterialPackingServiceImpl();
|
||||||
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void QTR(List<MaterialPacking> list,String user,String commitDate,String opCode) {
|
public void QTR(List<MaterialPacking> list,String user,String commitDate,String opCode,
|
||||||
|
String costName, String lifnr, String qtc) {
|
||||||
EventInfo makeEventInfo = EventInfoUtil.makeEventInfo("QTR", user, "QTR", "", "");
|
EventInfo makeEventInfo = EventInfoUtil.makeEventInfo("QTR", user, "QTR", "", "");
|
||||||
SetEventInfo setEventInfo = new SetEventInfo();
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||||
HashMap<String, Object> hashMap = new HashMap<String,Object> ();
|
HashMap<String, Object> hashMap = new HashMap<String,Object> ();
|
||||||
|
List<String> strings = new ArrayList<>();
|
||||||
hashMap.put("StockState", "Stocked");
|
hashMap.put("StockState", "Stocked");
|
||||||
hashMap.put("packingState","Released");
|
hashMap.put("packingState","Released");
|
||||||
hashMap.put("oqaResultState","END");
|
hashMap.put("oqaResultState","END");
|
||||||
@ -51,12 +60,31 @@ public class NoInvoiceManagerServiceImpl {
|
|||||||
hashMap.put("erpLocation", materialPacking.getErpLocation());
|
hashMap.put("erpLocation", materialPacking.getErpLocation());
|
||||||
setEventInfo.setObjectValueUserColumns(hashMap);
|
setEventInfo.setObjectValueUserColumns(hashMap);
|
||||||
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, makeEventInfo, setEventInfo);
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("MATERIALPACKINGNAME", materialPacking.getMaterialPackingName());
|
||||||
|
map.put("CHARGE", materialPacking.getCharge());
|
||||||
|
// 物料号
|
||||||
|
map.put("MATERIALSPECNAME", materialPacking.getMaterialSpecName());
|
||||||
|
map.put("UNIT", queryForList.get(0).get("UNIT"));
|
||||||
|
map.put("PHASE", materialPacking.getPHASE());
|
||||||
|
map.put("MATERIALQUANTITY", materialPacking.getMaterialQuantity());
|
||||||
|
map.put("ERPFACTORY", materialPacking.getErpFactory());
|
||||||
|
map.put("ERPLOCATION", materialPacking.getErpLocation());
|
||||||
|
map.put("LOCATIONNAME", materialPacking.getLocationName());
|
||||||
|
mapList.add(map);
|
||||||
|
|
||||||
|
strings.add(materialPackingName);
|
||||||
}
|
}
|
||||||
String undoid = "";
|
String undoid = "";
|
||||||
// undoid = NCWServiceImpl.qtrNoInvoice(list,user,commitDate,opCode);
|
// undoid = NCWServiceImpl.qtrNoInvoice(list,user,commitDate,opCode);
|
||||||
SDKMaterialPackingServiceImpl.updateUndoIdByList(list, undoid, makeEventInfo,opCode);
|
// //调用SAP接口
|
||||||
|
undoid = toSAPServiceImpl.qtcrNoInvoiceForCheckPlanApp(mapList, qtc, user,
|
||||||
|
commitDate,opCode,costName,lifnr);
|
||||||
|
SDKMaterialPackingServiceImpl.updateUndoIdInByList(list, undoid, makeEventInfo,opCode);
|
||||||
|
|
||||||
//更新库存状态
|
//更新库存状态
|
||||||
SDKMaterialPackingServiceImpl.SaveUnDoInfo( undoid,commitDate);
|
commonUtils.SaveUnDoInfo_ForSap(strings,undoid,makeEventInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -407,7 +407,19 @@ public class SDKMaterialPackingServiceImpl extends CommonServiceDAO<MaterialPack
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void updateUndoIdInByList (List<MaterialPacking> list,String UNDOID,EventInfo eventInfo, String opCode) {
|
||||||
|
for (MaterialPacking mp : list) {
|
||||||
|
SetEventInfo setEventInfo = new SetEventInfo();
|
||||||
|
Map<String, Object> bindMap = new HashMap<String, Object>();
|
||||||
|
bindMap.put("unDoID",UNDOID);
|
||||||
|
bindMap.put("packingState","Released");
|
||||||
|
bindMap.put("stockState","Stocked");
|
||||||
|
bindMap.put("messageId",opCode);
|
||||||
|
setEventInfo.setUserColumns(bindMap);
|
||||||
|
MaterialPackingKey materialPackingKey = new MaterialPackingKey("SDK", mp.getMaterialPackingName().toString());
|
||||||
|
MaterialPackingServiceProxy.getMaterialPackingService().setEvent(materialPackingKey, eventInfo, setEventInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateUndoIdByList (List<MaterialPacking> list,String UNDOID,EventInfo eventInfo, String opCode) {
|
public void updateUndoIdByList (List<MaterialPacking> list,String UNDOID,EventInfo eventInfo, String opCode) {
|
||||||
for (MaterialPacking mp : list) {
|
for (MaterialPacking mp : list) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user