wms成品销售出库bug修改

master
mengjiao 5 months ago
parent 36cf3ed508
commit 1266436fc8

@ -351,7 +351,17 @@ public class OdsProcureOrderController extends BaseController {
odsProcureOrderService.OutboundPostingzcSAP(orderList);
return success();
}
/**
*
*
* @param orderList
* @return
*/
@PostMapping("/OutboundPostingzcSAPTS")
public AjaxResult OutboundPostingzcSAPTS(@RequestBody List<OdsProcureOutOrder> orderList) {
odsProcureOrderService.OutboundPostingzcSAPTS(orderList);
return success();
}
@PostMapping("/listCKT")
public AjaxResult listCKT(BaseWarehouse baseWarehouse) {

@ -155,4 +155,5 @@ public interface IOdsProcureOrderService {
String upbatCardXNew(OdsProcureOrder order);
void OutboundPostingzcSAPTS(List<OdsProcureOutOrder> orderList);
}

@ -1566,6 +1566,112 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
return result;
}
@Override
public void OutboundPostingzcSAPTS(List<OdsProcureOutOrder> orderList) {
//先根据出库单获取
// * 退料的移动类型为 262
// * 领料的移动类型为 261
List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectWmsOdsProcureOutOrderByIDs(orderList);
List<OdsProcureOutOrder> orderList2 = new ArrayList<>();//非反冲
List<Map<String, Object>> mapList = new ArrayList<>();//非反冲
List<SapBackflushMPQuery> sapMaterialPostingFCList = new ArrayList<>();//反冲
List<OdsProcureOutOrder> orderList2FC = new ArrayList<>();//反冲
for (OdsProcureOutOrder odsProcureOutOrder :
orderList1) {
if (!"X".equals(odsProcureOutOrder.getUserDefined3())){
Map<String, Object> map = new HashMap<>();
map.put("AUFNR", odsProcureOutOrder.getProduceCode());
map.put("PLANT", odsProcureOutOrder.getSiteCode());
String lgort = baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
map.put("LGORT", lgort);
map.put("MATNR", odsProcureOutOrder.getMaterialCode());
map.put("QUANTITY", odsProcureOutOrder.getOutNumber().toString());
map.put("MEINS", odsProcureOutOrder.getUnit());
mapList.add(map);
orderList2.add(odsProcureOutOrder);
}else {
SapBackflushMPQuery sapBackflushMPQuery = new SapBackflushMPQuery();
sapBackflushMPQuery.setPlant(odsProcureOutOrder.getSiteCode()); //工厂
String lgort = baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
sapBackflushMPQuery.setLgort(lgort);//库存地点
sapBackflushMPQuery.setMatnr(odsProcureOutOrder.getMaterialCode());//物料号
sapBackflushMPQuery.setQuantity(odsProcureOutOrder.getOutNumber().toString()); //数量
sapBackflushMPQuery.setMeins(odsProcureOutOrder.getUnit()); //基本计量单位
sapBackflushMPQuery.setBatch(odsProcureOutOrder.getUserDefined2()); //批号
sapMaterialPostingFCList.add(sapBackflushMPQuery);
orderList2FC.add(odsProcureOutOrder);
}
}
if (mapList.size() > 0) {
//非反冲过账
SapMaterialPosting sapMaterialPosting = new SapMaterialPosting();
sapMaterialPosting.setPostingType("261");
sapMaterialPosting.setMapList(mapList);
R result = remoteSapService.sapMaterialPosting(sapMaterialPosting);
OdsProcureOutOrder order = new OdsProcureOutOrder();
int code = result.getCode();
String msg = result.getMsg();
//order.setSapMaterialPostingList(sapMaterialPostingList);
order.setUserDefined11(msg);
if (code == 200) {
//过账成功
Map map = new HashMap();
map = (Map) result.getData();
String userDefined9 = (String) map.get("MATERIALDOCUMENT");
order.setUserDefined9(userDefined9);
order.setUserDefined10("2");//成功
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2);
for (OdsProcureOutOrder order1:
orderList2) {
//过账成功--减库存
List<WmsOdsMateStorageNews> odsEmStorageNews= odsProcureOutOrderMapper.selectWmsRawMissionOutByPrdAndMa(order1);
for (WmsOdsMateStorageNews wmsOdsMateStorageNews:
odsEmStorageNews) {
//wmsOdsMateStorageNews
wmsOdsMateStorageNews.setLastModifiedBy(SecurityUtils.getUsername());
wmsOdsMateStorageNewsSnMapper.updatesub(wmsOdsMateStorageNews);//库存调整
}
}
} else {
//
order.setUserDefined9("");
order.setUserDefined10("3");//失败
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2);
}
}
if (sapMaterialPostingFCList.size() > 0) {
//反冲过账
R result2 = remoteSapService.sapBackflushMP(sapMaterialPostingFCList);//x
int code = result2.getCode();
OdsProcureOutOrder order = new OdsProcureOutOrder();
String msg = result2.getMsg();
order.setUserDefined11(msg);
if (code == 200) {
//过账成功
Map map = new HashMap();
map = (Map) result2.getData();
String userDefined9 = (String) map.get("MATERIALDOCUMENT");
order.setUserDefined9(userDefined9);
order.setUserDefined10("2");//成功
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2FC);
for (OdsProcureOutOrder order1:
orderList2FC) {
//过账成功--减库存
List<WmsOdsMateStorageNews> odsEmStorageNews= odsProcureOutOrderMapper.selectWmsRawMissionOutByPrdAndMa(order1);
for (WmsOdsMateStorageNews wmsOdsMateStorageNews:
odsEmStorageNews) {
//wmsOdsMateStorageNews
wmsOdsMateStorageNews.setLastModifiedBy(SecurityUtils.getUsername());
wmsOdsMateStorageNewsSnMapper.updatesub(wmsOdsMateStorageNews);//库存调整
}
}
} else {//
order.setUserDefined9("");
order.setUserDefined10("3");//失败
odsProcureOutOrderMapper.updateWMSOdsProcureOutOrderByids(order, orderList2FC);
}
}
}
@Override

