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 new file mode 100644 index 00000000..74f7fa9c --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java @@ -0,0 +1,151 @@ +package com.ruoyi.purchase.controller; + +import java.util.List; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.purchase.domain.PurchaseOrderChild; +import com.ruoyi.purchase.service.IPurchaseOrderChildService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 采购订单子表Controller + * + * @author zhang + * @date 2024-06-19 + */ +@Controller +@RequestMapping("/purchase/purchaseOrderChild") +public class PurchaseOrderChildController extends BaseController +{ + private String prefix = "purchase/purchaseOrderChild"; + + @Autowired + private IPurchaseOrderChildService purchaseOrderChildService; + +// @RequiresPermissions("purchase:purchaseOrderChild:view") + @GetMapping() + public String purchaseOrderChild() + { + return prefix + "/purchaseOrderChild"; + } + + /** + * 查询采购订单子表列表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(PurchaseOrderChild purchaseOrderChild) + { + startPage(); + List list = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild); + return getDataTable(list); + } + + /** + * 导出采购订单子表列表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:export") + @Log(title = "采购订单子表", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(PurchaseOrderChild purchaseOrderChild) + { + List list = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild); + ExcelUtil util = new ExcelUtil(PurchaseOrderChild.class); + return util.exportExcel(list, "采购订单子表数据"); + } + + /** + * 新增采购订单子表 + */ + @GetMapping("/add") + public String add() + { + return prefix + "/add"; + } + + /** + * 新增保存采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:add") + @Log(title = "采购订单子表", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(PurchaseOrderChild purchaseOrderChild) + { + return toAjax(purchaseOrderChildService.insertPurchaseOrderChild(purchaseOrderChild)); + } + + /** + * 修改采购订单子表 + */ + @GetMapping("/edit/{purchaseOrderChildId}") + public String edit(@PathVariable("purchaseOrderChildId") Long purchaseOrderChildId, ModelMap mmap) + { + PurchaseOrderChild purchaseOrderChild = purchaseOrderChildService.selectPurchaseOrderChildById(purchaseOrderChildId); + mmap.put("purchaseOrderChild", purchaseOrderChild); + return prefix + "/edit"; + } + + /** + * 修改保存采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:edit") + @Log(title = "采购订单子表", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(PurchaseOrderChild purchaseOrderChild) + { + return toAjax(purchaseOrderChildService.updatePurchaseOrderChild(purchaseOrderChild)); + } + + /** + * 删除采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:remove") + @Log(title = "采购订单子表", businessType = BusinessType.DELETE) + @PostMapping( "/remove") + @ResponseBody + public AjaxResult remove(String ids) + { + return toAjax(purchaseOrderChildService.deletePurchaseOrderChildByIds(ids)); + } + + /** + * 作废采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:cancel") + @Log(title = "采购订单子表", businessType = BusinessType.CANCEL) + @GetMapping( "/cancel/{id}") + @ResponseBody + public AjaxResult cancel(@PathVariable("id") Long id){ + return toAjax(purchaseOrderChildService.cancelPurchaseOrderChildById(id)); + } + + /** + * 恢复采购订单子表 + */ +// @RequiresPermissions("purchase:purchaseOrderChild:restore") + @Log(title = "采购订单子表", businessType = BusinessType.RESTORE) + @GetMapping( "/restore/{id}") + @ResponseBody + public AjaxResult restore(@PathVariable("id")Long id) + { + return toAjax(purchaseOrderChildService.restorePurchaseOrderChildById(id)); + } + + +} 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 85c66db2..cdbefe30 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 @@ -13,10 +13,13 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.purchase.domain.PurchaseMaterial; import com.ruoyi.purchase.domain.PurchaseOrder; +import com.ruoyi.purchase.domain.PurchaseOrderChild; +import com.ruoyi.purchase.domain.PurchaseQuoteChild; import com.ruoyi.purchase.domain.exportDto.PurchaseMaterialDto; import com.ruoyi.purchase.domain.exportDto.PurchaseOrderDto; import com.ruoyi.purchase.service.IPurchaseMaterialService; @@ -32,6 +35,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.math.BigDecimal; import java.util.*; import static com.ruoyi.common.config.datasource.DynamicDataSourceContextHolder.log; @@ -53,6 +57,9 @@ public class PurchaseOrderController extends BaseController @Autowired private IPurchaseMaterialService purchaseMaterialService; + @Autowired + private RedisCache redisCache; + @RequiresPermissions("purchase:purchaseOrder:view") @GetMapping() public String purchaseOrder() @@ -103,8 +110,40 @@ public class PurchaseOrderController extends BaseController @Log(title = "采购订单", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody - public AjaxResult addSave(PurchaseOrder purchaseOrder) - { + public AjaxResult addSave(@RequestBody PurchaseOrder purchaseOrder) throws Exception{ + //获取采购订单子表中的供应商,核算供应商数量和采购物料合计以及采购数量合计,采购不含税报价合计,采购含税报价合计 + List purchaseMaterials = purchaseOrder.getPurchaseOrderChildList(); + purchaseOrder.setPurchaseOrderCode(redisCache.generateBillNo("CG")); + BigDecimal materialNoRmb = BigDecimal.valueOf(0.0); + BigDecimal materialRmb = BigDecimal.valueOf(0.0); + BigDecimal materialNoRmbSum = BigDecimal.valueOf(0.0); + BigDecimal materialRmbSum = BigDecimal.valueOf(0.0); + BigDecimal materialSum = BigDecimal.valueOf(0.0); + Long materialNum = 0L; + Long supplierNum = 0L; + for (PurchaseOrderChild purchaseOrderChild : purchaseMaterials) { + purchaseOrderChild.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); + for (PurchaseQuoteChild purchaseSupplierQuote : purchaseOrderChild.getPurchaseQuoteChildList()){ + BigDecimal suplierMaterialNoRmb = purchaseSupplierQuote.getMaterialNoRmb(); + BigDecimal suplierMaterialRmb = purchaseSupplierQuote.getMaterialRmb(); + Long suplierMaterialNum = purchaseSupplierQuote.getMaterialNum(); + BigDecimal suplierMaterialNoRmbSum = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); + BigDecimal suplierMaterialRmbSum = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); + materialNum = materialNum + suplierMaterialNum; + materialNoRmb = materialNoRmb.add(purchaseSupplierQuote.getMaterialNoRmb()); + materialRmb = materialRmb.add(purchaseSupplierQuote.getMaterialRmb()); + materialRmbSum = materialRmbSum.add(suplierMaterialRmbSum); + materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSum); + purchaseSupplierQuote.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode()); + if (purchaseSupplierQuote.getSupplierCode() != null){ + supplierNum ++; + } + } + purchaseOrderChild.setMaterialNormb(materialNoRmb); + purchaseOrderChild.setMaterialRmb(materialRmb); + purchaseOrderChild.setMaterialNum(materialNum); + } + purchaseOrder.setSupplierNum(Math.toIntExact(supplierNum)); return toAjax(purchaseOrderService.insertPurchaseOrder(purchaseOrder)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java index fe293a93..3ec562d4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java @@ -2,6 +2,7 @@ package com.ruoyi.purchase.controller; import java.util.Arrays; import java.util.List; +import java.util.Set; import com.ruoyi.common.core.text.Convert; import com.ruoyi.purchase.domain.PurchasePlan; @@ -114,19 +115,21 @@ public class PurchasePlanController extends BaseController @GetMapping("/addPurchaseOrder/{purchasePlanCodes}") public String purChaseOrder(@PathVariable("purchasePlanCodes") String purchasePlanCodes,ModelMap mmap){ //purchasePlanCodes去除重复数据,purchasePlanCodeArray作为数组类型去除 - String purchasePlanCode = purchasePlanCodes; + + // 直接使用String的split方法分割字符串,然后转为Stream去重,最后再拼接回字符串 String[] purchasePlanCodeArray = purchasePlanCodes.split(","); - purchasePlanCodes = Arrays.toString(Arrays.stream(purchasePlanCodeArray).distinct().toArray()); + String uniquePurchasePlanCodes = String.join(",", Arrays.stream(purchasePlanCodeArray).distinct().toArray(String[]::new)); //查询相关采购计划数据 - List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCode); + List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(uniquePurchasePlanCodes); //根据采购计划编号查询对应的采购报价数据 - List purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(purchasePlanCode); + List purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(uniquePurchasePlanCodes); //再根据采购计划编号分组查询对应的采购报价数据分组 - - purchasePlanCodes = purchasePlanCodes.replace("[","").replace("]",""); + for(PurchasePlanChild purchasePlanChild : purchasePlanChildList){ + purchasePlanChild.setPurchaseSupplierList(purchasePlanChild.parseSupplierMaterialCombinations(purchasePlanChild.getSupplierCodes())); + } //查询物料报价中供应商 mmap.put("purchasePlanList", purchasePlanList); - mmap.put("purchasePlanCodes", purchasePlanCodes); + mmap.put("purchasePlanCodes", uniquePurchasePlanCodes); mmap.put("purchasePlanChildList", purchasePlanChildList); return prefix + "/addPurchaseOrder"; } 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 393abf2f..1ec203d4 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 @@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.core.domain.BaseEntity; +import java.util.List; + /** * 采购订单对象 purchase_order * @@ -177,6 +179,16 @@ public class PurchaseOrder extends BaseEntity /** 备用二 */ private String standbyTwo; + private List purchaseOrderChildList; + + public List getPurchaseOrderChildList() { + return purchaseOrderChildList; + } + + public void setPurchaseOrderChildList(List purchaseOrderChildList) { + this.purchaseOrderChildList = purchaseOrderChildList; + } + public Long getPurchaseOrderId() { return purchaseOrderId; } 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 new file mode 100644 index 00000000..0ff3a2c4 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java @@ -0,0 +1,321 @@ +package com.ruoyi.purchase.domain; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 采购订单子表对象 purchase_order_child + * + * @author zhang + * @date 2024-06-19 + */ +public class PurchaseOrderChild extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 采购订单子表id */ + private Long purchaseOrderChildId; + + /** 关联采购订单号 */ + @Excel(name = "关联采购订单号") + private String purchaseOrderCode; + + /** 供应商代码 */ + @Excel(name = "供应商代码") + private String supplierCode; + + /** 供应商名称 */ + @Excel(name = "供应商名称") + private String supplierName; + + /** 物料料号 */ + @Excel(name = "物料料号") + private String materialCode; + + /** 物料名称 */ + @Excel(name = "物料名称") + private String materialName; + + /** 物料不含税单价 */ + @Excel(name = "物料不含税单价") + private BigDecimal materialNormb; + + /** 物料含税单价 */ + @Excel(name = "物料含税单价") + private BigDecimal materialRmb; + + /** 采购物料数量 */ + @Excel(name = "采购物料数量") + private Long materialNum; + + /** 物料合计 */ + @Excel(name = "物料合计") + private Long materialAmount; + + /** 数量合计 */ + @Excel(name = "数量合计") + private Long materialSum; + + /** 不含税总价(RMB) */ + @Excel(name = "不含税总价(RMB)") + private BigDecimal materialNormbsum; + + /** 含税总价(RMB) */ + @Excel(name = "含税总价(RMB)") + private BigDecimal materialRmbsum; + + /** 交货时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "交货时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date deliveryTime; + + /** 收货状态 */ + @Excel(name = "收货状态") + private String eceiptStatus; + + /** 打款结案状态 */ + @Excel(name = "打款结案状态") + private String paymentStatus; + + /** 税率 */ + @Excel(name = "税率") + private String taxRate; + + /** 删除标志 */ + private String delFlag; + + /** 备用一 */ + @Excel(name = "备用一") + private String standbyOne; + + /** 备用二 */ + @Excel(name = "备用二") + private String standbyTwo; + + private List purchaseQuoteChildList; + + public List getPurchaseQuoteChildList() { + return purchaseQuoteChildList; + } + + public void setPurchaseQuoteChildList(List purchaseQuoteChildList) { + this.purchaseQuoteChildList = purchaseQuoteChildList; + } + + public void setPurchaseOrderChildId(Long purchaseOrderChildId) + { + this.purchaseOrderChildId = purchaseOrderChildId; + } + + public Long getPurchaseOrderChildId() + { + return purchaseOrderChildId; + } + public void setPurchaseOrderCode(String purchaseOrderCode) + { + this.purchaseOrderCode = purchaseOrderCode; + } + + public String getPurchaseOrderCode() + { + return purchaseOrderCode; + } + public void setSupplierCode(String supplierCode) + { + this.supplierCode = supplierCode; + } + + public String getSupplierCode() + { + return supplierCode; + } + public void setSupplierName(String supplierName) + { + this.supplierName = supplierName; + } + + public String getSupplierName() + { + return supplierName; + } + public void setMaterialCode(String materialCode) + { + this.materialCode = materialCode; + } + + public String getMaterialCode() + { + return materialCode; + } + public void setMaterialName(String materialName) + { + this.materialName = materialName; + } + + public String getMaterialName() + { + return materialName; + } + public void setMaterialNormb(BigDecimal materialNormb) + { + this.materialNormb = materialNormb; + } + + public BigDecimal getMaterialNormb() + { + return materialNormb; + } + public void setMaterialRmb(BigDecimal materialRmb) + { + this.materialRmb = materialRmb; + } + + public BigDecimal getMaterialRmb() + { + return materialRmb; + } + public void setMaterialNum(Long materialNum) + { + this.materialNum = materialNum; + } + + public Long getMaterialNum() + { + return materialNum; + } + public void setMaterialAmount(Long materialAmount) + { + this.materialAmount = materialAmount; + } + + public Long getMaterialAmount() + { + return materialAmount; + } + public void setMaterialSum(Long materialSum) + { + this.materialSum = materialSum; + } + + public Long getMaterialSum() + { + return materialSum; + } + public void setMaterialNormbsum(BigDecimal materialNormbsum) + { + this.materialNormbsum = materialNormbsum; + } + + public BigDecimal getMaterialNormbsum() + { + return materialNormbsum; + } + public void setMaterialRmbsum(BigDecimal materialRmbsum) + { + this.materialRmbsum = materialRmbsum; + } + + public BigDecimal getMaterialRmbsum() + { + return materialRmbsum; + } + public void setDeliveryTime(Date deliveryTime) + { + this.deliveryTime = deliveryTime; + } + + public Date getDeliveryTime() + { + return deliveryTime; + } + public void setEceiptStatus(String eceiptStatus) + { + this.eceiptStatus = eceiptStatus; + } + + public String getEceiptStatus() + { + return eceiptStatus; + } + public void setPaymentStatus(String paymentStatus) + { + this.paymentStatus = paymentStatus; + } + + public String getPaymentStatus() + { + return paymentStatus; + } + public void setTaxRate(String taxRate) + { + this.taxRate = taxRate; + } + + public String getTaxRate() + { + return taxRate; + } + public void setDelFlag(String delFlag) + { + this.delFlag = delFlag; + } + + public String getDelFlag() + { + return delFlag; + } + public void setStandbyOne(String standbyOne) + { + this.standbyOne = standbyOne; + } + + public String getStandbyOne() + { + return standbyOne; + } + public void setStandbyTwo(String standbyTwo) + { + this.standbyTwo = standbyTwo; + } + + public String getStandbyTwo() + { + return standbyTwo; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("purchaseOrderChildId", getPurchaseOrderChildId()) + .append("purchaseOrderCode", getPurchaseOrderCode()) + .append("supplierCode", getSupplierCode()) + .append("supplierName", getSupplierName()) + .append("materialCode", getMaterialCode()) + .append("materialName", getMaterialName()) + .append("materialNormb", getMaterialNormb()) + .append("materialRmb", getMaterialRmb()) + .append("materialNum", getMaterialNum()) + .append("materialAmount", getMaterialAmount()) + .append("materialSum", getMaterialSum()) + .append("materialNormbsum", getMaterialNormbsum()) + .append("materialRmbsum", getMaterialRmbsum()) + .append("deliveryTime", getDeliveryTime()) + .append("eceiptStatus", getEceiptStatus()) + .append("paymentStatus", getPaymentStatus()) + .append("taxRate", getTaxRate()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("delFlag", getDelFlag()) + .append("standbyOne", getStandbyOne()) + .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 d6c0bcf3..0f3012a5 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 @@ -1,6 +1,8 @@ package com.ruoyi.purchase.domain; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -17,6 +19,7 @@ import com.ruoyi.common.core.domain.BaseEntity; public class PurchasePlanChild extends BaseEntity { private static final long serialVersionUID = 1L; + public List parseSupplierMaterialCombinations; /** 采购计划物料清单索引 */ private Long purchasePlanChildId; @@ -83,10 +86,30 @@ public class PurchasePlanChild extends BaseEntity /** 删除标志 */ private String delFlag; + /** 关联供应商编号 */ + private String supplierCodes; + /** 关联采购报价单编号 */ + private String correlationCodes; - private List purchaseQuoteChildList; + private List purchaseSupplierList; - public void setPurchasePlanChildId(Long purchasePlanChildId) + public String getSupplierCodes() { + return supplierCodes; + } + + public void setSupplierCodes(String supplierCodes) { + this.supplierCodes = supplierCodes; + } + + public String getCorrelationCodes() { + return correlationCodes; + } + + public void setCorrelationCodes(String correlationCodes) { + this.correlationCodes = correlationCodes; + } + + public void setPurchasePlanChildId(Long purchasePlanChildId) { this.purchasePlanChildId = purchasePlanChildId; } @@ -233,12 +256,12 @@ public class PurchasePlanChild extends BaseEntity this.supplierName = supplierName; } - public List getPurchaseQuoteChildList() { - return purchaseQuoteChildList; + public List getPurchaseSupplierList() { + return purchaseSupplierList; } - public void setPurchaseQuoteChildList(List purchaseQuoteChildList) { - this.purchaseQuoteChildList = purchaseQuoteChildList; + public void setPurchaseSupplierList(List purchaseSupplierList) { + this.purchaseSupplierList = purchaseSupplierList; } public String getUseStatus() @@ -264,6 +287,31 @@ public class PurchasePlanChild extends BaseEntity return delFlag; } + public List parseSupplierMaterialCombinations(String combinations) { + if (combinations == null || combinations.isEmpty()) { + return Collections.emptyList(); + } + //materialCode|purchaseQuoteCode|supplierCode|supplierName|materialName|materialNoRmb|materialRmb + /* 1. 料号 | 2. 供应商报价编号 | 3. 供应商编号 | 4.供应商名称 | 5. 物料名称 | 6. 物料含税单价(RMB) | 7. 物料不含税单价(RMB) */ + List purchaseSupplierList = new ArrayList<>(); + String[] split = combinations.split(","); + for (int i = 0; i < split.length; i++) { + String[] split1 = split[i].split("\\|"); + if (split1.length != 7) { + continue; + } + PurchaseQuoteChild purchaseQuoteChild = new PurchaseQuoteChild(); + purchaseQuoteChild.setMaterialCode(split1[0]); + purchaseQuoteChild.setPurchaseQuoteCode(split1[1]); + purchaseQuoteChild.setSupplierCode(split1[2]); + purchaseQuoteChild.setSupplierName(split1[3]); + purchaseQuoteChild.setMaterialName(split1[4]); + purchaseQuoteChild.setMaterialNoRmb(BigDecimal.valueOf(Float.parseFloat(split1[5]))); + purchaseQuoteChild.setMaterialRmb(BigDecimal.valueOf(Float.parseFloat(split1[6]))); + purchaseSupplierList.add(purchaseQuoteChild); + } + return purchaseSupplierList; + } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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 new file mode 100644 index 00000000..f6181b61 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java @@ -0,0 +1,77 @@ +package com.ruoyi.purchase.mapper; + +import java.util.List; +import com.ruoyi.purchase.domain.PurchaseOrderChild; + +/** + * 采购订单子表Mapper接口 + * + * @author zhang + * @date 2024-06-19 + */ +public interface PurchaseOrderChildMapper +{ + /** + * 查询采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 采购订单子表 + */ + public PurchaseOrderChild selectPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 查询采购订单子表列表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 采购订单子表集合 + */ + public List selectPurchaseOrderChildList(PurchaseOrderChild purchaseOrderChild); + + /** + * 新增采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int insertPurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 修改采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int updatePurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 删除采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int deletePurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 批量删除采购订单子表 + * + * @param purchaseOrderChildIds 需要删除的数据ID + * @return 结果 + */ + public int deletePurchaseOrderChildByIds(String[] purchaseOrderChildIds); + + /** + * 作废采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int cancelPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 恢复采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int restorePurchaseOrderChildById(Long purchaseOrderChildId); +} 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 new file mode 100644 index 00000000..9972df39 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java @@ -0,0 +1,75 @@ +package com.ruoyi.purchase.service; + +import java.util.List; +import com.ruoyi.purchase.domain.PurchaseOrderChild; + +/** + * 采购订单子表Service接口 + * + * @author zhang + * @date 2024-06-19 + */ +public interface IPurchaseOrderChildService +{ + /** + * 查询采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 采购订单子表 + */ + public PurchaseOrderChild selectPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 查询采购订单子表列表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 采购订单子表集合 + */ + public List selectPurchaseOrderChildList(PurchaseOrderChild purchaseOrderChild); + + /** + * 新增采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int insertPurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 修改采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + public int updatePurchaseOrderChild(PurchaseOrderChild purchaseOrderChild); + + /** + * 批量删除采购订单子表 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deletePurchaseOrderChildByIds(String ids); + + /** + * 删除采购订单子表信息 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + public int deletePurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 作废采购订单子表 + * @param purchaseOrderChildId 采购订单子表ID + * @return + */ + int cancelPurchaseOrderChildById(Long purchaseOrderChildId); + + /** + * 恢复采购订单子表 + * @param purchaseOrderChildId 采购订单子表ID + * @return + */ + int restorePurchaseOrderChildById(Long purchaseOrderChildId); +} 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 new file mode 100644 index 00000000..b4b9d8e8 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java @@ -0,0 +1,126 @@ +package com.ruoyi.purchase.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.ShiroUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper; +import com.ruoyi.purchase.domain.PurchaseOrderChild; +import com.ruoyi.purchase.service.IPurchaseOrderChildService; +import com.ruoyi.common.core.text.Convert; + +/** + * 采购订单子表Service业务层处理 + * + * @author zhang + * @date 2024-06-19 + */ +@Service +public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService +{ + @Autowired + private PurchaseOrderChildMapper purchaseOrderChildMapper; + + /** + * 查询采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 采购订单子表 + */ + @Override + public PurchaseOrderChild selectPurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.selectPurchaseOrderChildById(purchaseOrderChildId); + } + + /** + * 查询采购订单子表列表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 采购订单子表 + */ + @Override + public List selectPurchaseOrderChildList(PurchaseOrderChild purchaseOrderChild) + { + return purchaseOrderChildMapper.selectPurchaseOrderChildList(purchaseOrderChild); + } + + /** + * 新增采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + @Override + public int insertPurchaseOrderChild(PurchaseOrderChild purchaseOrderChild) + { + String loginName = ShiroUtils.getLoginName(); + purchaseOrderChild.setCreateBy(loginName); + purchaseOrderChild.setCreateTime(DateUtils.getNowDate()); + return purchaseOrderChildMapper.insertPurchaseOrderChild(purchaseOrderChild); + } + + /** + * 修改采购订单子表 + * + * @param purchaseOrderChild 采购订单子表 + * @return 结果 + */ + @Override + public int updatePurchaseOrderChild(PurchaseOrderChild purchaseOrderChild) + { + String loginName = ShiroUtils.getLoginName(); + purchaseOrderChild.setUpdateBy(loginName); + purchaseOrderChild.setUpdateTime(DateUtils.getNowDate()); + return purchaseOrderChildMapper.updatePurchaseOrderChild(purchaseOrderChild); + } + + /** + * 删除采购订单子表对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + @Override + public int deletePurchaseOrderChildByIds(String ids) + { + return purchaseOrderChildMapper.deletePurchaseOrderChildByIds(Convert.toStrArray(ids)); + } + + /** + * 删除采购订单子表信息 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + @Override + public int deletePurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.deletePurchaseOrderChildById(purchaseOrderChildId); + } + + /** + * 作废采购订单子表 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + @Override + public int cancelPurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.cancelPurchaseOrderChildById(purchaseOrderChildId); + } + + /** + * 恢复采购订单子表信息 + * + * @param purchaseOrderChildId 采购订单子表ID + * @return 结果 + */ + @Override + public int restorePurchaseOrderChildById(Long purchaseOrderChildId) + { + return purchaseOrderChildMapper.restorePurchaseOrderChildById(purchaseOrderChildId); + } +} 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 57adf4c4..dbdf08e3 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 @@ -59,6 +59,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService @Override public int insertPurchaseOrder(PurchaseOrder purchaseOrder) { + //根据上传的物料信息做采购订单子项 + // return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java index 7aac7fd9..78ffd5fa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java @@ -125,7 +125,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); child.setCreateBy(loginName); - child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode()); + child.setSupplierCode(purchaseQuote.getSupplierQuoteCode()); child.setSupplierName(purchaseQuote.getSupplierName()); child.setCreateTime(DateUtils.getNowDate()); child.setTaxRate(purchaseQuote.getTaxRate()); @@ -177,7 +177,7 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService if(childResult > 0){ for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); - child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode()); + child.setSupplierCode(purchaseQuote.getSupplierQuoteCode()); child.setSupplierName(purchaseQuote.getSupplierName()); child.setCreateBy(loginName); child.setCreateTime(DateUtils.getNowDate()); diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml new file mode 100644 index 00000000..9cdcf82d --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select purchase_order_child_id, purchase_order_code, supplier_code, supplier_name, material_code, material_name, material_noRmb, material_rmb, material_num, material_amount, material_sum, material_noRmbSum, material_rmbSum, 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 + + + + + + + + insert into purchase_order_child + + purchase_order_code, + supplier_code, + supplier_name, + material_code, + material_name, + material_noRmb, + material_rmb, + material_num, + material_amount, + material_sum, + material_noRmbSum, + material_rmbSum, + delivery_time, + eceipt_status, + payment_status, + tax_rate, + create_by, + create_time, + update_by, + update_time, + del_flag, + standby_one, + standby_two, + + + #{purchaseOrderCode}, + #{supplierCode}, + #{supplierName}, + #{materialCode}, + #{materialName}, + #{materialNormb}, + #{materialRmb}, + #{materialNum}, + #{materialAmount}, + #{materialSum}, + #{materialNormbsum}, + #{materialRmbsum}, + #{deliveryTime}, + #{eceiptStatus}, + #{paymentStatus}, + #{taxRate}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{delFlag}, + #{standbyOne}, + #{standbyTwo}, + + + + + update purchase_order_child + + purchase_order_code = #{purchaseOrderCode}, + supplier_code = #{supplierCode}, + supplier_name = #{supplierName}, + material_code = #{materialCode}, + material_name = #{materialName}, + material_noRmb = #{materialNormb}, + material_rmb = #{materialRmb}, + material_num = #{materialNum}, + material_amount = #{materialAmount}, + material_sum = #{materialSum}, + material_noRmbSum = #{materialNormbsum}, + material_rmbSum = #{materialRmbsum}, + delivery_time = #{deliveryTime}, + eceipt_status = #{eceiptStatus}, + payment_status = #{paymentStatus}, + tax_rate = #{taxRate}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + del_flag = #{delFlag}, + standby_one = #{standbyOne}, + standby_two = #{standbyTwo}, + + where purchase_order_child_id = #{purchaseOrderChildId} + + + + delete from purchase_order_child where purchase_order_child_id = #{purchaseOrderChildId} + + + + delete from purchase_order_child where purchase_order_child_id in + + #{purchaseOrderChildId} + + + + + update purchase_order_child set del_flag = '1' where purchase_order_child_id = #{purchaseOrderChildId} + + + + update purchase_order_child set del_flag = '0' where purchase_order_child_id = #{purchaseOrderChildId} + + + \ 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 20916f8c..7e798987 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml @@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + @@ -29,16 +31,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - - select purchase_plan_child_id, purchase_plan_code, material_id, material_code, material_name, material_type, process_method, brand, @@ -174,35 +166,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml index d44c79de..2cf6bac8 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml @@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and material_sole = #{materialSole} and use_status = #{useStatus} and audit_status = #{auditStatus} + and del_flag = #{delFlag} diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/add.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/add.html new file mode 100644 index 00000000..0e33c514 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/add.html @@ -0,0 +1,160 @@ + + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/edit.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/edit.html new file mode 100644 index 00000000..b1c32746 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/edit.html @@ -0,0 +1,153 @@ + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ + +
+
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+
+ + +
+ 代码生成请选择字典属性 +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/purchaseOrderChild.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/purchaseOrderChild.html new file mode 100644 index 00000000..99436f85 --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrderChild/purchaseOrderChild.html @@ -0,0 +1,202 @@ + + + + + + +
+
+
+
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • +  搜索 +  重置 +
  • +
+
+
+
+ + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html index 4f6c8e46..ba410a1a 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html @@ -93,8 +93,22 @@ ''+ '' ); + foreach(material.supplierList, function(supplier, index) { + var $supplier = $('
'); + $supplier.append(''); + var headerContent = + '' + var $header = $('
' + headerContent + '
'); + var $inputsWrapper = $('
'); // 用于存放输入框等表单元素 + $('#supplierCode' + tableId).append($inputsWrapper.append($header)); + }) + var $supplier = $('
'); + $tableWrapper.append($table); var $formGroup = $('
'); - var supplierName = + var supplierSum = '
' + '' + '
' + diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html index 073ea231..13fcbaeb 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html @@ -171,14 +171,13 @@ //·拼接采购计划单号 for(var i=0;i