Browse Source

引用物料部分,新增入库部门字段,从采购计划转采购订单、采购计划单转入库通知单

dev
zhangsiqi 5 months ago
parent
commit
d032ddb8fe
  1. 10
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java
  2. 117
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java
  3. 27
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java
  4. 182
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java
  5. 11
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java
  6. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java
  7. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java
  8. 7
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java
  9. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java
  10. 43
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  11. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java
  12. 96
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  13. 10
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml
  14. 4
      ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml
  15. 205
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  16. 13
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html
  17. 68
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  18. 5
      ruoyi-admin/src/main/resources/templates/purchase/purchaseStorage/purchaseStorage.html

10
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java

@ -53,7 +53,15 @@ public class PurchaseOrderChildController extends BaseController
List<PurchaseOrderChild> list = purchaseOrderChildService.selectPurchaseOrderChildList(purchaseOrderChild);
return getDataTable(list);
}
/*根据采购订单号,查询下列子表信息*/
@PostMapping("/totalList")
@ResponseBody
public TableDataInfo totalList(String purchaseOrderCode)
{
startPage();
List<PurchaseOrderChild> list = purchaseOrderChildService.selectPurchaseOrderChildByOrderCodeTotal(purchaseOrderCode);
return getDataTable(list);
}
/**
* 导出采购订单子表列表
*/

117
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<PurchaseOrderChild> 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<String, List<PurchaseOrderChild>> detailListGroupedBySupplier(String qualityOrderCode) {

27
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)
@ -670,4 +695,6 @@ public class PurchaseOrder extends BaseEntity
.append("standbyTwo", getStandbyTwo())
.toString();
}
}

182
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<PurchaseQuoteChild> purchaseQuoteChildList;
public List<PurchaseQuoteChild> 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();
}
}

11
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<PurchaseQuoteChild> getPurchaseSupplierList() {
return purchaseSupplierList;
}

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java

@ -76,4 +76,6 @@ public interface PurchaseOrderChildMapper
public int restorePurchaseOrderChildById(Long purchaseOrderChildId);
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode);
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode);
}

2
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java

@ -74,4 +74,6 @@ public interface IPurchaseOrderChildService
int restorePurchaseOrderChildById(Long purchaseOrderChildId);
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode);
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode);
}

7
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);
}

5
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java

@ -130,4 +130,9 @@ public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService
public List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode){
return purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCode(purchaseOrderCode);
}
@Override
public List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCodeTotal(String purchaseOrderCode){
return purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCodeTotal(purchaseOrderCode);
}
}

43
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<WarehouseStorageOrder> warehouseStorageOrderList = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder1);
List<WarehouseStorageOrderDetail> 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);
}
}

2
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());

96
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml

@ -8,10 +8,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="purchaseOrderChildId" column="purchase_order_child_id" />
<result property="purchaseOrderCode" column="purchase_order_code" />
<result property="purchasePlanCode" column="purchase_plan_code" />
<result property="purchasePlanCorrelationCode" column="purchase_plan_correlation_code" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialType" column="material_type" />
<result property="materialBrand" column="material_brand" />
<result property="materialDescribe" column="material_describe" />
<result property="materialPhotourl" column="material_photoUrl" />
<result property="materialProcessMethod" column="material_process_method" />
<result property="materialUnit" column="material_unit" />
<result property="hasStorageNum" column="has_storage_num" />
<result property="notifyArrivedNum" column="notify_arrived_num" />
<result property="materialNoRmb" column="material_no_rmb" />
<result property="materialRmb" column="material_rmb" />
<result property="materialNum" column="material_num" />
@ -19,6 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialSum" column="material_sum" />
<result property="materialNoRmbSum" column="material_no_rmb_sum" />
<result property="materialRmbSum" column="material_rmb_sum" />
<result property="materialRealNum" column="material_real_num" />
<result property="materialRealNoRmb" column="material_real_no_rmb" />
<result property="materialRealRmb" column="material_real_rmb" />
<result property="materialRealNoRmbSum" column="material_real_no_rmb_sum" />
<result property="materialRealRmbSum" column="material_real_rmb_sum" />
<result property="deliveryTime" column="delivery_time" />
<result property="eceiptStatus" column="eceipt_status" />
<result property="paymentStatus" column="payment_status" />
@ -33,11 +47,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectPurchaseOrderChildVo">
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
</sql>
<select id="selectPurchaseOrderChildList" parameterType="PurchaseOrderChild" resultMap="PurchaseOrderChildResult">
@ -64,10 +83,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into purchase_order_child
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="purchaseOrderCode != null">purchase_order_code,</if>
<if test="purchasePlanCode != null">purchase_plan_code,</if>
<if test="purchasePlanCorrelationCode != null">purchase_plan_correlation_code,</if>
<if test="supplierCode != null">supplier_code,</if>
<if test="supplierName != null">supplier_name,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="materialType != null">material_type,</if>
<if test="materialDescribe != null">material_describe,</if>
<if test="materialBrand != null">material_brand,</if>
<if test="materialPhotourl != null">material_photo_url,</if>
<if test="materialProcessMethod != null">material_process_method,</if>
<if test="materialUnit != null">material_unit,</if>
<if test="materialNoRmb != null">material_no_rmb,</if>
<if test="materialRmb != null">material_rmb,</if>
<if test="materialNum != null">material_num,</if>
@ -75,24 +102,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialSum != null">material_sum,</if>
<if test="materialNoRmbSum != null">material_no_rmb_sum,</if>
<if test="materialRmbSum != null">material_rmb_sum,</if>
<if test="materialRealNum != null">material_real_num,</if>
<if test="materialRealNoRmb != null">material_real_no_rmb,</if>
<if test="materialRealRmb != null">material_real_rmb,</if>
<if test="materialRealNoRmbSum != null">material_real_no_rmb_sum,</if>
<if test="materialRealRmbSum != null">material_real_rmb_sum,</if>
<if test="deliveryTime != null">delivery_time,</if>
<if test="eceiptStatus != null">eceipt_status,</if>
<if test="paymentStatus != null">payment_status,</if>
<if test="taxRate != null">tax_rate,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
<if test="standbyOne != null">standby_one,</if>
<if test="standbyTwo != null">standby_two,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseOrderCode != null">#{purchaseOrderCode},</if>
<if test="purchasePlanCode != null">#{purchasePlanCode},</if>
<if test="purchasePlanCorrelationCode != null">#{purchasePlanCorrelationCode},</if>
<if test="supplierCode != null">#{supplierCode},</if>
<if test="supplierName != null">#{supplierName},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialType != null">#{materialType},</if>
<if test="materialDescribe != null">#{materialDescribe},</if>
<if test="materialBrand != null">#{materialBrand},</if>
<if test="materialPhotourl != null">#{materialPhotourl},</if>
<if test="materialProcessMethod != null">#{materialProcessMethod},</if>
<if test="materialUnit != null">#{materialUnit},</if>
<if test="materialNoRmb != null">#{materialNoRmb},</if>
<if test="materialRmb != null">#{materialRmb},</if>
<if test="materialNum != null">#{materialNum},</if>
@ -100,28 +138,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialSum != null">#{materialSum},</if>
<if test="materialNoRmbSum != null">#{materialNormbsum},</if>
<if test="materialRmbSum != null">#{materialRmbsum},</if>
<if test="materialRealNum != null">#{materialRealNum},</if>
<if test="materialRealNoRmb != null">#{materialRealNoRmb},</if>
<if test="materialRealRmb != null">#{materialRealRmb},</if>
<if test="materialRealNoRmbSum != null">#{materialRealNoRmbSum},</if>
<if test="materialRealRmbSum != null">#{materialRealRmbSum},</if>
<if test="deliveryTime != null">#{deliveryTime},</if>
<if test="eceiptStatus != null">#{eceiptStatus},</if>
<if test="paymentStatus != null">#{paymentStatus},</if>
<if test="taxRate != null">#{taxRate},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="standbyOne != null">#{standbyOne},</if>
<if test="standbyTwo != null">#{standbyTwo},</if>
</trim>
</insert>
<update id="updatePurchaseOrderChild" parameterType="PurchaseOrderChild">
update purchase_order_child
<trim prefix="SET" suffixOverrides=",">
<if test="purchaseOrderCode != null">purchase_order_code = #{purchaseOrderCode},</if>
<if test="purchasePlanCode != null">purchase_plan_code = #{purchasePlanCode},</if>
<if test="purchasePlanCorrelationCode != null">purchase_plan_correlation_code = #{purchasePlanCorrelationCode},</if>
<if test="supplierCode != null">supplier_code = #{supplierCode},</if>
<if test="supplierName != null">supplier_name = #{supplierName},</if>
<if test="materialCode != null">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if>
<if test="materialDescribe != null">material_describe = #{materialDescribe},</if>
<if test="materialBrand != null">material_brand = #{materialBrand},</if>
<if test="materialPhotourl != null">material_photo_url = #{materialPhotourl}</if>
<if test="materialProcessMethod != null">material_process_method = #{materialProcessMethod},</if>
<if test="materialUnit != null">material_unit = #{materialUnit},</if>
<if test="materialNoRmb != null">material_no_rmb = #{materialNoRmb},</if>
<if test="materialRmb != null">material_rmb = #{materialRmb},</if>
<if test="materialNum != null">material_num = #{materialNum},</if>
@ -129,6 +177,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialSum != null">material_sum = #{materialSum},</if>
<if test="materialNoRmbSum != null">material_no_rmb_sum = #{materialNoRmbSum},</if>
<if test="materialRmbSum != null">material_rmb_sum = #{materialRmbsum},</if>
<if test="materialRealNum != null">material_real_num = #{materialRealNum},</if>
<if test="materialRealNoRmb != null">material_real_no_rmb = #{materialRealNoRmb},</if>
<if test="materialRealRmb != null">material_real_rmb = #{materialRealRmb},</if>
<if test="materialRealNoRmbSum != null">material_real_no_rmb_sum = #{materialRealNoRmbSum},</if>
<if test="materialRealRmbSum != null">material_real_rmb_sum = #{materialRealRmbSum},</if>
<if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
<if test="eceiptStatus != null">eceipt_status = #{eceiptStatus},</if>
<if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
@ -168,5 +221,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectPurchaseOrderChildVo"/>
where purchase_order_code = #{purchaseOrderCode}
</select>
<select id="selectPurchaseOrderChildByOrderCodeTotal" parameterType="String" resultMap="PurchaseOrderChildResult">
select
supplier_code,supplier_name,
count(material_code) as material_amount,
sum(material_real_num) as material_sum,
sum(material_real_no_rmb_sum) as material_no_rmb_sum,
sum(material_real_rmb_sum) as material_rmb_sum,
payment_status,
eceipt_status
from purchase_order_child
where purchase_order_code = #{purchaseOrderCode} group by supplier_code
</select>
<select id="selectPurhcaseOrderStorageByPurchaseOrderCode" parameterType="String" resultMap="PurchaseOrderChildResult">
select p.purchase_order_child_id,p.purchase_order_code,p.purchase_plan_code,p.purchase_plan_correlation_code,
p.supplier_code,p.supplier_name,p.material_code,p.material_name,p.material_type,p.material_describe,
p.material_brand,p.material_photo_url,p.material_process_method,p.material_unit,p.material_no_rmb,
p.material_rmb,p.material_num,p.material_amount,p.material_sum,p.material_no_rmb_sum,p.material_rmb_sum,
p.material_real_num,p.material_real_no_rmb,p.material_real_rmb,p.material_real_no_rmb_sum,p.material_real_rmb_sum,
p.delivery_time,p.eceipt_status,p.payment_status,p.tax_rate,p.create_by,p.create_time,p.update_by,p.update_time,p.del_flag,
(select w.has_storage_num from warehouse_storage_order_detail as w where w.material_no = p.material_code and w.related_order_code = p.purchase_order_code and w.supplier_code = p.supplier_code) as has_storage_num,
(select w.notify_has_arrived_num from warehouse_storage_order_detail as w where w.material_no = p.material_code and w.related_order_code = p.purchase_order_code and w.supplier_code = p.supplier_code) as notify_has_arrived_num
from purchase_order_child as p where p.purchase_order_code = #{purchaseOrderCode};
</select>
</mapper>