@ -214,7 +214,7 @@ public class WmsSellOutEmbryoServiceImpl implements IWmsSellOutEmbryoService {
String productCode =wmsSellOutEmbryo2.getProductCode();
BigDecimal planQuantity = wmsSellOutEmbryo2.getPlanQuantity();
List<WmsFpStorageNewsSn> wmsFpStorageNewsSns= wmsFpStorageNewsSnMapper.selectwmsFpStorageNewsGroupWaCode(productCode);
if (wmsFpStorageNewsSns.size()<1){//没有库存,就就跳过,但是要记录,对前端进行提示
if (wmsFpStorageNewsSns==null|| wmsFpStorageNewsSns.size()<1){//没有库存,就就跳过,但是要记录,对前端进行提示
ten= ten+1;
result=result+","+productCode;
continue;
@ -228,14 +228,16 @@ public class WmsSellOutEmbryoServiceImpl implements IWmsSellOutEmbryoService {
//生成一个
wmsSellOutEmbryoMapper.updateWmsSellOutEmbryoAddOut(wmsSellOutEmbryo2,planQuantity);//对订单进行修改--添加出库数量
wmsSellOutEmbryo2.setStockOrder("BH"+stock);
wmsSellOutEmbryo2.setOutQuantity(new BigDecimal("0"));
wmsSellOutEmbryo2.setWaCode(wmsFpStorageNewsSn.getWaCode());
wmsSellOutEmbryo2.setPlanQuantity(planQuantity);
wmsSellOutEmbryo2.setId(IdUtils.fastSimpleUUID());
wmsSellOutEmbryoMapper.insertWmsSellOutEmbryoOrder(wmsSellOutEmbryo2);
return result;
break ;
}else {
wmsSellOutEmbryoMapper.updateWmsSellOutEmbryoAddOut(wmsSellOutEmbryo2,tem);
wmsSellOutEmbryo2.setStockOrder("BH"+stock);
wmsSellOutEmbryo2.setOutQuantity(new BigDecimal("0"));
planQuantity = planQuantity.subtract(tem); // 用总数量减去tem更新planQuantity的值
wmsSellOutEmbryo2.setWaCode(wmsFpStorageNewsSn.getWaCode()); // 设置wmsSellOutEmbryo2的waCode为当前wmsFpStorageNewsSn的waCode
wmsSellOutEmbryo2.setPlanQuantity(tem); // 将tem的值赋给wmsSellOutEmbryo2的planQuantity

@ -583,8 +583,8 @@
WHERE
product_code like concat('%',#{productCode} ,
'%')
AND wh_code='0021' and <![CDATA[
(wms_fp_storage_news_sn.amount-wms_fp_storage_news_sn.out_amount) > 0
AND wh_code='0021' <![CDATA[
AND (amount - COALESCE(out_amount, 0)) > 0
]]>
GROUP BY
wa_code,

@ -101,7 +101,8 @@
<if test="productName != null and productName != ''">and product_name like concat('%', #{productName},
'%')
</if>
<if test="productCode != null and productCode != ''">and product_code = #{productCode}</if>
<if test="productCode != null and productCode != ''">and product_code like concat('%', #{productCode},
'%') </if>
<if test="productSort != null and productSort != ''">and product_sort = #{productSort}</if>
<if test="specification != null and specification != ''">and specification = #{specification}</if>
<if test="unitOfMeasure != null and unitOfMeasure != ''">and unit_of_measure = #{unitOfMeasure}</if>

Loading…
Cancel
Save