diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java index 437978f..b1a9226 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesPurchaseOrderController.java @@ -145,4 +145,58 @@ public class MesPurchaseOrderController extends BaseController { return success(mesPurchaseOrderService.selectCheckedPurchaseOrderByPurchaseOrderId(purchaseOrderId)); } + + /** + * 获取销售订单未绑定采购订单List + * @param mesPurchaseOrder + * @return + */ + @RequiresPermissions("mes:purchaseOrder:bind") + @GetMapping("/unbindPurchaseOrderList") + public TableDataInfo unbindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder) + { + startPage(); + List list = mesPurchaseOrderService.unbindPurchaseOrderList(mesPurchaseOrder); + return getDataTable(list); + } + + /** + * 获取销售订单已绑定采购订单List + * @param mesPurchaseOrder + * @return + */ + @RequiresPermissions("mes:purchaseOrder:bind") + @GetMapping("/saleBindPurchaseOrderList") + public TableDataInfo saleBindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder) + { + startPage(); + List list = mesPurchaseOrderService.saleBindPurchaseOrderList(mesPurchaseOrder); + return getDataTable(list); + } + + /** + * 保存销售订单绑定采购订单 + * @param saleOrderId + * @param purchaseOrderIds + * @return + */ + @RequiresPermissions("mes:purchaseOrder:bind") + @Log(title = "采购订单信息", businessType = BusinessType.ALLOCATE) + @PutMapping("/saveSalesBindPurchase") + public AjaxResult saveSalesBindPurchase(Long saleOrderId, Long[] purchaseOrderIds) { + return success(mesPurchaseOrderService.saveSalesBindPurchase(saleOrderId, purchaseOrderIds)); + } + + /** + * 删除销售订单绑定采购订单 + * @param orderBindIds + * @return + */ + @RequiresPermissions("mes:purchaseOrder:bind") + @Log(title = "采购订单信息", businessType = BusinessType.UNALLOCATE) + @PostMapping("/removeSalesBindPurchase") + public AjaxResult removeSalesBindPurchase(Long[] orderBindIds) { + return toAjax(mesPurchaseOrderService.removeSalesBindPurchase(orderBindIds)); + } + } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java index 41abe57..c509156 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesPurchaseOrder.java @@ -137,6 +137,39 @@ public class MesPurchaseOrder extends BaseEntity { /**规格参数*/ private String specificationParameter; + /**物料规格*/ + private String materialSpec; + + /**销售订单主键*/ + private Long saleOrderId; + + /**采购销售订单绑定主键*/ + private Long orderBindId; + + public Long getSaleOrderId() { + return saleOrderId; + } + + public void setSaleOrderId(Long saleOrderId) { + this.saleOrderId = saleOrderId; + } + + public Long getOrderBindId() { + return orderBindId; + } + + public void setOrderBindId(Long orderBindId) { + this.orderBindId = orderBindId; + } + + public String getMaterialSpec() { + return materialSpec; + } + + public void setMaterialSpec(String materialSpec) { + this.materialSpec = materialSpec; + } + public String getSpecificationParameter() { return specificationParameter; } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java index ad13aad..7ea0aa1 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/mapper/MesPurchaseOrderMapper.java @@ -87,4 +87,18 @@ public interface MesPurchaseOrderMapper * @return 结果 */ public int deleteMesOrderBindByOrderBindIds(Long[] orderBindIds); + + /** + * 获取销售订单未绑定采购订单 + * @param mesPurchaseOrder + * @return + */ + List unbindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder); + + /** + * 获取销售订单已绑定采购订单List + * @param mesPurchaseOrder + * @return + */ + List saleBindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java index 71c43ca..e700e8d 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/IMesPurchaseOrderService.java @@ -76,4 +76,32 @@ public interface IMesPurchaseOrderService */ public MesPurchaseOrder selectCheckedPurchaseOrderByPurchaseOrderId(Long purchaseOrderId); + /** + * 获取销售订单未绑定采购订单 + * @param mesPurchaseOrder + * @return + */ + List unbindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder); + + /** + * 获取销售订单已绑定采购订单List + * @param mesPurchaseOrder + * @return + */ + List saleBindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder); + + /** + * 保存销售订单绑定采购订单 + * @param saleOrderId + * @param purchaseOrderIds + * @return + */ + public int saveSalesBindPurchase(Long saleOrderId, Long[] purchaseOrderIds); + + /** + * 删除销售订单绑定采购订单 + * @param orderBindIds + * @return + */ + public int removeSalesBindPurchase(Long[] orderBindIds); } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java index 0725337..ee9e553 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesPurchaseOrderServiceImpl.java @@ -1,6 +1,7 @@ package com.hw.mes.service.impl; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -12,8 +13,10 @@ import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseBarcodeInfo; import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.domain.MesOrderBind; +import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.mapper.MesBaseBarcodeInfoMapper; import com.hw.mes.mapper.MesBaseMaterialInfoMapper; +import com.hw.mes.mapper.MesSaleOrderMapper; import com.hw.mes.service.IMesBaseMaterialInfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -39,6 +42,9 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { @Autowired private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper; + @Autowired + private MesSaleOrderMapper mesSaleOrderMapper; + /** * 查询采购订单信息 * @@ -208,5 +214,83 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService { return mesPurchaseOrder; } + /** + * 获取销售订单未绑定采购订单 + * @param mesPurchaseOrder + * @return + */ + @Override + public List unbindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder) { + return mesPurchaseOrderMapper.unbindPurchaseOrderList(mesPurchaseOrder); + } + + /** + * 获取销售订单已绑定采购订单List + * @param mesPurchaseOrder + * @return + */ + @Override + public List saleBindPurchaseOrderList(MesPurchaseOrder mesPurchaseOrder) { + return mesPurchaseOrderMapper.saleBindPurchaseOrderList(mesPurchaseOrder); + } + + + /** + * 保存销售订单绑定采购订单 + * @param saleOrderId + * @param purchaseOrderIds + * @return + */ + @Override + public int saveSalesBindPurchase(Long saleOrderId, Long[] purchaseOrderIds) { + List orderBindList = new ArrayList<>(); + if (StringUtils.isNull(saleOrderId)){ + return 0; + } + MesSaleOrder mesSaleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(saleOrderId); + String saleorderCode = mesSaleOrder.getSaleorderCode(); + Long productId = mesSaleOrder.getMaterialId(); + String productCode = mesSaleOrder.getMaterialCode(); + String productName = mesSaleOrder.getMaterialName(); + Date currentDate = new Date(); + String userName = SecurityUtils.getUsername(); + for (Long purchaseOrderId : purchaseOrderIds) { + MesOrderBind orderBind = new MesOrderBind(); + MesPurchaseOrder mesPurchaseOrder = mesPurchaseOrderMapper.selectMesPurchaseOrderByPurchaseOrderId(purchaseOrderId); + Long materialId = mesPurchaseOrder.getMaterialId(); + String materialCode = mesPurchaseOrder.getMaterialCode(); + String materialName = mesPurchaseOrder.getMaterialName(); + String poNo = mesPurchaseOrder.getPoNo(); + BigDecimal orderAmount = mesPurchaseOrder.getOrderAmount(); + + orderBind.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO); + orderBind.setSaleOrderId(saleOrderId); + orderBind.setSaleOrderCode(saleorderCode); + orderBind.setProductId(productId); + orderBind.setProductCode(productCode); + orderBind.setProductName(productName); + orderBind.setPurchaseOrderId(purchaseOrderId); + orderBind.setMaterialId(materialId); + orderBind.setMaterialCode(materialCode); + orderBind.setMaterialName(materialName); + orderBind.setBindAmount(orderAmount); + orderBind.setPoNo(poNo); + orderBind.setCreateTime(currentDate); + orderBind.setCreateBy(userName); + orderBindList.add(orderBind); + } + return mesPurchaseOrderMapper.batchMesOrderBind(orderBindList); + } + + /** + * 删除销售订单绑定采购订单 + * @param orderBindIds + * @return + */ + @Override + public int removeSalesBindPurchase(Long[] orderBindIds) { + return mesPurchaseOrderMapper.deleteMesOrderBindByOrderBindIds(orderBindIds); + } + } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml index 839170e..a501c59 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesPurchaseOrderMapper.xml @@ -37,6 +37,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -216,4 +218,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{orderBindId} + + + + + diff --git a/hw-ui/src/api/mes/purchaseOrder.js b/hw-ui/src/api/mes/purchaseOrder.js index ec94bd8..08351dd 100644 --- a/hw-ui/src/api/mes/purchaseOrder.js +++ b/hw-ui/src/api/mes/purchaseOrder.js @@ -74,3 +74,38 @@ export function getCheckedPurchaseOrder(purchaseOrderId) { method: 'get' }) } + +// 获取销售订单未绑定采购订单List +export function unbindPurchaseOrderList(query) { + return request({ + url: '/mes/purchaseOrder/unbindPurchaseOrderList', + method: 'get', + params: query + }) +} +// 获取销售订单已绑定采购订单List +export function saleBindPurchaseOrderList(query) { + return request({ + url: '/mes/purchaseOrder/saleBindPurchaseOrderList', + method: 'get', + params: query + }) +} + +// 保存销售订单绑定采购订单列表 +export function saveSalesBindPurchase(data) { + return request({ + url: '/mes/purchaseOrder/saveSalesBindPurchase', + method: 'put', + params: data + }) +} + +// 删除销售订单绑定采购订单 +export function removeSalesBindPurchase(data) { + return request({ + url: '/mes/purchaseOrder/removeSalesBindPurchase', + method: 'post', + params: data + }) +} diff --git a/hw-ui/src/router/index.js b/hw-ui/src/router/index.js index 757d030..d6d44f7 100644 --- a/hw-ui/src/router/index.js +++ b/hw-ui/src/router/index.js @@ -225,6 +225,20 @@ export const dynamicRoutes = [ } ] }, + { + path: '/saleOrder/bindingPurchase', + component: Layout, + hidden: true, + permissions: ['mes:saleOrder:edit'], + children: [ + { + path: 'index/:saleOrderId(\\d+)', + component: () => import('@/views/mes/saleOrder/bindingPurchase'), + name: 'BindingPurchase', + meta: { title: '销售订单绑定', activeMenu: '/mes/plan/saleOrder' } + } + ] + }, { path: '/system/wfProcessActivityAuth', component: Layout, diff --git a/hw-ui/src/views/mes/saleOrder/bindingPurchase.vue b/hw-ui/src/views/mes/saleOrder/bindingPurchase.vue new file mode 100644 index 0000000..70f9e62 --- /dev/null +++ b/hw-ui/src/views/mes/saleOrder/bindingPurchase.vue @@ -0,0 +1,347 @@ + + + diff --git a/hw-ui/src/views/mes/saleOrder/index.vue b/hw-ui/src/views/mes/saleOrder/index.vue index 27393b4..dddad39 100644 --- a/hw-ui/src/views/mes/saleOrder/index.vue +++ b/hw-ui/src/views/mes/saleOrder/index.vue @@ -149,24 +149,31 @@ - + + + + + + + + + + + + + - +