10
ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml

@ -19,6 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="rmbSum" column="rmbSum" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="eceiptType" column="eceipt_type" />
<result property="arrivedTime" column="arrived_time" />
<result property="customerContact" column="customer_contact" />
<result property="contactNumber" column="contact_number" />
<result property="customerFax" column="customer_fax" />
@ -59,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseOrderVo">
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"
<if test="stockAddress!= null">stock_address,</if>
<if test="stockContact!= null">stock_contact,</if>
<if test="stockPhone!= null">stock_phone,</if>
<if test="arrivedTime != null">arrived_time,</if>
<if test="eceiptType != null">eceipt_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseOrderCode != null">#{purchaseOrderCode},</if>
@ -142,6 +147,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stockAddress!= null">#{stockAddress},</if>
<if test="stockContact!= null">#{stockContact},</if>
<if test="stockPhone!= null">#{stockPhone},</if>
<if test="arrivedTime != null">#{arrivedTime},</if>
<if test="eceiptType != null">#{eceiptType},</if>
</trim>
</insert>
@ -185,6 +192,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stockAddress!= null">stock_address = #{stockAddress},</if>
<if test="stockContact!= null">stock_contact = #{stockContact},</if>
<if test="stockPhone!= null">stock_phone = #{stockPhone},</if>
<if test="arrivedTime != null">arrived_time = #{arrivedTime},</if>
<if test="eceiptType != null">eceipt_type = #{eceiptType},</if>
</trim>
where purchase_order_id = #{purchaseOrderId}
</update>
@ -212,4 +221,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectPurchaseOrderVo"/>
where purchase_order_code = #{purchaseOrderCode}
</select>
</mapper>

