wms过账问题

master
mengjiao 3 weeks ago
parent bba11a3338
commit 1073cad2df

@ -146,6 +146,8 @@ public interface RemoteSapService {
public R handleUpdateSAP105(@RequestBody(required = false)List<Map> mapList);
@PostMapping("/sap/handleUpdateSAP102")
public R handleUpdateSAP102(@RequestBody(required = false)List<Map> mapList);
@PostMapping("/sap/sapProductOutboundCostTW")
public R sapProductOutboundCostTW(@RequestBody(required = false) List<Map> mapList) ;
}

@ -173,6 +173,11 @@ public class RemoteSapFallbackFactory implements FallbackFactory<RemoteSapServic
return R.fail("102的冲销失败" + throwable.getMessage());
}
@Override
public R sapProductOutboundCostTW(List<Map> mapList) {
return R.fail("内部订单的收货过账失败" + throwable.getMessage());
}
};
}
}

@ -494,7 +494,7 @@ public class SapController extends BaseController {
@PostMapping("/sapProductOutboundCostTW")
@Log(title = "有关内部订单的收货", businessType = BusinessType.SAP)
public R sapProductOutboundCostTW(@RequestBody(required = false) List<Map<String, Object>> mapList) {
return sapWmsService.sapProductOutboundCostCenter(mapList);
return sapWmsService.sapProductOutboundCostTW(mapList);
}

@ -12,4 +12,6 @@ public interface SapWmsService {
R sapProductWarehousing(List<Map<String, Object>> mapList);
R sapProductOutboundCostCenter(List<Map<String, Object>> mapList);
R sapProductOutboundCostTW(List<Map<String, Object>> mapList);
}

@ -211,6 +211,87 @@ public class SapWmsServicelmpl implements SapWmsService {
}
String L_MSG = func.getExportParameterList().getString("L_MSG");
String RETCODE = func.getExportParameterList().getString("RETCODE");
String MATERIALDOCUMENT = func.getExportParameterList().getString("MATERIALDOCUMENT");
String MATDOCUMENTYEAR = func.getExportParameterList().getString("MATDOCUMENTYEAR");
System.out.println("L_MSG" + L_MSG);
System.out.println("返回值0-没有错误1-有错误:" + RETCODE);
System.out.println("物料凭证编号" + MATERIALDOCUMENT);
System.out.println("物料凭证年度" + MATDOCUMENTYEAR);
if (!("0").equals(RETCODE)) {
return R.fail("", Msg.toString());
} else {
Map map = new HashMap();
map.put("MATERIALDOCUMENT", MATERIALDOCUMENT);
map.put("MATDOCUMENTYEAR", MATDOCUMENTYEAR);
return R.ok(map, Msg.toString());
}
} catch (Exception e) {
log.error(e.getMessage());
return R.fail(e.getMessage());
}
}
@Override
public R sapProductOutboundCostTW(List<Map<String, Object>> mapList) {
try {
JCoRepository repository = dest.getRepository();
JCoFunction func = repository.getFunction("ZMES_961_MB1A");
if (func == null) {
throw new RuntimeException("Function does not exist in SAP");
}
log.info("成品ZMES_201_MB1A-------" + mapList.toString());
/**
AUFNR
POSNR
BWART
PLANT
LGORT
KOSTL
MATNR
QUANTITY
MEINS
BATCH
HSDAT
VFDAT 寿
LGORT CHAR 4 0
MATNR CHAR 18 0
QUANTITY QUAN 13 3
MEINS UNIT 3 0
BATCH CHAR 10 0
PROD_DATE DATS 8 0
EXPIRYDATE DATS 8 0 寿
*/
JCoTable L_ITEM = func.getTableParameterList().getTable("L_ITEM");
for (Map<String, Object> stringObjectMap : mapList) {
L_ITEM.appendRow();
L_ITEM.setValue("COSTCENTER", stringObjectMap.get("COSTCENTER"));//成本中心
L_ITEM.setValue("PLANT", stringObjectMap.get("PLANT"));//工厂
L_ITEM.setValue("LGORT", stringObjectMap.get("LGORT"));//库存地点
L_ITEM.setValue("MATNR", stringObjectMap.get("MATNR"));//物料号
L_ITEM.setValue("QUANTITY", stringObjectMap.get("QUANTITY"));//数量
L_ITEM.setValue("MEINS", stringObjectMap.get("MEINS"));//条目单位
L_ITEM.setValue("BATCH", stringObjectMap.get("BATCH"));//批号
L_ITEM.setValue("PROD_DATE", stringObjectMap.get("PROD_DATE"));//生产日期
L_ITEM.setValue("EXPIRYDATE", stringObjectMap.get("EXPIRYDATE"));//货架寿命到期日
}
System.out.println(L_ITEM);
func.execute(dest);//执行调用函数
// 获取 内表 - ZMES_PRO
JCoTable LT_RETURN = func.getTableParameterList().getTable("LT_RETURN");
StringBuilder Msg = new StringBuilder();
for (int i = 0; i < LT_RETURN.getNumRows(); i++) {
LT_RETURN.setRow(i);
String MESSAGE = LT_RETURN.getString("MESSAGE");
Msg.append(MESSAGE + "/");
}
String L_MSG = func.getExportParameterList().getString("L_MSG");
String RETCODE = func.getExportParameterList().getString("RETCODE");
String MATERIALDOCUMENT = func.getExportParameterList().getString("MATERIALDOCUMENT");

@ -71,6 +71,12 @@ public class OdsProcureOutOrderController extends BaseController {
List<OdsProcureOutOrder> list = odsProcureOutOrderService.selectOdsProcureOutOrderListZC(odsProcureOutOrder);
return getDataTable(list);
}
@PostMapping("/listZCTC")
public TableDataInfo listZCTC(OdsProcureOutOrder odsProcureOutOrder) {
startPage();
List<OdsProcureOutOrder> list = odsProcureOutOrderService.selectOdsProcureOutOrderListZCTC(odsProcureOutOrder);
return getDataTable(list);
}
/**
*
*/

@ -117,7 +117,7 @@ public interface OdsProcureOutOrderMapper {
public void updateWmsOdsProcureOutOrder(OdsProcureOutOrder odsProcureOutOrder1);
public List<OdsProcureOutOrder> selectOdsProcureOutOrderListZC(OdsProcureOutOrder odsProcureOutOrder);
public List<OdsProcureOutOrder> selectOdsProcureOutOrderListZCTW(OdsProcureOutOrder odsProcureOutOrder);
public List<OdsProcureOutOrder> selectWmsOdsProcureOutOrderByIDs(@Param("list") List<OdsProcureOutOrder> orderList);
public void updateWMSOdsProcureOutOrderByids(@Param("order") OdsProcureOutOrder order, @Param("list") List<OdsProcureOutOrder> sapMaterialPostingList);
@ -175,4 +175,8 @@ public interface OdsProcureOutOrderMapper {
List<OdsProcureOutOrder> selectWmsOdsProcureReturnOrderByproduceCode(@Param("order")OdsProcureOutOrder order);
List<OdsProcureOutOrder> selectWmsOdsProcureOutOrderByIDsTS(List<OdsProcureOutOrder> orderList);
void updateWMSOdsProcureOutOrdersapSpecialById(OdsProcureOutOrder order1);
void updateWMSOdsProcureOutOrdersapSpecialTWById(OdsProcureOutOrder order1);
}

@ -86,4 +86,6 @@ public interface IOdsProcureOutOrderService {
String OdsProcureOutOrderTSCK(OdsProcureOutOrder order);
String addwmsFpStorageNewsTS(List<OdsProcureOutOrder> orderList);
List<OdsProcureOutOrder> selectOdsProcureOutOrderListZCTC(OdsProcureOutOrder odsProcureOutOrder);
}

@ -154,10 +154,10 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
@Override
@DS("#header.poolName")
public List<OdsProcureOutOrder> selectOdsProcureOutOrderListZC(OdsProcureOutOrder odsProcureOutOrder) {
odsProcureOutOrder.setUserDefined3("X");
List<OdsProcureOutOrder> orderList = odsProcureOutOrderMapper.selectOdsProcureOutOrderListZC(odsProcureOutOrder);
for (OdsProcureOutOrder order:
orderList) {
if (order.getUserDefined4().length()>10){
String tem= odsProcureOutOrderMapper.selectMesReportWorkConsume(order);
if(tem==null){
order.setBGNumber(new BigDecimal("0"));
@ -165,13 +165,6 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
order.setBGNumber(new BigDecimal(tem));
}
}else {
//这个反冲的
List<OdsProcureOutOrder> odsProcureOutOrderList=odsProcureOutOrderMapper.selectMesReportWorkConsumeFC(order.getUserDefined4(),order.getMaterialCode());
if (odsProcureOutOrderList.size()>0){
order.setBGNumber( odsProcureOutOrderList.get(0).getPlanNumber());
}
}
}
return orderList;
@ -310,6 +303,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
// factoryCode工厂号
// createBy操作人
// "produceCode":
String ID="";
if(orderList.size()>0){
String factoryCode = orderList.get(0).getFactoryCode();
DynamicDataSourceContextHolder.push("ds_" + factoryCode);
@ -346,6 +340,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
odsProcureOutOrder1.setMaterialCode(materialCode);
List<OdsProcureOutOrder> odsProcureOutOrders = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderSpecial(odsProcureOutOrder1);
//包材出库单----会有特殊的那种二次过账的单子--就看前端会不会传对应的标识卡了
ID=odsProcureOutOrders.get(0).getID();
OdsProcureOutOrder order1= odsProcureOutOrders.get(0);
order.setUserDefined4(order1.getUserDefined4());
//出库明细
@ -358,7 +353,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
if (tem.compareTo(realityNumber)>= 0) {
order1.setOrderStatus("3");//3是满足出库数量
} else {
order1.setOrderStatus("2");
order1.setOrderStatus("2");//进行
}
order1.setOutNumber(tem);//这样的话就可以用已经过账的数量来计算要过账的数量用出库数量减去已经过账的数量就是要过账的数量只要不为0就可以进行
@ -380,13 +375,13 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
}
}
OdsProcureOutOrder order=new OdsProcureOutOrder();
order.setID(ID);
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByOrderStatusSpecial(order);
if (orderList1.size()>0){
OutboundPostingzcSAPGYTS(orderList1);
}
// if (orderList1.size()>0){
// OutboundPostingzcSAPGYTS(orderList1);
// }
if (gzList.size()>0) {
for (OdsProcureOutOrder order1:
gzList) {
@ -451,9 +446,26 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
return results;
}
@Override
public List<OdsProcureOutOrder> selectOdsProcureOutOrderListZCTC(OdsProcureOutOrder odsProcureOutOrder) {
odsProcureOutOrder.setUserDefined3("X");
List<OdsProcureOutOrder> orderList = odsProcureOutOrderMapper.selectOdsProcureOutOrderListZCTW(odsProcureOutOrder);
for (OdsProcureOutOrder order:
orderList) {
String tem= odsProcureOutOrderMapper.selectMesReportWorkConsume(order);
if(tem==null){
order.setBGNumber(new BigDecimal("0"));
}else {
order.setBGNumber(new BigDecimal(tem));
}
}
return orderList;
}
public void OutboundPostingzcSAPGYTS(List<OdsProcureOutOrder> orderList) {
//先根据出库单获取
//
// -- and wms_ods_procure_out_order.Order_Status='3'
//我把过账状态-- and wms_ods_procure_out_order.User_Defined10!='2'去掉了
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderSpecialByIDs(orderList);
@ -462,7 +474,9 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
if ("成本中心".equals(orderList1.get(0).getUserDefined6())){//区分出来内部订单
Map paramMap=new HashMap<>();
List<Map> mapList = new ArrayList<>();
paramMap.put("GL_ACCOUNT", order.getUserDefined2());//总帐科目编号
paramMap.put("COSTCENTER", order.getUserDefined3());//成本中心
paramMap.put("GR_RCPT", order.getUserDefined4());//收货方/运达方
paramMap.put("PLANT", order.getSiteCode());//工厂
paramMap.put("LGORT", order.getLocCode());//库存地点
paramMap.put("MATNR", order.getMaterialCode());//物料号
@ -483,14 +497,24 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
Map map = new HashMap();
map = (Map) result2.getData();
String userDefined9 = (String) map.get("MATERIALDOCUMENT");
order.setUserDefined9(userDefined9);
order.setUserDefined10("2");//成功
//order.setUserDefined9(userDefined9);
// order.setUserDefined10("2");//成功
// for (OdsProcureOutOrder order2:
// orderList2 ) {
// BigDecimal sapNumber= order1.getSapNumber();
// order1.setSapNumber(sapNumber.add(order1.getOutNumber()));//成功..这个是否的outNumber是用已出库减去已经过账的数量
// odsProcureOutOrderMapper.updateWMSOdsProcureOutOrdersapById(order1);
order1.setID(order.getID());
order1.setSapNumber(order.getOutNumber());//成功..这个是否的outNumber是用已出库减去已经过账的数量
order1.setUserDefined10("2");//1是未过账2是成功3是失败
order1.setUserDefined9(userDefined9);//凭证
order1.setUserDefined11(msg);//信息
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrdersapSpecialById(order1);
// }
}else {
order1.setID(order.getID());
// order1.setSapNumber(order.getOutNumber());//成功..这个是否的outNumber是用已出库减去已经过账的数量
order1.setUserDefined10("3");//1是未过账2是成功3是失败
// order1.setUserDefined9(userDefined9);//凭证
order1.setUserDefined11(msg);//信息
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrdersapSpecialTWById(order1);
}
//这个地方需要对
}else {
@ -508,6 +532,7 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService
paramMap.put("EXPIRYDATE", order.getUserDefined5());//货架寿命到期日
mapList.add(paramMap);
// R result2 = remoteSapService.sapProductOutboundCostTWO(mapList);
R result2 = remoteSapService.sapProductOutboundCostTW(mapList);
}
}

@ -1218,6 +1218,53 @@
</where>
ORDER BY Create_Date DESC
</select>
<select id="selectOdsProcureOutOrderListZCTW" parameterType="OdsProcureOutOrder" resultMap="OdsProcureOutOrderResult">
SELECT
Site_code,
ID,
Produce_Code,
Material_Code,
Material_Desc,
Plan_Date,
Plan_Number,
Unit,
COALESCE ( Out_Number, 0 ) AS Out_Number,
Loc_Code,
Loc_Desc,
Production_Line_Desc,
Production_Line_Code,
Order_Status,
User_Defined1,
User_Defined2,
User_Defined3,
User_Defined4,
User_Defined5,
User_Defined6,
User_Defined7,
User_Defined8,
User_Defined9,
User_Defined10,
User_Defined11,
Supplier_Code,
Supplier_Name,
Create_By,
Create_Date,
Last_Update_By,
Last_Update_Date,
Active,
Enterprise_Id,
Enterprise_Code
FROM
wms_ods_procure_out_order
<where>
<if test="produceCode != null and produceCode != ''"> and Produce_Code like concat('%', #{produceCode}, '%')</if>
<if test="userDefined3 != null and userDefined3 != ''"> <![CDATA[ and User_Defined3 <> #{userDefined3} ]]> </if>
<if test="materialCode != null and materialCode != ''"> and Material_Code like concat('%', #{materialCode}, '%')</if>
<if test="userDefined4 != null and userDefined4 != ''"> and User_Defined4 like concat('%', #{userDefined4}, '%') </if>
<if test="Active != null and Active != ''"> and Active = #{Active}</if>
</where>
ORDER BY Create_Date DESC
</select>
<select id="selectWmsRawMissionOutByPrdAndMa" resultType="com.op.wms.domain.WmsOdsMateStorageNews">
SELECT
id storageId,
@ -1454,7 +1501,7 @@
<if test="enterpriseId != null and enterpriseId != ''"> and Enterprise_Id = #{enterpriseId}</if>
<if test="enterpriseCode != null and enterpriseCode != ''"> and Enterprise_Code = #{enterpriseCode}</if>
</where>
ORDER BY Create_Date DESC
ORDER BY User_Defined4 DESC
</select>
<select id="insertWmsOdsProcureReturnOrder" parameterType="OdsProcureOutOrder">
insert into wms_ods_procure_return_order
@ -1575,6 +1622,20 @@
set Sap_Number = #{sapNumber}
where ID = #{ID}
</update>
<update id="updateWMSOdsProcureOutOrdersapSpecialById" >
update wms_ods_procure_out_order_special
set Sap_Number = #{sapNumber},
User_Defined9 = #{userDefined9},
User_Defined10 = #{userDefined10},
User_Defined11 = #{userDefined11}
where ID = #{ID}
</update>
<update id="updateWMSOdsProcureOutOrdersapSpecialTWById" >
update wms_ods_procure_out_order_special
set User_Defined10 = #{userDefined10},
User_Defined11 = #{userDefined11}
where ID = #{ID}
</update>
<select id="listckTS" parameterType="OdsProcureOutOrder" resultMap="OdsProcureOutOrderResult">
SELECT
Site_code,
@ -1936,7 +1997,7 @@
wms_ods_procure_out_order_special
where Order_Status='3' and Active='1'
and User_Defined10='1'
and ID=#{ID}
</select>
<update id="updateWmsOdsProcureOutOrderSpecial" parameterType="OdsProcureOutOrder">
update wms_ods_procure_out_order_special

Loading…
Cancel
Save