diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java index 77124768..6fe0b484 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOrderController.java @@ -186,9 +186,29 @@ public class OdsProcureOrderController extends BaseController { OdsProcureOutOrder orderList = odsProcureOrderService.PurchaseOrderOutboundPda(odsProcureOrder); return success(orderList); } - + /** + * 用于出库任务页面--查询 fc + * + * @param odsProcureOrder + * @return + */ + @PostMapping("/PurchaseOrderOutboundPdafc") + public AjaxResult PurchaseOrderOutboundPdafc(@RequestBody OdsProcureOutOrder odsProcureOrder) { + OdsProcureOutOrder orderList = odsProcureOrderService.PurchaseOrderOutboundPdafc(odsProcureOrder); + return success(orderList); + } //** - + /** + * 用于出库任务页面-确认fc + * + * @param + * @return + */ + @PostMapping("/addPurchaseOrderOutboundfc") + public AjaxResult addPurchaseOrderOutboundfc(@RequestBody OrderLine orderLine) { + odsProcureOrderService.addPurchaseOrderOutboundfc(orderLine); + return success(); + } /** * 用于出库任务页面-确认 * @@ -289,7 +309,17 @@ public class OdsProcureOrderController extends BaseController { odsProcureOrderService.OutboundPostingSAP(orderList); return success(); } - + /** + * 出库过账 + * + * @param orderList + * @return + */ + @PostMapping("/OutboundPostingSAPfc") + public AjaxResult OutboundPostingSAPfc(@RequestBody List<OdsProcureOutOrder> orderList) { + odsProcureOrderService.OutboundPostingSAPfc(orderList); + return success(); + } @PostMapping("/listCKT") public AjaxResult listCKT(BaseWarehouse baseWarehouse) { diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOutOrderController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOutOrderController.java index 1fc9a2ed..11707ead 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOutOrderController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/OdsProcureOutOrderController.java @@ -59,7 +59,12 @@ public class OdsProcureOutOrderController extends BaseController { return getDataTable(list); } - + @PostMapping("/listZUFC") + public TableDataInfo listZUFC(OdsProcureOutOrder odsProcureOutOrder) { + startPage(); + List<OdsProcureOutOrder> list = odsProcureOutOrderService.selectOdsProcureOutOrderListZUfc(odsProcureOutOrder); + return getDataTable(list); + } /** * 导出包材出库单列表 */ diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/OdsProcureOutOrder.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/OdsProcureOutOrder.java index e4075efc..2ecfc124 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/OdsProcureOutOrder.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/OdsProcureOutOrder.java @@ -98,6 +98,26 @@ public class OdsProcureOutOrder extends BaseEntity { @Excel(name = "计划日期", width = 30, dateFormat = "yyyy-MM-dd") private Date planDate; + private String planDateMin; + + private String planDateMax; + + public String getPlanDateMin() { + return planDateMin; + } + + public void setPlanDateMin(String planDateMin) { + this.planDateMin = planDateMin; + } + + public String getPlanDateMax() { + return planDateMax; + } + + public void setPlanDateMax(String planDateMax) { + this.planDateMax = planDateMax; + } + /** * 计划数量 */ diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/OrderLine.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/OrderLine.java index 86943e6e..20887931 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/OrderLine.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/OrderLine.java @@ -1,8 +1,11 @@ package com.op.wms.domain; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.op.common.core.annotation.Excel; import com.op.common.core.web.domain.BaseEntity; import java.math.BigDecimal; +import java.util.Date; import java.util.List; public class OrderLine extends BaseEntity { @@ -15,11 +18,19 @@ public class OrderLine extends BaseEntity { private String qualityStatus;//质检状态,1合格,2不合格 private String stationNo;//包装线 private String ken;//包装线--如果是用于自动化就选1,如果是手持人工出库就选2 - + private String userDefined5;//包装线--如果是用于自动化就选1,如果是手持人工出库就选2 public String getKen() { return ken; } + public String getUserDefined5() { + return userDefined5; + } + + public void setUserDefined5(String userDefined5) { + this.userDefined5 = userDefined5; + } + public void setKen(String ken) { this.ken = ken; } @@ -32,6 +43,18 @@ public class OrderLine extends BaseEntity { private String userDefined2; private String userDefined3; + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "计划日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date planDate; + + public Date getPlanDate() { + return planDate; + } + + public void setPlanDate(Date planDate) { + this.planDate = planDate; + } + public String getUserDefined3() { return userDefined3; } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java index cc3e4a12..b1c606d1 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/OdsProcureOutOrderMapper.java @@ -88,4 +88,16 @@ public interface OdsProcureOutOrderMapper { List<OdsProcureOutOrder> selectmesPrepareDetailWhite(OdsProcureOutOrder odsProcureOutOrder); OdsProcureOutOrder selectmesPreparelike(OdsProcureOutOrder odsProcureOrder); + + List<OdsProcureOutOrder> selectOdsProcureOutOrderListZUfc(OdsProcureOutOrder odsProcureOutOrder); + + List<OdsProcureOutOrder> PurchaseOrderOutboundPdafc(OdsProcureOutOrder odsProcureOrder); + + public int insertOdsProcureOutOrderfc(OdsProcureOutOrder odsProcureOutOrder); + + List<OdsProcureOutOrder> selectOdsProcureOutOrderListByu1fc(List<OdsProcureOutOrder> orderList); + + void updateOdsProcureOutOrderByidsfc(@Param("order") OdsProcureOutOrder order, @Param("list") List<OdsProcureOutOrder> sapMaterialPostingList); + + OdsProcureOutOrder selectOdsProcureOutOrderListZUfcsy(OdsProcureOutOrder odsProcureOutOrder); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java index e7012987..574cd180 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOrderService.java @@ -105,4 +105,10 @@ public interface IOdsProcureOrderService { List<OdsProcureOrder> ArrivalRegistrationreader(OdsProcureOrder odsProcureOrder); AjaxResult getDeliveryNoteDetail(OdsProcureOrder odsProcureOrder); + + OdsProcureOutOrder PurchaseOrderOutboundPdafc(OdsProcureOutOrder odsProcureOrder); + + OrderLine addPurchaseOrderOutboundfc(OrderLine orderLine); + + void OutboundPostingSAPfc(List<OdsProcureOutOrder> orderList); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java index 1094cfd0..f7b99922 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IOdsProcureOutOrderService.java @@ -62,4 +62,6 @@ public interface IOdsProcureOutOrderService { List<OdsProcureOutOrder> selectOdsProcureOutOrderListZU(OdsProcureOutOrder odsProcureOutOrder); List<OdsProcureOutOrder> selectOdsProcureOutOrderListZUTwo(OdsProcureOutOrder odsProcureOutOrder1); + + List<OdsProcureOutOrder> selectOdsProcureOutOrderListZUfc(OdsProcureOutOrder odsProcureOutOrder); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java index 5b6f027d..7fcabdf4 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOrderServiceImpl.java @@ -614,7 +614,8 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { String msg = result.getMsg(); //order.setSapMaterialPostingList(sapMaterialPostingList); order.setUserDefined11(msg); - if (code == 200) {//过账成功 + if (code == 200) { + //过账成功 Map map = new HashMap(); map = (Map) result.getData(); String userDefined9 = (String) map.get("MATERIALDOCUMENT"); @@ -629,13 +630,15 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { } } - if (sapMaterialPostingFCList.size() > 0) {//反冲过账 + 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) {//过账成功 + if (code == 200) { + //过账成功 Map map = new HashMap(); map = (Map) result2.getData(); String userDefined9 = (String) map.get("MATERIALDOCUMENT"); @@ -836,6 +839,119 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService { return AjaxResult.success(); } + @Override + @DS("#header.poolName") + public OdsProcureOutOrder PurchaseOrderOutboundPdafc(OdsProcureOutOrder odsProcureOrder) { + //用日期进行累计 + List<OdsProcureOutOrder> orderList = odsProcureOutOrderMapper.PurchaseOrderOutboundPdafc(odsProcureOrder); + for(OdsProcureOutOrder odsProcureOutOrder:orderList){ + + OdsProcureOutOrder odsProcureOutOrder1= odsProcureOutOrderMapper.selectOdsProcureOutOrderListZUfcsy(odsProcureOutOrder); + if (odsProcureOutOrder1!=null){ + odsProcureOutOrder.setOutNumber(odsProcureOutOrder1.getOutNumber()); + }else { + odsProcureOutOrder.setOutNumber(new BigDecimal("0")); + } + + } + odsProcureOrder.setList(orderList); + return odsProcureOrder; + } + + @Override + @DS("#header.poolName") + public OrderLine addPurchaseOrderOutboundfc(OrderLine orderLine) { + //自己生成行项目,,批次号 + List<OrderLine> orderList = orderLine.getList(); + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + Date date = new Date(); + String formattedDate = dateFormat.format(date); + //根据订单号查询对应的最大批次号 + Integer orderItem = 0; + for (OrderLine orderLine1 : + orderList) { + orderItem++; + orderLine1.setOrderLineNo(String.format("%05d", orderItem)); + orderLine1.setBatchNo(formattedDate); + } + //手持出库 + for (OrderLine orderLine1 : + orderList) { + OdsProcureOutOrder odsProcureOutOrder = new OdsProcureOutOrder(); + odsProcureOutOrder.setID(IdUtils.fastSimpleUUID()); + odsProcureOutOrder.setSiteCode(orderLine1.getSiteCode()); + odsProcureOutOrder.setProduceCode("FC"+formattedDate);//订单号是生成的 + odsProcureOutOrder.setLocCode(orderLine.getWarehouseNo()); + odsProcureOutOrder.setMaterialCode(orderLine1.getMaterialCode()); + odsProcureOutOrder.setMaterialDesc(orderLine1.getMaterialDesc()); + odsProcureOutOrder.setPlanDate(orderLine1.getPlanDate()); + odsProcureOutOrder.setUnit(orderLine1.getUnit()); + odsProcureOutOrder.setProductionLineCode(orderLine1.getStationNo()); + odsProcureOutOrder.setUserDefined1(orderLine1.getBatchNo()); + odsProcureOutOrder.setActive("1"); + odsProcureOutOrder.setOrderStatus("1"); + odsProcureOutOrder.setPlanNumber(orderLine1.getQty()); + odsProcureOutOrder.setUserDefined2(orderLine1.getOrderLineNo()); + odsProcureOutOrder.setUserDefined3(orderLine1.getUserDefined3()); + odsProcureOutOrder.setUserDefined10("1"); + odsProcureOutOrder.setCreateBy(SecurityUtils.getUsername()); + odsProcureOutOrder.setCreateDate(new Date()); + odsProcureOutOrder.setUserDefined5(orderLine1.getUserDefined5()); + //odsProcureOutOrder.set + odsProcureOutOrderMapper.insertOdsProcureOutOrderfc(odsProcureOutOrder); + } + return orderLine; + } + + @Override + public void OutboundPostingSAPfc(List<OdsProcureOutOrder> orderList) { +// * 退料的移动类型为 262 +// * 领料的移动类型为 261 + // List<OdsProcureOutOrder> orderList1=odsProcureOutOrderMapper.selectOdsProcureOutOrderListByIds(orderList); + List<OdsProcureOutOrder> orderList1 = odsProcureOutOrderMapper.selectOdsProcureOutOrderListByu1fc(orderList); + //查询这个地方先暂时去掉Order_Status = '3' 条件 + //List<SapMaterialPosting> sapMaterialPostingList=new ArrayList<>(); + 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) { + //取sap仓库号 + 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 (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.updateOdsProcureOutOrderByidsfc(order, orderList2FC); + } else {// + order.setUserDefined9(""); + order.setUserDefined10("3");//失败 + odsProcureOutOrderMapper.updateOdsProcureOutOrderByidsfc(order, orderList2FC); + } + } + } + public String DesignatedPalletOutboundWCS(WMSDesignatedPalle wmsDesignatedPalle) { // 定义请求的URL地址 String url = "http://192.168.202.37:9001/api/v1/ReceiveMesMsg/packingMaterialsOutBoundByPallet"; diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java index 662ccc8e..2a759bdd 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/OdsProcureOutOrderServiceImpl.java @@ -124,4 +124,11 @@ public class OdsProcureOutOrderServiceImpl implements IOdsProcureOutOrderService List<OdsProcureOutOrder> orderList = odsProcureOutOrderMapper.selectOdsProcureOutOrderListZUT(odsProcureOutOrder1); return orderList; } + + @Override + @DS("#header.poolName") + public List<OdsProcureOutOrder> selectOdsProcureOutOrderListZUfc(OdsProcureOutOrder odsProcureOutOrder) { + List<OdsProcureOutOrder> orderList = odsProcureOutOrderMapper.selectOdsProcureOutOrderListZUfc(odsProcureOutOrder); + return orderList; + } } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml index 4160596e..ffab7996 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/OdsProcureOutOrderMapper.xml @@ -64,6 +64,20 @@ ORDER BY Create_Date DESC; </select> + <select id="selectOdsProcureOutOrderListZUfcsy" parameterType="OdsProcureOutOrder" resultMap="OdsProcureOutOrderResult"> + SELECT + Material_Code, + User_Defined5, + sum(Plan_Number) AS Out_Number + FROM + ods_procure_out_order_fc + where + Active='1' + + and Material_Code like concat('%', #{materialCode}, '%') + and User_Defined5 = #{userDefined5} + GROUP BY User_Defined5,Material_Code + </select> <select id="selectOdsProcureOutOrderListZUKEN" resultType="java.lang.String"> SELECT DISTINCT User_Defined11 @@ -213,7 +227,81 @@ <if test="enterpriseCode != null">#{enterpriseCode},</if> </trim> </insert> - + <insert id="insertOdsProcureOutOrderfc" parameterType="OdsProcureOutOrder"> + insert into ods_procure_out_order_fc + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="siteCode != null">Site_code,</if> + <if test="ID != null">ID,</if> + <if test="produceCode != null">Produce_Code,</if> + <if test="materialCode != null">Material_Code,</if> + <if test="materialDesc != null">Material_Desc,</if> + <if test="planDate != null">Plan_Date,</if> + <if test="planNumber != null">Plan_Number,</if> + <if test="Unit != null">Unit,</if> + <if test="outNumber != null">Out_Number,</if> + <if test="locCode != null">Loc_Code,</if> + <if test="locDesc != null">Loc_Desc,</if> + <if test="productionLineDesc != null">Production_Line_Desc,</if> + <if test="productionLineCode != null">Production_Line_Code,</if> + <if test="orderStatus != null">Order_Status,</if> + <if test="userDefined1 != null">User_Defined1,</if> + <if test="userDefined2 != null">User_Defined2,</if> + <if test="userDefined3 != null">User_Defined3,</if> + <if test="userDefined4 != null">User_Defined4,</if> + <if test="userDefined5 != null">User_Defined5,</if> + <if test="userDefined6 != null">User_Defined6,</if> + <if test="userDefined7 != null">User_Defined7,</if> + <if test="userDefined8 != null">User_Defined8,</if> + <if test="userDefined9 != null">User_Defined9,</if> + <if test="userDefined10 != null">User_Defined10,</if> + <if test="userDefined11 != null">User_Defined11,</if> + <if test="supplierCode != null">Supplier_Code,</if> + <if test="supplierName != null">Supplier_Name,</if> + <if test="createBy != null">Create_By,</if> + <if test="createDate != null">Create_Date,</if> + <if test="lastUpdateBy != null">Last_Update_By,</if> + <if test="lastUpdateDate != null">Last_Update_Date,</if> + <if test="Active != null">Active,</if> + <if test="enterpriseId != null">Enterprise_Id,</if> + <if test="enterpriseCode != null">Enterprise_Code,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="siteCode != null">#{siteCode},</if> + <if test="ID != null">#{ID},</if> + <if test="produceCode != null">#{produceCode},</if> + <if test="materialCode != null">#{materialCode},</if> + <if test="materialDesc != null">#{materialDesc},</if> + <if test="planDate != null">#{planDate},</if> + <if test="planNumber != null">#{planNumber},</if> + <if test="Unit != null">#{Unit},</if> + <if test="outNumber != null">#{outNumber},</if> + <if test="locCode != null">#{locCode},</if> + <if test="locDesc != null">#{locDesc},</if> + <if test="productionLineDesc != null">#{productionLineDesc},</if> + <if test="productionLineCode != null">#{productionLineCode},</if> + <if test="orderStatus != null">#{orderStatus},</if> + <if test="userDefined1 != null">#{userDefined1},</if> + <if test="userDefined2 != null">#{userDefined2},</if> + <if test="userDefined3 != null">#{userDefined3},</if> + <if test="userDefined4 != null">#{userDefined4},</if> + <if test="userDefined5 != null">#{userDefined5},</if> + <if test="userDefined6 != null">#{userDefined6},</if> + <if test="userDefined7 != null">#{userDefined7},</if> + <if test="userDefined8 != null">#{userDefined8},</if> + <if test="userDefined9 != null">#{userDefined9},</if> + <if test="userDefined10 != null">#{userDefined10},</if> + <if test="userDefined11 != null">#{userDefined11},</if> + <if test="supplierCode != null">#{supplierCode},</if> + <if test="supplierName != null">#{supplierName},</if> + <if test="createBy != null">#{createBy},</if> + <if test="createDate != null">#{createDate},</if> + <if test="lastUpdateBy != null">#{lastUpdateBy},</if> + <if test="lastUpdateDate != null">#{lastUpdateDate},</if> + <if test="Active != null">#{Active},</if> + <if test="enterpriseId != null">#{enterpriseId},</if> + <if test="enterpriseCode != null">#{enterpriseCode},</if> + </trim> + </insert> <update id="updateOdsProcureOutOrder" parameterType="OdsProcureOutOrder"> update ods_procure_out_order <trim prefix="SET" suffixOverrides=","> @@ -347,6 +435,16 @@ #{item.ID} </foreach> </update> + <update id="updateOdsProcureOutOrderByidsfc"> + update ods_procure_out_order_fc + set User_Defined10 = #{order.userDefined10}, + User_Defined9 = #{order.userDefined9}, + User_Defined11 = #{order.userDefined11} + where ID in + <foreach collection="list" item="item" index="index" open="(" separator="," close=")"> + #{item.ID} + </foreach> + </update> <select id="selectOdsProcureOutOrderListByIds" resultMap="OdsProcureOutOrderResult"> <include refid="selectOdsProcureOutOrderVo"/> WHERE @@ -356,6 +454,54 @@ #{item.ID} </foreach> </select> + <select id="selectOdsProcureOutOrderListByu1fc" resultMap="OdsProcureOutOrderResult"> + SELECT + Site_code, + ID, + Produce_Code, + Material_Code, + Material_Desc, + Plan_Date, + Plan_Number, + Unit, + COALESCE ( Plan_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_fc + WHERE + <![CDATA[ (User_Defined10 <> '2' OR User_Defined10 is NULL ) ]]> + and Produce_Code in + <foreach collection="list" item="item" index="index" open="(" separator="," close=")"> + #{item.produceCode} + </foreach> + and User_Defined1 in + <foreach collection="list" item="item" index="index" open="(" separator="," close=")"> + #{item.userDefined1} + </foreach> + </select> <select id="selectOdsProcureOutOrderListByu1" resultMap="OdsProcureOutOrderResult"> SELECT Site_code, @@ -432,7 +578,6 @@ mes_prepare_detail.prepare_id= #{ ID} </select> <select id="selectmesPreparelike" parameterType="OdsProcureOutOrder" resultMap="OdsProcureOutOrderResult"> - SELECT prepare_id id, workorder_name Produce_Code, @@ -445,6 +590,98 @@ FROM mes_prepare WHERE workorder_name LIKE CONCAT('%', #{produceCode}, '%'); </select> - - +<select id="selectOdsProcureOutOrderListZUfc" 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 + ods_procure_out_order_fc + <where> + <if test="siteCode != null and siteCode != ''"> and Site_code = #{siteCode}</if> + <if test="produceCode != null and produceCode != ''"> and Produce_Code = #{produceCode}</if> + <if test="materialCode != null and materialCode != ''"> and Material_Code = #{materialCode}</if> + <if test="materialDesc != null and materialDesc != ''"> and Material_Desc = #{materialDesc}</if> + <if test="planDate != null "> and Plan_Date = #{planDate}</if> + <if test="planNumber != null "> and Plan_Number = #{planNumber}</if> + <if test="Unit != null and Unit != ''"> and Unit = #{Unit}</if> + <if test="outNumber != null "> and Out_Number = #{outNumber}</if> + <if test="locCode != null and locCode != ''"> and Loc_Code = #{locCode}</if> + <if test="locDesc != null and locDesc != ''"> and Loc_Desc = #{locDesc}</if> + <if test="productionLineDesc != null and productionLineDesc != ''"> and Production_Line_Desc = #{productionLineDesc}</if> + <if test="productionLineCode != null and productionLineCode != ''"> and Production_Line_Code = #{productionLineCode}</if> + <if test="orderStatus != null and orderStatus != ''"> and Order_Status = #{orderStatus}</if> + <if test="userDefined1 != null and userDefined1 != ''"> and User_Defined1 = #{userDefined1}</if> + <if test="userDefined2 != null and userDefined2 != ''"> and User_Defined2 = #{userDefined2}</if> + <if test="userDefined3 != null and userDefined3 != ''"> and User_Defined3 = #{userDefined3}</if> + <if test="userDefined4 != null and userDefined4 != ''"> and User_Defined4 = #{userDefined4}</if> + <if test="userDefined5 != null and userDefined5 != ''"> and User_Defined5 = #{userDefined5}</if> + <if test="userDefined6 != null and userDefined6 != ''"> and User_Defined6 = #{userDefined6}</if> + <if test="userDefined7 != null and userDefined7 != ''"> and User_Defined7 = #{userDefined7}</if> + <if test="userDefined8 != null and userDefined8 != ''"> and User_Defined8 = #{userDefined8}</if> + <if test="userDefined9 != null and userDefined9 != ''"> and User_Defined9 = #{userDefined9}</if> + <if test="userDefined10 != null and userDefined10 != ''"> and User_Defined10 = #{userDefined10}</if> + <if test="userDefined11 != null and userDefined11 != ''"> and User_Defined11 = #{userDefined11}</if> + <if test="supplierCode != null and supplierCode != ''"> and Supplier_Code = #{supplierCode}</if> + <if test="supplierName != null and supplierName != ''"> and Supplier_Name like concat('%', #{supplierName}, '%')</if> + <if test="createBy != null and createBy != ''"> and Create_By = #{createBy}</if> + <if test="createDate != null "> and Create_Date = #{createDate}</if> + <if test="lastUpdateBy != null and lastUpdateBy != ''"> and Last_Update_By = #{lastUpdateBy}</if> + <if test="lastUpdateDate != null "> and Last_Update_Date = #{lastUpdateDate}</if> + <if test="Active != null and Active != ''"> and Active = #{Active}</if> + <if test="enterpriseId != null and enterpriseId != ''"> and Enterprise_Id = #{enterpriseId}</if> + <if test="enterpriseCode != null and enterpriseCode != ''"> and Enterprise_Code = #{enterpriseCode}</if> + </where> +</select> +<select id="PurchaseOrderOutboundPdafc" parameterType="OdsProcureOutOrder" resultMap="OdsProcureOutOrderResult"> + SELECT + need_date User_Defined5, + material_code Material_Code, + material_name Material_Desc, + unit Unit, + SUM ( quantity ) AS Plan_Number + FROM + [dbo].[mes_prepare_detail] -- 筛选出 recoil 列为 'x' 的行 + WHERE + recoil = 'x' + <![CDATA[ AND need_date <= #{planDateMax} ]]> + AND need_date >= #{planDateMin} + AND material_code LIKE concat('%', #{materialCode}, '%') -- 在子查询中按 need_date 列进行分组 + GROUP BY + need_date, + material_code, + material_name, + unit +</select> </mapper>