4
ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml

@ -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
<foreach item="purchasePlanCode" collection="array" open="(" separator="," close=")">
#{purchasePlanCode}

205
ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html

@ -1,43 +1,48 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('采购入库单详情')" />
<th:block th:include="include :: header('暂收-采购单(采购入库)')" />
<th:block th:include="include :: datetimepicker-css" />
<style>.supplier-value span { margin-right: 10px;}</style>
<style>
.supplier-value span {margin-right: 10px;}
</style>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-purchaseStorage-detail" th:object="${warehouseStorageOrder}">
<input name="warehouseStorageId" th:field="*{warehouseStorageId}" type="hidden">
<form class="form-horizontal m" id="form-addPurchaseStorage-edit" th:object="${purchaseOrder}">
<input type="hidden" name=" warehouseCode" th:field="*{stockNo}"/>
<div class="form-group">
<label class="col-sm-4 control-label">采购单号:</label>
<label class="col-sm-3 control-label is-required">采购单号:</label>
<div class="col-sm-8">
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" class="form-control" type="text" readonly>
<input name="purchaseOrder" th:field="*{purchaseOrderCode}" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">入库类型</label>
<label class="col-sm-3 control-label is-required">入库类别</label>
<div class="col-sm-8">
<select name="warehouseStorageType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_storage_type')}" disabled>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseStorageType}"></option>
<select name="eceiptType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_storage_type')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">到货时间:</label>
<label class="col-sm-3 control-label is-required">到货时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="arrivedTime" th:value="${#dates.format(warehouseStorageOrder.arrivedTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" readonly disabled>
<input name="arrivedTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required readonly>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="container">
<!--供应商物料相关-->
<div class="row">
<div class="col-sm-12" id="tablesContainer">
<!-- 表格将在这里动态生成 -->
</div>
<div class="row" id="tablesContainer">
<!-- <div class="col-sm-12" >-->
<!-- &lt;!&ndash; 表格将在这里动态生成 &ndash;&gt;-->
<!-- </div>-->
</div>
</div>
</form>
@ -46,25 +51,27 @@
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript">
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]
var warehouseCode = [[${warehouseStorageOrder.warehouseCode}]]
var prefix = ctx + "purchase/purchaseStorage";
var purchaseOrder = [[${purchaseOrder}]];
var purchaseOrderChildList = [[${purchaseOrderChildList}]];
$("#form-purchaseStorage-detail").validate({focusCleanup: true});
var prefix = ctx + "purchase/purchaseOrder";
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialUnitDatas = [[${@dict.getType('sysUnitClassDatas')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
$("#form-addPurchaseStorage-edit").validate({ focusCleanup: true});
//生成的不同table的id集合
var tableDatas = [];
$(function() {
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
for (var purchaseOrderChild in purchaseOrderChildList) {
if (data.hasOwnProperty(purchaseOrderChild)) {
var supplierData = data[purchaseOrderChild];
createTableForSupplier(purchaseOrderChild, supplierData);
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取
$.getJSON(prefix + "/detailListGroupedBySupplier?qualityOrderCode=" + purchaseOrderCode, function(data) {
for (var supplierCode in data) {
if (data.hasOwnProperty(supplierCode)) {
var supplierData = data[supplierCode];
createTableForSupplier(supplierCode, supplierData);
}
}
});
});
function createTableForSupplier(supplierCode, supplierData) {
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase();
tableDatas.push(tableId);
@ -72,93 +79,73 @@
// 确保supplierData至少有一条记录,并从中提取供应商详细信息
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在
// 构建含有额外供应商信息的标题字符串
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A');
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + supplierInfo.supplierName ;
var $header = $('<h4>' + headerTitle + '</h4>');
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>');
$table.bootstrapTable({
data: supplierData,
columns: [
{checkbox: true},
{checkbox: false,visible: false},
{title: '供应商ID',field: 'supplierCode',visible: false},
{title: '料号',field: 'materialNo'},
{title: '料号',field: 'materialCode'},
{title: '物料名称',field: 'materialName'},
{title: '物料类型',field: 'materialType',},
{title: '物料图片地址',field: 'materialPhotourl',},
{title: '物料类型',field: 'materialType',
formatter: function (value,row, index) {
$.table.selectCategoryLabel(materialTypeDatas, value)
}
},
{title: '物料图片地址',field: 'materialPhotourl',
formatter: function (value, row, index) {
$.table.imageView(value)
}
},
{title: '物料描述',field: 'materialDescribe',},
{title: '物料品牌',field: 'materialBrand',},
{title: '物料单位',field: 'materialUnit',},
{title: '物料加工方式',field: 'materialProcessMethod',},
{title: '通知已到货数',field: 'notifyHasArrivedNum',},
{title: '已入库数',field: 'hasStorageNum',},
{title: '通知到货数',field: 'notifyArriveNum',},
]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
{title: '物料单位',field: 'materialUnit',
formatter:function (value) {
return $.table.selectDictLabel(materialUnitDatas, value);
}
//根据仓库ID查询仓库名称
$(document).ready(function() {
// 初始化时默认加载仓库ID列表
loadWarehouseCodes();
// 监听仓库ID下拉框的变化
$('#warehouseCode').on('change', function() {
var selectedWarehouseCode = $(this).val(); // 获取选中的仓库ID
if (selectedWarehouseCode) {
// 发起Ajax请求获取仓库名称
$.ajax({
type: 'GET',
url: ctx +'stock/stockInfo/getStockNameByWarehouseCode/' + selectedWarehouseCode,
dataType: 'json', // 假设返回的数据格式是JSON
success: function(data) {
console.log(data);
// 将获取到的仓库名称填充到输入框
if(data.data == null){
// 如果返回的数据有问题,可以给出提示或处理
$.modal.alertWarning('未能获取到仓库名称!');
},
{title: '物料加工方式',field: 'materialProcessMethod',
formatter:function (value) {
return $.table.selectDictLabel(processMethodDatas, value);
}
$('input[name="warehouseName"]').val(data.data.StockName);
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('Error:', textStatus, errorThrown);
$.modal.alertWarning('查询仓库名称时发生错误!');
{title: '计划采购数',field: 'materialNum',},
{title: '实际采购数',field: 'materialRealNum',},
{title: '交付时间',field: 'deliveryTime',},
{title: '通知已到货数',field: 'notifyHasArrivedNum',
formatter: function (value, row, index) {
if (value == null || value == '') {
return 0;
}
});
} else {
// 如果没有选择仓库ID,清空仓库名称输入框
$('input[name="warehouseName"]').val('');
return value;
}
});
});
// 加载仓库Id列表函数
function loadWarehouseCodes() {
var url = ctx + 'stock/stockInfo/getAllWarehouseCode';
$.ajax({
type: 'GET', // 请求类型
url: url, // 后端接口URL
dataType: 'json', // 预期服务器返回的数据类型
success: function(data) {
if (data && Array.isArray(data)) {
var selectElement = $('#warehouseCode'); // 获取仓库编号下拉框元素
// 清空下拉框现有选项
selectElement.empty();
// selectElement.append('<option value="">所有</option>');
// 遍历返回的数据,添加为下拉框的选项
$.each(data, function(index, item) {
// 仓库ID
selectElement.append('<option value="' + item.StockNO + '">' + item.StockNO + '</option>');
});
// $('#warehouseCode').val(stockNO);
} else {
$.modal.errMsg("数据为空");
},
{title: '已入库数',field: 'hasStorageNum',
formatter: function (value, row, index) {
if (value == null || value == '') {
return 0;
}
return value;
}
},
{title: '通知到货数',field: 'notifyArriveNum',
formatter: function (value, row, index) {
return '<input type="number" min="0" oninput="validity.valid || (value = 0)" data-id="notifyArriveNum" class="form-control" name="notifyArriveNum" value="'+value+'"';
}
}
]
});
$tableWrapper.append($header).append($table);
$('#tablesContainer').append($tableWrapper);
}
var purchaseOrderCode = [[${purchaseOrder.purchaseOrderCode}]];
var warehouseCode = [[${purchaseOrder.stockNo}]];
var warehouseName = [[${purchaseOrder.stockName}]];
var warehouseDetailAddress = [[${purchaseOrder.stockAddress}]];
function submitHandler() {
const storageOrderData = $("#form-purchaseStorage-detail").serializeArray().reduce((obj, item) => {
const storageOrderData = $("#form-addPurchaseStorage-edit").serializeArray().reduce((obj, item) => {
obj[item.name] = item.value;
return obj;
}, {});
@ -173,7 +160,8 @@
// 根据实际字段名调整
return {
"supplierCode": item.supplierCode,
"materialNo": item.materialNo,
"supplierName":item.supplierName,
"materialNo": item.materialCode,
"materialName": item.materialName,
"materialType": item.materialType,
"materialPhotourl": item.materialPhotourl,
@ -183,31 +171,30 @@
"materialProcessMethod": item.materialProcessMethod,
"notifyHasArrivedNum": item.notifyHasArrivedNum,
"actualHasArrivedNum": item.actualHasArrivedNum,
"temporaryHasQualifiedNum": item.temporaryHasQualifiedNum,
"hasStorageNum": item.hasStorageNum,
"notifyArriveNum": item.notifyArriveNum,
"actualArriveNum": item.actualArriveNum,
"temporaryQualifiedNum": item.temporaryQualifiedNum,
"temporaryRemark": item.temporaryRemark,
"temporaryReportUrl": item.temporaryReportUrl,
"storageNum": item.storageNum,
"storageLocation": item.storageLocation,
"deliveryInspectionTime":item.deliveryTime,
"hasStorageNum": item.hasStorageNum, //已入库数量
"notifyArriveNum": item.notifyArriveNum, //通知到货数量
"actualArriveNum": item.actualArriveNum, //实际到货数量
"relatedOrderCode":purchaseOrderCode,
"warehouseCode":warehouseCode,
"warehouseName":warehouseName,
"warehouseDetailAddress":warehouseDetailAddress,
// ...其他字段
};
});
allMaterialDataList = allMaterialDataList.concat(materialDataList);
});
}
const combinedData = Object.assign({}, storageOrderData, {warehouseStorageOrderDetailList: allMaterialDataList});
const combinedData = Object.assign({}, storageOrderData, {
warehouseStorageOrderDetailList: allMaterialDataList
});
// 合并表单数据和表格数据
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData);
console.log(combinedData)
// 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/detail", jsonData);
$.operate.saveJson(prefix + "/addPurchaseOrderStorage", jsonData);
}
$("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",

13
ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html

@ -201,9 +201,7 @@
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.purchaseOrderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
if (row.auditStatus === '1' && row.useStatus === '1' && row.eceiptStatus === '1') {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="addPurchaseOrderStorage(\'' + row.purchaseOrderCode + '\')"><i class="fa fa-edit"></i>入库通知</a> ');
}
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.modal.open(\'添加入库通知检验单\',\'' + prefix+"/addPurchaseOrderStorage/"+row.purchaseOrderCode + '\')">入库通知</a> ');
return actions.join('');
}
}
@ -213,15 +211,13 @@
});
initChildTable = function(index, row, $detail) {
$("#"+"purchase_order_child_"+row.id).bootstrapTable({
url: ctx + "purchase/purchaseOrderChild/list",
url: ctx + "purchase/purchaseOrderChild/totalList",
method: 'post',
contentType: "application/x-www-form-urlencoded",
queryParams : {
purchaseOrderCode: row.purchaseOrderCode,
},
columns: [
{title: '采购单子表编号',field: 'purchaseOrderChildId',visible: false},
{title: '关联采购订单号',field: 'purchaseOrderCode',visible: false},
{title: '供应商ID',field: 'supplierCode',},
{title: '供应商名称',field: 'supplierName',},
{title: '物料合计',field: 'materialAmount',},
@ -315,9 +311,8 @@
});
}
function addPurchaseOrderStorage(purchaseOrderCode){
$.model.open(ctx + "purchase/purchaseOrder/"+purchaseOrderCode, "新增入库检验通知", 800, 500);
}
function tableSet(data) {
var options = {
id: "closeCaseTable",

68
ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html

@ -171,7 +171,7 @@
'<span id="supplierMaterialNoRmb-' + tableId + '" class="supplierMaterialNoRmb">' + supplier.materialNoRmb +
'</span>'+ ' RMB 最新含税采购价: ' +
'<span class="supplierMaterialRmb">' + supplier.materialRmb + '</span> RMB ' +
'<span class="supplierPurchasePlanCode" hidden="hidden" >' + material.purchasePlanCodes + '</span>' +
'<span class="supplierPurchasePlanCode" hidden="hidden" >' + material.planCodes + '</span>' +
'<span class="supplierCorrelationCode" hidden="hidden" >' + material.correlationCodes + '</span>' +
'<span class="supplierPurchaseQuoteCode" hidden="hidden" >' + supplier.purchaseQuoteCode + '</span>' +
'</div>' +
@ -334,7 +334,7 @@
return $.table.selectDictLabel(sysUnitClassDatas, value);
}
},
{title: '计划采购数', field: 'planPurchaseNum'},
{title: '计划采购数', field: 'materialNum'},
],
});
}
@ -355,23 +355,35 @@
let materialObj = materialList[index];
if (typeof materialObj === 'undefined') return;
$('#' + 'material-' + tableId).find('.supplier-card').each(function(supplierIndex, supplierCard) {
var supplierCode = $(supplierCard).find('.supplierCode').text().trim();
var supplierName = $(supplierCard).find('.supplierName').text().trim();
var materialRealNum = parseInt($(supplierCard).find('.supplierMaterialNum').val(), 10) || 0;
var materialRealRmb = parseInt($(supplierCard).find('.supplierMaterialRmb').val(), 10) || 0;
var materialRealNoRmb = parseInt($(supplierCard).find('.supplierMaterialNoRmb').val(), 10) || 0;
var deliveryTime = $(supplierCard).find('.supplierDeliveryTime').val();
var purchasePlanCode = $(supplierCard).find('.supplierPurchasePlanCode').text().trim();
var correlationCode = $(supplierCard).find('.supplierCorrelationCode').text().trim();
var purchaseQuoteCode = $(supplierCard).find('.supplierPurchaseQuoteCode').text().trim();
var materialData = {
materialCode: materialObj.materialCode,
materialName: materialObj.materialName,
materialType: materialObj.materialType,
materialBrand:materialObj.brand,
describe: materialObj.describe,
processMethod:materialObj.processMethod,
unit:materialObj.unit,
supplierCode: $(supplierCard).find('.supplierCode').text().trim(),
supplierName: $(supplierCard).find('.supplierName').text().trim(),
materialNoRmb: parseFloat($(supplierCard).find('.supplierMaterialNoRmb').text().trim()),
materialRmb: parseFloat($(supplierCard).find('.supplierMaterialRmb').text().trim()),
materialNum: parseInt($(supplierCard).find('.supplierMaterialNum').val(), 10) || 0,
deliveryTime: $(supplierCard).find('.supplierDeliveryTime').val(),
purchasePlanCode:$(supplierCard).find('.supplierPurchasePlanCode').text().trim(),
correlationCode:$(supplierCard).find('.supplierCorrelationCode').text().trim(),
purchaseQuoteCode: $(supplierCard).find('.supplierPurchaseQuoteCode').text().trim(),
materialDescribe: materialObj.describe,
materialProcessMethod:materialObj.processMethod,
materialUnit:materialObj.unit,
materialNum: materialObj.materialNum,
supplierCode: supplierCode,
supplierName: supplierName,
materialRealNum: materialRealNum,
materialRealRmb: materialRealRmb,
materialRealNoRmb: materialRealNoRmb,
materialRealRmbSum: materialRealRmb * materialRealNum,
materialRealNoRmbSum: materialRealNoRmb * materialRealNum,
deliveryTime: deliveryTime,
purchasePlanCode:purchasePlanCode,
correlationCode:correlationCode,
purchaseQuoteCode: purchaseQuoteCode,
};
purchaseOrder.purchaseOrderChildList.push(materialData);
});
@ -390,31 +402,13 @@
purchaseOrder.totalRmbSum = totalRmbSum.toFixed(2);
// 发送数据到后端API
$.ajax({
type: "POST",
url: prefix + "/addPurchaseOrder",
data: JSON.stringify(purchaseOrder),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
if (response.code === 200) {
alert("采购订单添加成功!");
} else {
alert("采购订单添加失败:" + response.msg);
}
},
error: function (error) {
console.error("请求失败:", error);
alert("提交过程中发生错误,请重试。");
}
});
$.operate.saveJson(prefix + "/addPurchaseOrder",JSON.stringify(purchaseOrder));
// 如果需要在页面加载时初始化合计或重新绑定事件处理器,这部分应放在更合适的位置,不在此函数内
}
}
//获取仓库相关信息
function getWarehouseInfo() {
$("#inputWarehouseID").select2({
$("#stockNo").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择供应商",
@ -438,11 +432,9 @@
escapeMarkup: function (markup) {return markup;},
}
})
$("#inputWarehouseID").on("select2:select", function (e) {
$("#stockNo").on("select2:select", function (e) {
var data = e.params.data;
$("#inputWarehouseName").val(data.StockName);
$("#inputReceiver").val(data.stockmanager);
$("#inputAddressDetails").val(data.stockAddr);
$("#stockName").val(data.StockName);
});
}
</script>

5
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},

Loading…
Cancel
Save