wms修改8

master
mengjiao 1 year ago
parent 2107a05e82
commit 27f8051c7c

@ -73,6 +73,7 @@ public interface RemoteSapService {
public R sapBackflushMP(List<SapBackflushMPQuery> sapBackflushMPQueryList);
/**订单物料领料过账、原材料补料、订单物料退料过账接口MB1A**/
@PostMapping("/sap/sapMaterialPosting")
public R sapMaterialPosting(@RequestBody List<SapMaterialPosting> sapMaterialPostingList);
/**智慧工厂储位信息*/

@ -255,6 +255,7 @@ public class OdsProcureOrderController extends BaseController {
List<OdsProcureOutOrder> result= odsProcureOrderService.ProductionMaterialRequisition(odsProcureOutOrder);
return success(result);
}
/**
* --
* @param wmsOdsMateStorageNewsSn
@ -277,4 +278,15 @@ public class OdsProcureOrderController extends BaseController {
Integer result= odsProcureOrderService.ProductionMaterialRequisitionAdd(orderList);
return success(result);
}
/**
*
* @param orderList
* @return
*/
@PostMapping("/OutboundPostingSAP")
public AjaxResult OutboundPostingSAP(@RequestBody List<OdsProcureOutOrder> orderList) {
odsProcureOrderService.OutboundPostingSAP(orderList);
return success();
}
}

@ -152,5 +152,34 @@ public WmsToWCSDTO packingMaterialsOutBoundCompleted(@RequestBody WmsToWCSDTO wc
List<OdsProcureOutOrder> result= odsProcureOrderService.ProductionMaterialRequisition(odsProcureOutOrder);
return success(result);
}
/**
* --
* @param wmsOdsMateStorageNewsSn
* @return
*/
@PostMapping("/ProductionMaterialRequisitionsn")
public AjaxResult ProductionMaterialRequisitionsn(@RequestBody WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn) {
WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn1= odsProcureOrderService.ProductionMaterialRequisitionsn(wmsOdsMateStorageNewsSn);
return success(wmsOdsMateStorageNewsSn1);
}
/**
*
* @param orderList
* @return
*/
@PostMapping("/OutboundPostingSAP")
public AjaxResult OutboundPostingSAP(@RequestBody List<OdsProcureOutOrder> orderList) {
odsProcureOrderService.OutboundPostingSAP(orderList);
return success();
}
/**
* --
* @param orderList
* @return
*/
@PostMapping("/ProductionMaterialRequisitionAdd")
public AjaxResult ProductionMaterialRequisitionAdd(@RequestBody List<OdsProcureOutOrder> orderList) {
Integer result= odsProcureOrderService.ProductionMaterialRequisitionAdd(orderList);
return success(result);
}
}

