diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java index 9917bd18..8f0c73e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java @@ -53,7 +53,15 @@ public class PurchaseOrderChildController extends BaseController List list = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild); return getDataTable(list); } - + /*根据采购订单号,查询下列子表信息*/ + @PostMapping("/totalList") + @ResponseBody + public TableDataInfo totalList(String purchaseOrderCode) + { + startPage(); + List list = purchaseOrderChildService.selectPurchaseOrderChildByOrderCodeTotal(purchaseOrderCode); + return getDataTable(list); + } /** * 导出采购订单子表列表 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java index 9104afcd..c0ffb290 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java @@ -28,6 +28,7 @@ import com.ruoyi.purchase.service.IPurchaseOrderService; import com.ruoyi.purchase.service.IPurchasePlanService; import com.ruoyi.quality.domain.QualityOrderDetail; import com.ruoyi.storehouse.utils.CustomRowWriteCellHandler; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.BeanUtils; @@ -130,7 +131,7 @@ public class PurchaseOrderController extends BaseController @Log(title = "采购订单", businessType = BusinessType.INSERT) @PostMapping("/addPurchaseOrder") @ResponseBody - public AjaxResult addPurchasePlantoPuserchaseOrder(@RequestBody PurchaseOrder purchaseOrder) { + public AjaxResult addPurchasePlanToPurchaseOrder(@RequestBody PurchaseOrder purchaseOrder) { // 数据校验,确保前端传入数据格式正确 // 生成采购订单编号 purchaseOrder.setPurchaseOrderCode(redisCache.generateBillNo("CG")); @@ -148,10 +149,13 @@ public class PurchaseOrderController extends BaseController for (PurchaseOrderChild child : purchaseOrder.getPurchaseOrderChildList()) { if (child.getCorrelationCode().contains(",")) { String[] correlationCodes = child.getCorrelationCode().split(","); - for (int i = 0; i < correlationCodes.length; i++) { + String[] planCodes = child.getPurchasePlanCode().split(","); + String[] purchaseQuoteCodes = child.getPurchaseQuoteCode().split(","); + for (int i = 0; i < planCodes.length - 1; i++) { + String planCode = planCodes[i]; String correlationCode = correlationCodes[i]; - String planCode = child.getPurchasePlanCode().split(",")[i]; - if (correlationCode != null) { + String purchaseQuote = purchaseQuoteCodes[i]; + if (planCode != null) { PurchaseOrderChild material = new PurchaseOrderChild(); child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); // 累加物料数量和金额 @@ -161,6 +165,9 @@ public class PurchaseOrderController extends BaseController BigDecimal suplierMaterialRmb = child.getMaterialRmb(); // 获取物料数量 Long suplierMaterialNum = child.getMaterialNum(); + if (suplierMaterialNum == null) {suplierMaterialNum = 0L;} + if (suplierMaterialRmb == null) {suplierMaterialRmb = BigDecimal.ZERO;} + if (suplierMaterialNoRmb == null) {suplierMaterialNoRmb = BigDecimal.ZERO;} // 累加物料数量 materialNum += suplierMaterialNum; // 累加不含税物料价格 @@ -178,17 +185,31 @@ public class PurchaseOrderController extends BaseController // 设置采购报价单编号和供应商信息到QuoteChild material.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode()); material.setSupplierCode(child.getSupplierCode()); + material.setMaterialUnit(child.getMaterialUnit()); material.setSupplierName(child.getSupplierName()); + material.setMaterialCode(child.getMaterialCode()); + material.setMaterialName(child.getMaterialName()); + material.setMaterialBrand(child.getMaterialBrand()); + material.setMaterialDescribe(child.getMaterialDescribe()); + material.setMaterialPhotoUrl(child.getMaterialPhotoUrl()); + material.setMaterialProcessMethod(child.getMaterialProcessMethod()); material.setMaterialNoRmb(child.getMaterialNoRmb()); material.setMaterialRmb(child.getMaterialRmb()); material.setMaterialNum(child.getMaterialNum()); - material.setMaterialName(child.getMaterialName()); material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); material.setMaterialRmbSum(child.getMaterialRmbSum()); + material.setMaterialRealNum(child.getMaterialRealNum()); + material.setMaterialRealNoRmb(child.getMaterialRealNoRmb()); + material.setMaterialRealRmb(child.getMaterialRealRmb()); + material.setMaterialRealRmbSum(child.getMaterialRealRmbSum()); + material.setMaterialRealNoRmbSum(child.getMaterialRealNoRmbSum()); material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); material.setCorrelationCode(correlationCode); material.setPurchasePlanCode(planCode); - material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); + material.setPurchaseQuoteCode(purchaseQuote); + material.setEceiptStatus("0"); + material.setPaymentStatus("0"); + material.setDelFlag("0"); // 执行子表插入操作 purchaseOrderChildService.insertPurchaseOrderChild(child); PurchasePlan plan = new PurchasePlan(); @@ -199,11 +220,65 @@ public class PurchaseOrderController extends BaseController } child.setMaterialNoRmb(BigDecimal.ZERO); } - // 确保供应商数量统计准确 - if (child.getSupplierCode() != null) { - supplierNum++; - } - + else if ((child.getCorrelationCode().contains(",")==false) && child.getPurchasePlanCode() != null) { + PurchaseOrderChild material = new PurchaseOrderChild(); + child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); + //获取物料供应商采购价格 + BigDecimal suplierMaterialNoRmb = child.getMaterialNoRmb(); + // 获取物料供应商采购价格 + BigDecimal suplierMaterialRmb = child.getMaterialRmb(); + // 获取物料数量 + Long suplierMaterialNum = child.getMaterialNum(); + // 累加物料数量 + materialNum += suplierMaterialNum; + if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;} + if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;} + if(suplierMaterialNum == null){suplierMaterialNum = 0L;} + // 累加不含税物料价格 + materialNoRmb = materialNoRmb.add(suplierMaterialNoRmb); + // 累加含税物料价格 + materialRmb = materialRmb.add(suplierMaterialRmb); + // 计算不含税物料总价 + BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); + // 计算物料含税总价 + BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); + // 累加物料总价 + materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal); + // 累加物料含税总价 + materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); + // 设置采购报价单编号和供应商信息到QuoteChild + material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); + material.setSupplierCode(child.getSupplierCode()); + material.setMaterialUnit(child.getMaterialUnit()); + material.setSupplierName(child.getSupplierName()); + material.setMaterialCode(child.getMaterialCode()); + material.setMaterialName(child.getMaterialName()); + material.setMaterialBrand(child.getMaterialBrand()); + material.setMaterialDescribe(child.getMaterialDescribe()); + material.setMaterialPhotoUrl(child.getMaterialPhotoUrl()); + material.setMaterialProcessMethod(child.getMaterialProcessMethod()); + material.setMaterialNoRmb(child.getMaterialNoRmb()); + material.setMaterialRmb(child.getMaterialRmb()); + material.setMaterialNum(child.getMaterialNum()); + material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); + material.setMaterialRmbSum(child.getMaterialRmbSum()); + material.setMaterialRealNum(child.getMaterialRealNum()); + material.setMaterialRealNoRmb(child.getMaterialRealNoRmb()); + material.setMaterialRealRmb(child.getMaterialRealRmb()); + material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); + material.setCorrelationCode(child.getCorrelationCode()); + material.setPurchasePlanCode(child.getPurchasePlanCode()); + material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); + material.setEceiptStatus("0"); + material.setPaymentStatus("0"); + material.setDelFlag("0"); + // 执行子表插入操作 + purchaseOrderChildService.insertPurchaseOrderChild(child); + PurchasePlan plan = new PurchasePlan(); + plan.setPurchasePlanCode(child.getPurchasePlanCode()); + plan.setPurchasePlanStatus("1"); + int result = purchasePlanService.updatePurchasePlan(plan); + } } } // 遍历处理采购订单子表 @@ -239,14 +314,26 @@ public class PurchaseOrderController extends BaseController public String addPurchaseOrderStorage(@PathVariable("purchaseOrderCode") String purchaseOrderCode,ModelMap mmap){ //purchasePlanCodes去除重复数据,purchasePlanCodeArray作为数组类型去除 //查询相关采购计划数据 - PurchaseOrder purchaseOrderList = purchaseOrderService.selectPurchaseOrderByOrderCode(purchaseOrderCode); + PurchaseOrder purchaseOrder = purchaseOrderService.selectPurchaseOrderByOrderCode(purchaseOrderCode); //根据采购计划编号查询对应的采购报价数据 - List purchaseOrderChildList = purchaseOrderChildService.selectPurchaseOrderChildByOrderCode(purchaseOrderCode); //再根据采购计划编号分组查询对应的采购报价数据分组 - mmap.put("purchaseOrderList", purchaseOrderList); - mmap.put("purchaseOrderChildList", purchaseOrderChildList); - return prefix + "/addPurchaseOrderStorage"; + mmap.put("purchaseOrder", purchaseOrder); + return prefix + "/addPurchaseStorage"; + } + + @RequiresPermissions("purchase:purchaseOrder:addPurchaseOrderStorage") + @Log(title = "采购订单", businessType = BusinessType.INSERT) + @PostMapping("/addPurchaseOrderStorage") + @ResponseBody + public AjaxResult addPurchaseOrderStorageSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { + // 数据校验,确保前端传入数据格式正确 + // 生成采购订单编号 + // 执行主表插入操作 + return toAjax(purchaseOrderService.addPurchaseOrderStorage(warehouseStorageOrder)); // 假设toAjax方法处理成功逻辑 } + + + @ResponseBody @RequestMapping("/detailListGroupedBySupplier") public Map> detailListGroupedBySupplier(String qualityOrderCode) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java index a8048a4b..2640098d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java @@ -6,6 +6,7 @@ import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; import java.math.BigDecimal; +import java.util.Date; import java.util.List; /** @@ -51,6 +52,13 @@ public class PurchaseOrder extends BaseEntity /** 供应商名称 */ @Excel(name = "供应商名称") private String supplierName; + + @Excel(name = "入库类型") + private String eceiptType; + + @Excel(name = "到货时间") + private Date arrivedTime; + /** 联系人 */ @Excel(name = "联系人") private String customerContact; @@ -628,6 +636,23 @@ public class PurchaseOrder extends BaseEntity this.standbyTwo = standbyTwo; } + + public Date getArrivedTime() { + return arrivedTime; + } + + public void setArrivedTime(Date arrivedTime) { + this.arrivedTime = arrivedTime; + } + + public String getEceiptType() { + return eceiptType; + } + + public void setEceiptType(String eceiptType) { + this.eceiptType = eceiptType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -661,13 +686,15 @@ public class PurchaseOrder extends BaseEntity .append("approveNo", getApproveNo()) .append("approveName", getApproveName()) .append("approveTime", getApproveTime()) - .append("accountReconciliationFlag", getAccountReconciliationFlag()) - .append("accountReconciliationPerson", getAccountReconciliationPerson()) - .append("accountReconciliationTime", getAccountReconciliationTime()) + .append("accountReconciliationFlag", getAccountReconciliationFlag()) + .append("accountReconciliationPerson", getAccountReconciliationPerson()) + .append("accountReconciliationTime", getAccountReconciliationTime()) .append("firstAddTime", getFirstAddTime()) .append("updateInfoTime", getUpdateInfoTime()) .append("standbyOne", getStandbyOne()) .append("standbyTwo", getStandbyTwo()) .toString(); } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java index 8ca9b425..75e12141 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java @@ -49,6 +49,21 @@ public class PurchaseOrderChild extends BaseEntity @Excel(name = "物料名称") private String materialName; + @Excel(name = "物料类型") + private String materialType; + + private String materialBrand; + @Excel(name = "物料图片") + private String materialPhotourl; + + @Excel(name = "物料描述") + private String materialDescribe; + + @Excel(name = "物料单位") + private String materialUnit; + + @Excel(name = "物料加工方法") + private String materialProcessMethod; /** 物料不含税单价 */ @Excel(name = "物料不含税单价") private BigDecimal materialNoRmb; @@ -58,7 +73,7 @@ public class PurchaseOrderChild extends BaseEntity private BigDecimal materialRmb; /** 采购物料数量 */ - @Excel(name = "采购物料数量") + @Excel(name = "计划采购物料数量") private Long materialNum; /** 物料合计 */ @@ -76,6 +91,21 @@ public class PurchaseOrderChild extends BaseEntity /** 含税总价(RMB) */ @Excel(name = "含税总价(RMB)") private BigDecimal materialRmbSum; + /*关联采购计划的关联单号*/ + private String purchasePlanCorrelationCode; + @Excel(name="实际采购数") + private Long materialRealNum; + @Excel(name="实际采购不含税单价") + private BigDecimal materialRealNoRmb; + @Excel(name="实际采购含税单价") + private BigDecimal materialRealRmb; + @Excel(name="实际采购含税金额") + private BigDecimal materialRealRmbSum; + + @Excel(name="实际采购不含税金额") + private BigDecimal materialRealNoRmbSum; + + /** 交货时间 */ @JsonFormat(pattern = "yyyy-MM-dd") @@ -104,6 +134,27 @@ public class PurchaseOrderChild extends BaseEntity /** 备用二 */ @Excel(name = "备用二") private String standbyTwo; + + @Excel(name = "已入库数量") + private Integer hasStorageNum; + + @Excel(name = "通知到货数量") + private Integer notifyArriveNum; + + /** 实际已到货数量 */ + @Excel(name = "实际已到货数量") + private Integer actualHasArrivedNum; + + private Integer notifyArrivedNum; + + public Integer getNotifyArrivedNum() { + return notifyArrivedNum; + } + + public void setNotifyArrivedNum(Integer notifyArrivedNum) { + this.notifyArrivedNum = notifyArrivedNum; + } + private List purchaseQuoteChildList; public List getPurchaseQuoteChildList() { @@ -318,6 +369,134 @@ public class PurchaseOrderChild extends BaseEntity this.purchaseQuoteCode = purchaseQuoteCode; } + public String getPurchasePlanCorrelationCode() { + return purchasePlanCorrelationCode; + } + + public void setPurchasePlanCorrelationCode(String purchasePlanCorrelationCode) { + this.purchasePlanCorrelationCode = purchasePlanCorrelationCode; + } + + public Long getMaterialRealNum() { + return materialRealNum; + } + + public void setMaterialRealNum(Long materialRealNum) { + this.materialRealNum = materialRealNum; + } + + public BigDecimal getMaterialRealNoRmb() { + return materialRealNoRmb; + } + + public void setMaterialRealNoRmb(BigDecimal materialRealNoRmb) { + this.materialRealNoRmb = materialRealNoRmb; + } + + public BigDecimal getMaterialRealRmb() { + return materialRealRmb; + } + + public void setMaterialRealRmb(BigDecimal materialRealRmb) { + this.materialRealRmb = materialRealRmb; + } + + public BigDecimal getMaterialRealRmbSum() { + return materialRealRmbSum; + } + + public void setMaterialRealRmbSum(BigDecimal materialRealRmbSum) { + this.materialRealRmbSum = materialRealRmbSum; + } + + public BigDecimal getMaterialRealNoRmbSum() { + return materialRealNoRmbSum; + } + + public void setMaterialRealNoRmbSum(BigDecimal materialRealNoRmbSum) { + this.materialRealNoRmbSum = materialRealNoRmbSum; + } + + public String getMaterialType() { + return materialType; + } + + public void setMaterialType(String materialType) { + this.materialType = materialType; + } + + public String getMaterialPhotoUrl() { + return materialPhotourl; + } + + public void setMaterialPhotoUrl(String materialPhotourl) { + this.materialPhotourl = materialPhotourl; + } + + public String getMaterialDescribe() { + return materialDescribe; + } + + public void setMaterialDescribe(String materialDescribe) { + this.materialDescribe = materialDescribe; + } + + public String getMaterialUnit() { + return materialUnit; + } + + public void setMaterialUnit(String materialUnit) { + this.materialUnit = materialUnit; + } + + public String getMaterialProcessMethod() { + return materialProcessMethod; + } + + public void setMaterialProcessMethod(String materialProcessMethod) { + this.materialProcessMethod = materialProcessMethod; + } + + public String getMaterialBrand() { + return materialBrand; + } + + public void setMaterialBrand(String materialBrand) { + this.materialBrand = materialBrand; + } + + public String getMaterialPhotourl() { + return materialPhotourl; + } + + public void setMaterialPhotourl(String materialPhotourl) { + this.materialPhotourl = materialPhotourl; + } + + public Integer getHasStorageNum() { + return hasStorageNum; + } + + public void setHasStorageNum(Integer hasStorageNum) { + this.hasStorageNum = hasStorageNum; + } + + public Integer getNotifyArriveNum() { + return notifyArriveNum; + } + + public void setNotifyArriveNum(Integer notifyArriveNum) { + this.notifyArriveNum = notifyArriveNum; + } + + public Integer getActualHasArrivedNum() { + return actualHasArrivedNum; + } + + public void setActualHasArrivedNum(Integer actualHasArrivedNum) { + this.actualHasArrivedNum = actualHasArrivedNum; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -348,4 +527,5 @@ public class PurchaseOrderChild extends BaseEntity .append("standbyTwo", getStandbyTwo()) .toString(); } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java index 88b0e3e5..0050c4a5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java @@ -60,6 +60,9 @@ public class PurchasePlanChild extends BaseEntity @Excel(name = "物料的描述") private String describe; + @Excel(name = "物料入库部门") + private String warehouseDept; + /** 采购计划数 */ @Excel(name = "采购计划数") private Long materialNum; @@ -257,6 +260,14 @@ public class PurchasePlanChild extends BaseEntity this.supplierName = supplierName; } + public String getWarehouseDept() { + return warehouseDept; + } + + public void setWarehouseDept(String warehouseDept) { + this.warehouseDept = warehouseDept; + } + public List getPurchaseSupplierList() { return purchaseSupplierList; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java index ca2deebd..6e333575 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java @@ -76,4 +76,6 @@ public interface PurchaseOrderChildMapper public int restorePurchaseOrderChildById(Long purchaseOrderChildId); List selectPurchaseOrderChildByOrderCode(String purchaseOrderCode); + + List selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java index 69dcab9f..6b5d74ca 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java @@ -74,4 +74,6 @@ public interface IPurchaseOrderChildService int restorePurchaseOrderChildById(Long purchaseOrderChildId); List selectPurchaseOrderChildByOrderCode(String purchaseOrderCode); + + List selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java index 254dc3bb..4c433972 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java @@ -1,6 +1,7 @@ package com.ruoyi.purchase.service; import com.ruoyi.purchase.domain.PurchaseOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import java.util.List; @@ -63,4 +64,10 @@ public interface IPurchaseOrderService public String getId(); PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode); + + /* + * 采购订单创建采购入库通知单 + * */ + int addPurchaseOrderStorage(WarehouseStorageOrder warehouseStorageOrder); + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java index a5301fcd..31300c87 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java @@ -130,4 +130,9 @@ public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService public List selectPurchaseOrderChildByOrderCode(String purchaseOrderCode){ return purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCode(purchaseOrderCode); } + + @Override + public List selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode){ + return purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCodeTotal(purchaseOrderCode); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index d00b06b9..1097121c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -5,11 +5,19 @@ import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.purchase.domain.PurchaseOrder; +import com.ruoyi.purchase.domain.PurchaseOrderChild; import com.ruoyi.purchase.mapper.PurchaseOrderMapper; import com.ruoyi.purchase.service.IPurchaseOrderService; +import com.ruoyi.warehouse.domain.WarehouseStorageOrder; +import com.ruoyi.warehouse.domain.WarehouseStorageOrderDetail; +import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; +import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.util.ObjectUtils; import java.text.SimpleDateFormat; import java.util.List; @@ -21,6 +29,7 @@ import java.util.List; * @date 2023-03-31 */ @Service +@Slf4j public class PurchaseOrderServiceImpl implements IPurchaseOrderService { @Autowired @@ -29,6 +38,12 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService @Autowired private RedisCache redisCache; + @Autowired + private WarehouseStorageOrderMapper warehouseStorageOrderMapper; + + @Autowired + private WarehouseStorageOrderDetailMapper storageOrderDetailMapper; + /** * 查询采购订单 * @@ -116,4 +131,32 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService public PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode){ return purchaseOrderMapper.selectPurchaseOrderByOrderCode(purchaseOrderCode); } + + + /* + * 采购订单创建采购入库通知单 + * */ + @Override + public int addPurchaseOrderStorage(WarehouseStorageOrder warehouseStorageOrder){ + WarehouseStorageOrder warehouseStorageOrder1 = new WarehouseStorageOrder(); + warehouseStorageOrder1.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); + List warehouseStorageOrderList = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder1); + List list = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); + String warehouseStorageCode = redisCache.generateBillNo("RK"); + if(CollectionUtils.isEmpty(warehouseStorageOrderList)){ + for (WarehouseStorageOrderDetail warehouseStorageOrderDetail : list) { + //查询暂收(采购入库)物料表中是否存在该物料 + warehouseStorageOrderDetail.setWarehouseStorageCode(warehouseStorageCode); + + storageOrderDetailMapper.insertWarehouseStorageOrderDetail(warehouseStorageOrderDetail); + } + } + warehouseStorageOrder.setWarehouseStorageStatus("0"); + warehouseStorageOrder.setWarehouseQualityStatus("0"); + warehouseStorageOrder.setWarehouseStorageType("0"); + warehouseStorageOrder.setWarehouseOrderType("0"); + warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode); + return warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java index a77c7148..b9782463 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java @@ -209,6 +209,8 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService purchasePlanChild.setMaterialCode(bom.getMaterialNo()); purchasePlanChild.setMaterialName(bom.getMaterialName()); purchasePlanChild.setMaterialType(bom.getMaterialType()); + //新增物料入库部门 + purchasePlanChild.setWarehouseDept(bom.getWarehouseDept()); purchasePlanChild.setProcessMethod("采购"); purchasePlanChild.setBrand(bom.getBrand()); purchasePlanChild.setDescribe(bom.getDescribe()); diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml index d51356c3..ec24b568 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml @@ -8,10 +8,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + @@ -19,6 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + @@ -33,11 +47,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select purchase_order_child_id, purchase_order_code, supplier_code, supplier_name, - material_code, material_name, material_no_rmb, material_rmb, material_num, - material_amount, material_sum, material_no_rmb_sum, material_rmb_sum, delivery_time, - eceipt_status, payment_status, tax_rate, create_by, create_time, update_by, update_time, - del_flag, standby_one, standby_two from purchase_order_child + select purchase_order_child_id, purchase_order_code, purchase_plan_code,purchase_plan_correlation_code, + supplier_code, supplier_name, + material_code, material_name,material_type, material_describe,material_brand, + material_photoUrl, material_process_method,material_unit, + material_no_rmb, material_rmb, material_num, + material_amount, material_sum, material_no_rmb_sum, material_rmb_sum, + material_real_num, material_real_no_rmb, material_real_rmb, material_real_no_rmb_sum, + material_real_rmb_sum,delivery_time,eceipt_status, payment_status, tax_rate, create_by, + create_time, update_by, update_time,del_flag, standby_one, standby_two + from purchase_order_child + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml index c8890185..17056d48 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml @@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select purchase_order_id, purchase_order_code, supplier_code, supplier_name, + arrived_time, eceipt_type, customer_contact, contact_number, customer_fax, delivery_address, payment_terms, delivery_conditions, delivery_method, purchase_name, billing_date, tax_rate, purchase_category, purchase_commander, customer_order_number, remark_content, @@ -113,6 +116,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" stock_address, stock_contact, stock_phone, + arrived_time, + eceipt_type, #{purchaseOrderCode}, @@ -142,6 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{stockAddress}, #{stockContact}, #{stockPhone}, + #{arrivedTime}, + #{eceiptType}, @@ -185,6 +192,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" stock_address = #{stockAddress}, stock_contact = #{stockContact}, stock_phone = #{stockPhone}, + arrived_time = #{arrivedTime}, + eceipt_type = #{eceiptType}, where purchase_order_id = #{purchaseOrderId} @@ -212,4 +221,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where purchase_order_code = #{purchaseOrderCode} + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml index dae7afc9..2f59dc3c 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml @@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -20,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -214,9 +214,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" planChild.photoUrl, sum(planChild.material_num) as material_num, GROUP_CONCAT(DISTINCT plan.correlation_code ORDER BY plan.correlation_code) AS correlation_codes, + GROUP_CONCAT(DISTINCT plan.purchase_plan_code ORDER BY plan.purchase_plan_code) AS purchase_plan_codes from purchase_plan_child as planChild - left join purchase_plan as plan - on plan.purchase_plan_code = planChild.purchase_plan_code + left join purchase_plan as plan on plan.purchase_plan_code = planChild.purchase_plan_code where plan.purchase_plan_code IN #{purchasePlanCode} diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html index 68383709..e8b9d436 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html @@ -1,43 +1,48 @@ - + - +
-
- + +
- +
- +
- +
- +
- +
- +
+
-
-
- -
+
+ + +
@@ -46,24 +51,26 @@ diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html index 1dfca6a3..1c343a81 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html @@ -85,8 +85,6 @@ var warehouseStorageTypeDatas = [[${@dict.getType('warehouse_storage_type')}]]; var warehouseOrderTypeDatas = [[${@dict.getType('storage_order_type')}]]; var warehouseDeptTypeDatas = [[${@dict.getType('warehouse_dept_type')}]]; - - var prefix = ctx + "purchase/purchaseStorage"; $(function() { var options = { @@ -98,7 +96,8 @@ restoreUrl: prefix + "/restore/{id}", exportUrl: prefix + "/export", modalName: "采购入库通知单", - + fixedColumns: true, // 启用冻结列 + fixedRightNumber: 1, // 冻结右列个数 columns: [ {checkbox: true}, {title: '入库单id',field: 'warehouseStorageId',visible: false},