@ -66,6 +66,16 @@ public class OdsProcureOutOrder extends BaseEntity {
@Excel(name = "计划数量")
private BigDecimal planNumber;
private String sn;
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
/** 单位 */
@Excel(name = "单位")
private String Unit;

@ -30,6 +30,15 @@ public class OrderLine extends BaseEntity {
private String siteCode;
private String unit;
private String userDefined2;
private String userDefined3;
public String getUserDefined3() {
return userDefined3;
}
public void setUserDefined3(String userDefined3) {
this.userDefined3 = userDefined3;
}
public String getMaterialCode() {
return materialCode;

@ -7,14 +7,14 @@ import com.op.wms.domain.BaseWarehouse;
/**
* Mapper
*
*
* @author Open Platform
* @date 2023-07-04
*/
public interface BaseWarehouseMapper {
/**
*
*
*
* @param warehouseId
* @return
*/
@ -22,7 +22,7 @@ public interface BaseWarehouseMapper {
/**
*
*
*
* @param baseWarehouse
* @return
*/
@ -30,7 +30,7 @@ public interface BaseWarehouseMapper {
/**
*
*
*
* @param baseWarehouse
* @return
*/
@ -38,7 +38,7 @@ public interface BaseWarehouseMapper {
/**
*
*
*
* @param baseWarehouse
* @return
*/
@ -46,7 +46,7 @@ public interface BaseWarehouseMapper {
/**
*
*
*
* @param warehouseId
* @return
*/
@ -54,7 +54,7 @@ public interface BaseWarehouseMapper {
/**
*
*
*
* @param warehouseIds
* @return
*/
@ -64,4 +64,6 @@ public interface BaseWarehouseMapper {
String checkWarehouseCodeUnique(BaseWarehouse baseWarehouse);
String checkWarehouseNameUnique(BaseWarehouse baseWarehouse);
String selectByCode(String locCode);
}

@ -3,6 +3,7 @@ package com.op.wms.mapper;
import java.util.List;
import com.op.wms.domain.OdsProcureOutOrder;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -62,4 +63,10 @@ public interface OdsProcureOutOrderMapper {
OdsProcureOutOrder selectmesPrepare(OdsProcureOutOrder odsProcureOrder);
List<OdsProcureOutOrder> selectmesPrepareDetail(OdsProcureOutOrder odsProcureOutOrder);
void insertWmsRawMissionOut(OdsProcureOutOrder order);
void updateOdsProcureOutOrderByid(OdsProcureOutOrder odsProcureOutOrder);
List<OdsProcureOutOrder> selectOdsProcureOutOrderListByIds(@Param("list") List<OdsProcureOutOrder> orderList);
}

@ -88,4 +88,6 @@ public interface IOdsProcureOrderService {
Integer ProductionMaterialRequisitionAdd(List<OdsProcureOutOrder> orderList);
WmsOdsMateStorageNewsSn ProductionMaterialRequisitionsn(WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn);
void OutboundPostingSAP(List<OdsProcureOutOrder> odsProcureOutOrder);
}

@ -17,7 +17,10 @@ import java.util.List;
import com.op.common.core.domain.R;
import com.op.common.security.utils.SecurityUtils;
import com.op.system.api.RemoteSapService;
import com.op.system.api.domain.sap.SapBackflushMPQuery;
import com.op.system.api.domain.sap.SapMaterialPosting;
import okhttp3.OkHttpClient;
import okhttp3.MediaType;
import okhttp3.RequestBody;
@ -53,7 +56,11 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
private WmsOdsMateStorageNewsMapper wmsOdsMateStorageNewsMapper;
@Autowired
private OdsProcureOutOrderMapper odsProcureOutOrderMapper;
@Autowired
private RemoteSapService remoteSapService;
@Autowired
private BaseWarehouseMapper baseWarehouseMapper;
/**
*
*
@ -262,7 +269,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
public OrderLine addPurchaseOrderOutbound(OrderLine orderLine) {
//自己生成行项目,,批次号
List<OrderLine> orderList= orderLine.getList();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm:ss");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String formattedDate = dateFormat.format(date);
//根据订单号查询对应的最大批次号
@ -280,7 +287,9 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
orderList) {
OdsProcureOutOrder odsProcureOutOrder=new OdsProcureOutOrder();
odsProcureOutOrder.setID(IdUtils.fastSimpleUUID());
odsProcureOutOrder.setSiteCode(orderLine1.getSiteCode());
odsProcureOutOrder.setProduceCode(orderLine.getOrderNo());
odsProcureOutOrder.setLocCode(orderLine.getWarehouseNo());
odsProcureOutOrder.setMaterialCode(orderLine1.getMaterialCode());
odsProcureOutOrder.setMaterialDesc(orderLine1.getMaterialDesc());
odsProcureOutOrder.setPlanDate(new Date());
@ -291,6 +300,8 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
odsProcureOutOrder.setOrderStatus("1");
odsProcureOutOrder.setPlanNumber(orderLine1.getPlanNumber());
odsProcureOutOrder.setUserDefined2(orderLine1.getOrderLineNo());
odsProcureOutOrder.setUserDefined3(orderLine1.getUserDefined3());
odsProcureOutOrder.setUserDefined10("1");
//odsProcureOutOrder.set
odsProcureOutOrderMapper.insertOdsProcureOutOrder(odsProcureOutOrder);
}
@ -301,7 +312,9 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
orderList) {
OdsProcureOutOrder odsProcureOutOrder=new OdsProcureOutOrder();
odsProcureOutOrder.setID(IdUtils.fastSimpleUUID());
odsProcureOutOrder.setLocCode(orderLine.getWarehouseNo());
odsProcureOutOrder.setProduceCode(orderLine.getOrderNo());
odsProcureOutOrder.setSiteCode(orderLine1.getSiteCode());
odsProcureOutOrder.setMaterialCode(orderLine1.getMaterialCode());
odsProcureOutOrder.setMaterialDesc(orderLine1.getMaterialDesc());
odsProcureOutOrder.setPlanDate(new Date());
@ -310,9 +323,11 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
odsProcureOutOrder.setUserDefined1(orderLine1.getBatchNo());
odsProcureOutOrder.setActive("1");
odsProcureOutOrder.setOrderStatus("1");
odsProcureOutOrder.setUserDefined10("1");
odsProcureOutOrder.setPlanNumber(orderLine1.getPlanNumber());
odsProcureOutOrder.setUserDefined2(orderLine1.getOrderLineNo());
//odsProcureOutOrder.set
odsProcureOutOrder.setUserDefined3(orderLine1.getUserDefined3());
odsProcureOutOrderMapper.insertOdsProcureOutOrder(odsProcureOutOrder);
}
}
@ -441,10 +456,64 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
//修改对应订单--插入对应出库托盘数据数据
// for (OdsProcureOutOrder odsProcureOutOrder:
// orderList) {
// //领料单,物料编号,物料名称,托盘号,出库数量,库位号,
// //领料单,物料编号,领料单批次,物料名称,托盘号,出库数量,库位号,
// odsProcureOutOrder.
// }
String factoryCode =orderList.get(0).getFactoryCode();
DynamicDataSourceContextHolder.push("ds_" +factoryCode);
for (OdsProcureOutOrder odsProcureOutOrder:
orderList) {
//领料单,物料编号,领料单批次,物料名称,托盘号,出库数量,库位号,
WmsToWCSDTO wcsdto =new WmsToWCSDTO();
wcsdto.setRfidNo(odsProcureOutOrder.getSn());
WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn= wmsOdsMateStorageNewsSnMapper.selectwmsRfidNotwo(wcsdto);
//明细
//wms_raw_mission_out--保存
//ods_procure_out_order--修改
WCSInventoryPlan wcsInventoryPlan=new WCSInventoryPlan();
wcsInventoryPlan.setSku(odsProcureOutOrder.getMaterialCode());
WmsOdsMateStorageNews wmsOdsMateStorageNews= wmsOdsMateStorageNewsMapper.selectBaseProductByCode(wcsInventoryPlan);
OdsProcureOutOrder order=new OdsProcureOutOrder();
order.setProduceCode(odsProcureOutOrder.getProduceCode());//领料单
order.setMaterialCode(odsProcureOutOrder.getMaterialCode());//
order.setMaterialDesc(odsProcureOutOrder.getMaterialDesc());
order.setUserDefined1(odsProcureOutOrder.getUserDefined1());//批次
order.setSn(odsProcureOutOrder.getSn());
order.setPlanNumber(odsProcureOutOrder.getPlanNumber());
order.setLocCode(odsProcureOutOrder.getLocCode());
order.setID(IdUtils.fastSimpleUUID());
order.setUnit(wmsOdsMateStorageNews.getUserDefined1());
order.setFactoryCode(factoryCode);
order.setActive("1");
order.setCreateBy(SecurityUtils.getUsername());
order.setCreateDate(new Date());
odsProcureOutOrderMapper.insertWmsRawMissionOut(order);
OdsProcureOutOrder odsProcureOutOrder1= odsProcureOutOrderMapper.selectOdsProcureOutOrderByID(odsProcureOutOrder.getID());
BigDecimal realityNumber1 = odsProcureOutOrder1.getOutNumber();//累计数
BigDecimal realityNumber = odsProcureOutOrder1.getPlanNumber();//计划
BigDecimal planNumber =odsProcureOutOrder.getPlanNumber();
BigDecimal tem= realityNumber1.add(planNumber);
boolean isEqual = tem.equals(realityNumber);
if (isEqual){
odsProcureOutOrder1.setOrderStatus("3");
}else {
odsProcureOutOrder1.setOrderStatus("2");
}
odsProcureOutOrder1.setOutNumber(tem);
odsProcureOutOrderMapper.updateOdsProcureOutOrder(odsProcureOutOrder1);
WmsOdsEmStorageNews wmsOdsEmStorageNews=new WmsOdsEmStorageNews();
wmsOdsEmStorageNews.setWhCode(wmsOdsMateStorageNewsSn.getWhCode());//仓库编码
wmsOdsEmStorageNews.setWlCode(wmsOdsMateStorageNewsSn.getWlCode());//库位编码
wmsOdsEmStorageNews.setMaterialCode(wmsOdsMateStorageNewsSn.getMaterialCode());
wmsOdsEmStorageNews.setAmount(wmsOdsMateStorageNewsSn.getAmount());//库存
wmsOdsMateStorageNewsSnMapper.updatekdd(wmsOdsEmStorageNews);//库存调整
wmsOdsMateStorageNewsSn.setUserDefined1("1");
wmsOdsMateStorageNewsSnMapper.updateWmsOdsMateStorageNewsSn(wmsOdsMateStorageNewsSn);//库存明细
}
return null;
}
@ -457,6 +526,70 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
return wmsOdsMateStorageNewsSn1;
}
@Override
@DS("#header.poolName")
public void OutboundPostingSAP(List<OdsProcureOutOrder> orderList) {
// * 退料的移动类型为 262
// * 领料的移动类型为 261
List<OdsProcureOutOrder> orderList1=odsProcureOutOrderMapper.selectOdsProcureOutOrderListByIds(orderList);
for (OdsProcureOutOrder odsProcureOutOrder:
orderList1) {
//取sap仓库号
if ("X".equals(odsProcureOutOrder.getUserDefined3())){
List<SapBackflushMPQuery> sapBackflushMPQueryList=new ArrayList<>();
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()); //批号
sapBackflushMPQueryList.add(sapBackflushMPQuery);
R result2= remoteSapService.sapBackflushMP(sapBackflushMPQueryList);//x
int code= result2.getCode();
String msg= result2.getMsg();
odsProcureOutOrder.setUserDefined11(msg);
if (code==200){//过账成功
odsProcureOutOrder.setUserDefined10("2");//成功
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
}else {//
odsProcureOutOrder.setUserDefined10("3");//失败
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
}
}else {
List<SapMaterialPosting> sapMaterialPostingList=new ArrayList<>();
SapMaterialPosting sapMaterialPosting =new SapMaterialPosting();
sapMaterialPosting.setAufnr(odsProcureOutOrder.getProduceCode());//订单号
sapMaterialPosting.setBwart("261"); //移动类型
sapMaterialPosting.setPlant(odsProcureOutOrder.getSiteCode()); //工厂
String lgort= baseWarehouseMapper.selectByCode(odsProcureOutOrder.getLocCode());
sapMaterialPosting.setLgort(lgort);//库存地点
sapMaterialPosting.setMatnr(odsProcureOutOrder.getMaterialCode());//物料号
sapMaterialPosting.setQuantity(odsProcureOutOrder.getOutNumber().toString()); //数量
sapMaterialPosting.setMeins(odsProcureOutOrder.getUnit()); //基本计量单位
sapMaterialPosting.setBatch(odsProcureOutOrder.getUserDefined2()); //批号
sapMaterialPostingList.add(sapMaterialPosting);
R result= remoteSapService.sapMaterialPosting(sapMaterialPostingList);
int code= result.getCode();
String msg= result.getMsg();
odsProcureOutOrder.setUserDefined11(msg);
if (code==200){//过账成功
odsProcureOutOrder.setUserDefined10("2");//成功
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
}else {//
odsProcureOutOrder.setUserDefined10("3");//失败
odsProcureOutOrderMapper.updateOdsProcureOutOrderByid(odsProcureOutOrder);
}
}
}
}
public String DesignatedPalletOutboundWCS(WMSDesignatedPalle wmsDesignatedPalle){
// 定义请求的URL地址
String url = "http://192.168.202.37:9001/api/v1/ReceiveMesMsg/packingMaterialsOutBoundByPallet";

@ -128,7 +128,7 @@ public class WmsToWCSmissionServiceImpl implements IWmsToWCSmissionService {
*/
@Override
public WmsToWCSDTO packingMaterialsOutBoundCompleted(WmsToWCSDTO wcsdto) {
//记录明细消减库存
//记录明细消减库存--wms_raw_mission_out-
DynamicDataSourceContextHolder.push("ds_" + wcsdto.getFactory());
WmsOdsMateStorageNewsSn wmsOdsMateStorageNewsSn= wmsOdsMateStorageNewsSnMapper.selectwmsRfidNotwo(wcsdto);

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.wms.mapper.BaseWarehouseMapper">
<resultMap type="BaseWarehouse" id="BaseWarehouseResult">
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseType" column="warehouse_type" />
@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBaseWarehouseList" parameterType="BaseWarehouse" resultMap="BaseWarehouseResult">
<include refid="selectBaseWarehouseVo"/>
<where>
<where>
<if test="warehouseType != null and warehouseType != ''"> and warehouse_type like concat('%', #{warehouseType}, '%')</if>
<if test="warehouseCode != null and warehouseCode != ''"> and warehouse_code like concat('%', #{warehouseCode}, '%')</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
@ -50,13 +50,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and del_flag = '0'
</where>
</select>
<select id="selectBaseWarehouseByWarehouseId" parameterType="String" resultMap="BaseWarehouseResult">
<include refid="selectBaseWarehouseVo"/>
where warehouse_id = #{warehouseId}
and del_flag = '0'
</select>
<insert id="insertBaseWarehouse" parameterType="BaseWarehouse">
insert into base_warehouse
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -162,5 +162,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where warehouse_code = #{warehouseCode}
and del_flag = '0'
</select>
</mapper>
<select id="selectByCode" resultType ="java.lang.String">
select DISTINCT user_defined1
from base_warehouse
where warehouse_code = #{locCode}
and del_flag = '0'
</select>
</mapper>

@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectOdsProcureOutOrderVo">
select Site_code, ID, Produce_Code, Material_Code, Material_Desc, Plan_Date, Plan_Number, Unit, 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 ods_procure_out_order
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 ods_procure_out_order
</sql>
<select id="selectOdsProcureOutOrderList" parameterType="OdsProcureOutOrder" resultMap="OdsProcureOutOrderResult">
@ -236,9 +236,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
prod_type User_Defined1,
unit Unit,
quantity Plan_Number,
recoil User_Defined3,
factory_code Site_code
FROM mes_prepare_detail
WHERE prepare_id=#{ID}
</select>
<insert id="insertWmsRawMissionOut" >
insert into wms_raw_mission_out(id,
prd_order,
material_code,
material_desc,
unit,
user_defined1,
sn,
amount,
origin_location,
factory_code,
active_flag,
create_by,
gmt_create
)values (
#{ID},
#{produceCode},
#{materialCode},
#{materialDesc},
#{Unit},
#{userDefined1},
#{sn},
#{planNumber},
#{locCode},
#{factoryCode},
#{Active},
#{createBy},
#{createDate} )
</insert>
<update id="updateOdsProcureOutOrderByid">
update ods_procure_out_order
set User_Defined10 = #{userDefined10},
User_Defined11 = #{userDefined11}
where ID = #{ID}
</update>
<select id="selectOdsProcureOutOrderListByIds" resultMap="OdsProcureOutOrderResult">
<include refid="selectOdsProcureOutOrderVo"/>
WHERE
<![CDATA[ Order_Status = '3' and (User_Defined10 <> '2' OR User_Defined10 is NULL ) ]]>
and ID in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item.ID}
</foreach>
</select>
</mapper>

Loading…
Cancel
Save