Browse Source

[feat]

采购管理的采购订单:新增采购报价根据提供的采购计划个采购计划关联单号,传入采购单子表数据中。
dev
zhangsiqi 5 months ago
parent
commit
d083eb4c2d
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderChildController.java
  2. 119
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java
  3. 77
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java
  4. 23
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java
  5. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderChildMapper.java
  6. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java
  7. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderChildService.java
  8. 2
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java
  9. 7
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderChildServiceImpl.java
  10. 12
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  11. 10
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  12. 31
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml
  13. 80
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html

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

@ -9,11 +9,7 @@ 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 org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.purchase.domain.PurchaseOrderChild;

119
ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java

@ -15,16 +15,17 @@ 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.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
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.*;
import com.ruoyi.purchase.domain.exportDto.PurchaseMaterialDto;
import com.ruoyi.purchase.domain.exportDto.PurchaseOrderDto;
import com.ruoyi.purchase.mapper.PurchaseOrderChildMapper;
import com.ruoyi.purchase.service.IPurchaseMaterialService;
import com.ruoyi.purchase.service.IPurchaseOrderChildService;
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 org.apache.poi.ss.usermodel.HorizontalAlignment;
@ -62,7 +63,10 @@ public class PurchaseOrderController extends BaseController
@Autowired
private IPurchaseMaterialService purchaseMaterialService;
@Autowired
private PurchaseOrderChildMapper purchaseOrderChildService;;
private IPurchaseOrderChildService purchaseOrderChildService;;
@Autowired
private IPurchasePlanService purchasePlanService;
@Autowired
private RedisCache redisCache;
@ -116,9 +120,18 @@ public class PurchaseOrderController extends BaseController
@Log(title = "采购订单", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(@Valid @RequestBody PurchaseOrder purchaseOrder) {
public AjaxResult addSave( @RequestBody PurchaseOrder purchaseOrder) {
// 数据校验,确保前端传入数据格式正确
// 生成采购订单编号
// 执行主表插入操作
return toAjax(purchaseOrderService.insertPurchaseOrder(purchaseOrder)); // 假设toAjax方法处理成功逻辑
}
@RequiresPermissions("purchase:purchaseOrder:add")
@Log(title = "采购订单", businessType = BusinessType.INSERT)
@PostMapping("/addPurchaseOrder")
@ResponseBody
public AjaxResult addPurchasePlantoPuserchaseOrder(@RequestBody PurchaseOrder purchaseOrder) {
// 数据校验,确保前端传入数据格式正确
validatePurchaseOrder(purchaseOrder);
// 生成采购订单编号
purchaseOrder.setPurchaseOrderCode(redisCache.generateBillNo("CG"));
// 初始化累加变量
@ -128,25 +141,32 @@ public class PurchaseOrderController extends BaseController
BigDecimal materialRmbSum = BigDecimal.ZERO;
Long materialNum = 0L;
int supplierNum = 0;
// 遍历处理采购订单子表
if (!CollectionUtils.isEmpty(purchaseOrder.getPurchaseOrderChildList())) {
supplierNum = purchaseOrder.getPurchaseOrderChildList().size();
}
if (purchaseOrder.getPurchaseOrderChildList() != null) {
for (PurchaseOrderChild child : purchaseOrder.getPurchaseOrderChildList()) {
if (child.getCorrelationCode().contains(",")) {
String[] correlationCodes = child.getCorrelationCode().split(",");
for (int i = 0; i < correlationCodes.length; i++) {
String correlationCode = correlationCodes[i];
String planCode = child.getPurchasePlanCode().split(",")[i];
if (correlationCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
// 累加物料数量和金额
for (PurchaseQuoteChild quote : child.getPurchaseQuoteChildList()) {
//获取物料供应商采购价格
BigDecimal suplierMaterialNoRmb = quote.getMaterialNoRmb();
BigDecimal suplierMaterialNoRmb = child.getMaterialNoRmb();
// 获取物料供应商采购价格
BigDecimal suplierMaterialRmb = quote.getMaterialRmb();
BigDecimal suplierMaterialRmb = child.getMaterialRmb();
// 获取物料数量
Long suplierMaterialNum = quote.getMaterialNum();
Long suplierMaterialNum = child.getMaterialNum();
// 累加物料数量
materialNum += suplierMaterialNum;
// 累加不含税物料价格
materialNoRmb = materialNoRmb.add(suplierMaterialNoRmb);
// 累加含税物料价格
materialRmb = materialRmb.add(suplierMaterialRmb);
child.setPurchasePlanCode(quote.getPurchasePlanCode());
// 计算不含税物料总价
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 计算物料含税总价
@ -155,46 +175,48 @@ public class PurchaseOrderController extends BaseController
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal);
// 设置采购报价单编号和供应商信息到QuoteChild
quote.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode());
child.setSupplierCode(quote.getSupplierCode());
child.setSupplierName(quote.getSupplierName());
material.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode());
material.setSupplierCode(child.getSupplierCode());
material.setSupplierName(child.getSupplierName());
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.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setCorrelationCode(correlationCode);
material.setPurchasePlanCode(planCode);
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
// 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(child);
PurchasePlan plan = new PurchasePlan();
plan.setPurchasePlanCode(child.getPurchasePlanCode());
plan.setPurchasePlanStatus("1");
int result = purchasePlanService.updatePurchasePlan(plan);
}
}
child.setMaterialNoRmb(BigDecimal.ZERO);
}
// 确保供应商数量统计准确
if (quote.getSupplierCode() != null) {
if (child.getSupplierCode() != null) {
supplierNum++;
}
}
// 设置累加的物料信息到子表
child.setMaterialNoRmb(materialNoRmb);
child.setMaterialRmb(materialRmb);
child.setMaterialNum(materialNum);
// 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(child);
}
}
// 遍历处理采购订单子表
// 设置累加的物料信息到子表
purchaseOrder.setMaterialSum(Math.toIntExact(materialNum));
purchaseOrder.setNoRmbSum(materialNoRmbSum);
purchaseOrder.setRmbSum(materialRmbSum);
// 设置主表的供应商数量
purchaseOrder.setSupplierNum(supplierNum);
// 执行主表插入操作
return toAjax(purchaseOrderService.insertPurchaseOrder(purchaseOrder)); // 假设toAjax方法处理成功逻辑
}
// 数据校验逻辑
private void validatePurchaseOrder(PurchaseOrder purchaseOrder) {
if (CollectionUtils.isEmpty(purchaseOrder.getPurchaseOrderChildList())) {
try {
throw new Exception("采购订单子项不能为空");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
// 可以添加更多校验逻辑
}
/**
* 修改采购订单
*/
@ -213,6 +235,18 @@ public class PurchaseOrderController extends BaseController
mmap.put("purchaseOrderChild", purchaseOrderChild);
return prefix + "/detail";
}
@GetMapping("/addPurchaseOrderStorage/{purchaseOrderCode}")
public String addPurchaseOrderStorage(@PathVariable("purchaseOrderCode") String purchaseOrderCode,ModelMap mmap){
//purchasePlanCodes去除重复数据,purchasePlanCodeArray作为数组类型去除
//查询相关采购计划数据
PurchaseOrder purchaseOrderList = purchaseOrderService.selectPurchaseOrderByOrderCode(purchaseOrderCode);
//根据采购计划编号查询对应的采购报价数据
List<PurchaseOrderChild> purchaseOrderChildList = purchaseOrderChildService.selectPurchaseOrderChildByOrderCode(purchaseOrderCode);
//再根据采购计划编号分组查询对应的采购报价数据分组
mmap.put("purchaseOrderList", purchaseOrderList);
mmap.put("purchaseOrderChildList", purchaseOrderChildList);
return prefix + "/addPurchaseOrderStorage";
}
@ResponseBody
@RequestMapping("/detailListGroupedBySupplier")
public Map<String, List<PurchaseOrderChild>> detailListGroupedBySupplier(String qualityOrderCode) {
@ -288,7 +322,6 @@ public class PurchaseOrderController extends BaseController
// 创建列合并工具类对象
// ExcelFillCellMergePrevColUtils mergePrevColUtils = new ExcelFillCellMergePrevColUtils();
List<PurchaseMaterial> purchaseMaterialList = purchaseMaterialService.selectPurchaseMaterialList(purchaseMaterial);
List<PurchaseMaterialDto> purchaseMaterialDtoList = new ArrayList<>();
double total = 0.00;

77
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrder.java

@ -5,6 +5,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.List;
/**
@ -41,9 +42,9 @@ public class PurchaseOrder extends BaseEntity
@Excel(name="数量合计")
private Integer materialSum;
@Excel(name="不含税总价(RMB)")
private Double noRmbSum;
private BigDecimal noRmbSum;
@Excel(name="含税总价")
private Double rmbSum;
private BigDecimal rmbSum;
/** 供应商代码 */
@Excel(name = "供应商代码")
private String supplierCode;
@ -173,14 +174,76 @@ public class PurchaseOrder extends BaseEntity
@Excel(name = "修改时间")
private String updateInfoTime;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/*仓库ID*/
private String stockNo;
/*仓库名称*/
private String stockName;
/*仓库收货地址*/
private String stockAddress;
/*仓库收货电话*/
private String stockPhone;
/*仓库收货人*/
private String stockContact;
/** 备用一 */
private String standbyOne;
/** 备用二 */
private String standbyTwo;
private List<PurchaseOrderChild> purchaseOrderChildList;
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getStockNo() {
return stockNo;
}
public void setStockNo(String stockNo) {
this.stockNo = stockNo;
}
public String getStockName() {
return stockName;
}
public void setStockName(String stockName) {
this.stockName = stockName;
}
public String getStockAddress() {
return stockAddress;
}
public void setStockAddress(String stockAddress) {
this.stockAddress = stockAddress;
}
public String getStockPhone() {
return stockPhone;
}
public void setStockPhone(String stockPhone) {
this.stockPhone = stockPhone;
}
public String getStockContact() {
return stockContact;
}
public void setStockContact(String stockContact) {
this.stockContact = stockContact;
}
public List<PurchaseOrderChild> getPurchaseOrderChildList() {
return purchaseOrderChildList;
}
@ -269,19 +332,19 @@ public class PurchaseOrder extends BaseEntity
this.materialSum = materialSum;
}
public Double getNoRmbSum() {
public BigDecimal getNoRmbSum() {
return noRmbSum;
}
public void setNoRmbSum(Double noRmbSum) {
public void setNoRmbSum(BigDecimal noRmbSum) {
this.noRmbSum = noRmbSum;
}
public Double getRmbSum() {
public BigDecimal getRmbSum() {
return rmbSum;
}
public void setRmbSum(Double rmbSum) {
public void setRmbSum(BigDecimal rmbSum) {
this.rmbSum = rmbSum;
}

23
ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java

@ -25,9 +25,14 @@ public class PurchaseOrderChild extends BaseEntity
/** 关联采购订单号 */
@Excel(name = "关联采购订单号")
private String purchaseOrderCode;
/*关联计划单号*/
private String purchasePlanCode;
/*采购计划关联单号*/
private String correlationCode;;
@Excel(name = "关联报价编号字段")
private String purchaseQuoteCode;
/** 供应商代码 */
@Excel(name = "供应商代码")
private String supplierCode;
@ -297,6 +302,22 @@ public class PurchaseOrderChild extends BaseEntity
return standbyTwo;
}
public String getCorrelationCode() {
return correlationCode;
}
public void setCorrelationCode(String correlationCode) {
this.correlationCode = correlationCode;
}
public String getPurchaseQuoteCode() {
return purchaseQuoteCode;
}
public void setPurchaseQuoteCode(String purchaseQuoteCode) {
this.purchaseQuoteCode = purchaseQuoteCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

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

@ -74,4 +74,6 @@ public interface PurchaseOrderChildMapper
* @return 结果
*/
public int restorePurchaseOrderChildById(Long purchaseOrderChildId);
List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode);
}

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

@ -61,4 +61,6 @@ public interface PurchaseOrderMapper
public int deletePurchaseOrderByIds(String[] purchaseOrderIds);
public List<PurchaseOrder> selectOrderByIdDesc();
PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode);
}

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

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

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

@ -61,4 +61,6 @@ public interface IPurchaseOrderService
public int deletePurchaseOrderById(Long purchaseOrderId);
public String getId();
PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode);
}

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

@ -9,6 +9,7 @@ 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;
import org.springframework.transaction.annotation.Transactional;
/**
* 采购订单子表Service业务层处理
@ -53,6 +54,7 @@ public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertPurchaseOrderChild(PurchaseOrderChild purchaseOrderChild)
{
String loginName = ShiroUtils.getLoginName();
@ -123,4 +125,9 @@ public class PurchaseOrderChildServiceImpl implements IPurchaseOrderChildService
{
return purchaseOrderChildMapper.restorePurchaseOrderChildById(purchaseOrderChildId);
}
@Override
public List<PurchaseOrderChild> selectPurchaseOrderChildByOrderCode(String purchaseOrderCode){
return purchaseOrderChildMapper.selectPurchaseOrderChildByOrderCode(purchaseOrderCode);
}
}

12
ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java

@ -2,11 +2,14 @@ package com.ruoyi.purchase.service.impl;
import com.ruoyi.common.core.redis.RedisCache;
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.mapper.PurchaseOrderMapper;
import com.ruoyi.purchase.service.IPurchaseOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.List;
@ -57,9 +60,12 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int insertPurchaseOrder(PurchaseOrder purchaseOrder)
{
//根据上传的物料信息做采购订单子项
purchaseOrder.setCreateTime(DateUtils.getNowDate());
purchaseOrder.setCreateBy(ShiroUtils.getLoginName());
//
return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder);
}
@ -73,6 +79,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
@Override
public int updatePurchaseOrder(PurchaseOrder purchaseOrder)
{
purchaseOrder.setCreateTime(DateUtils.getNowDate());
purchaseOrder.setCreateBy(ShiroUtils.getLoginName());
return purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
}
@ -104,4 +112,8 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
public String getId() {
return redisCache.generateBillNo("CG");
}
@Override
public PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode){
return purchaseOrderMapper.selectPurchaseOrderByOrderCode(purchaseOrderCode);
}
}

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

@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplierName != null">supplier_name,</if>
<if test="materialCode != null">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="materialNormb != null">material_no_rmb,</if>
<if test="materialNoRmb != null">material_no_rmb,</if>
<if test="materialRmb != null">material_rmb,</if>
<if test="materialNum != null">material_num,</if>
<if test="materialAmount != null">material_amount,</if>
@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplierName != null">#{supplierName},</if>
<if test="materialCode != null">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialNoRmb != null">#{materialNormb},</if>
<if test="materialNoRmb != null">#{materialNoRmb},</if>
<if test="materialRmb != null">#{materialRmb},</if>
<if test="materialNum != null">#{materialNum},</if>
<if test="materialAmount != null">#{materialAmount},</if>
@ -163,4 +163,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update purchase_order_child set del_flag = '0' where purchase_order_child_id = #{purchaseOrderChildId}
</update>
<select id="selectPurchaseOrderChildByOrderCode" parameterType="String" resultMap="PurchaseOrderChildResult">
<include refid="selectPurchaseOrderChildVo"/>
where purchase_order_code = #{purchaseOrderCode}
</select>
</mapper>

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

@ -49,6 +49,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateInfoTime" column="update_info_time" />
<result property="standbyOne" column="standby_one" />
<result property="standbyTwo" column="standby_two" />
<result property="delFlag" column="del_flag" />
<result property="stockNo" column="stock_no" />
<result property="stockName" column="stock_name" />
<result property="stockAddress" column="stock_address" />
<result property="stockContact" column="stock_contact" />
<result property="stockPhone" column="stock_phone" />
</resultMap>
<sql id="selectPurchaseOrderVo">
@ -58,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
purchase_category, purchase_commander, customer_order_number, remark_content,
close_case_no, close_case_name, close_case_time, confirm_no, confirm_name,
confirm_time, audit_no, audit_name, audit_time, approve_no, approve_name,
del_flag, stock_no, stock_name, stock_address, stock_contact, stock_phone,
approve_time, standby_one, standby_two from purchase_order
</sql>
@ -69,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="supplierName != null and supplierName != ''"> and supplier_name like concat('%', #{supplierName}, '%')</if>
<if test="params.beginBillingDate != null and params.beginBillingDate != '' and params.endBillingDate != null and params.endBillingDate != ''"> and billing_date between #{params.beginBillingDate} and #{params.endBillingDate}</if>
</where>
order by create_time desc
</select>
<select id="selectPurchaseOrderById" parameterType="Long" resultMap="PurchaseOrderResult">
@ -99,6 +107,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="standbyTwo != null">standby_two,</if>
<if test="createTime != null" >create_time,</if>
<if test="createBy != null" >create_by,</if>
<if test="delFlag != null" >del_flag,</if>
<if test="stockNo!= null">stock_no,</if>
<if test="stockName!= null">stock_name,</if>
<if test="stockAddress!= null">stock_address,</if>
<if test="stockContact!= null">stock_contact,</if>
<if test="stockPhone!= null">stock_phone,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseOrderCode != null">#{purchaseOrderCode},</if>
@ -122,6 +136,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="standbyTwo != null">#{standbyTwo},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="stockNo!= null">#{stockNo},</if>
<if test="stockName!= null">#{stockName},</if>
<if test="stockAddress!= null">#{stockAddress},</if>
<if test="stockContact!= null">#{stockContact},</if>
<if test="stockPhone!= null">#{stockPhone},</if>
</trim>
</insert>
@ -159,6 +179,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="approveTime != null">approve_time = #{approveTime},</if>
<if test="standbyOne != null">standby_one = #{standbyOne},</if>
<if test="standbyTwo != null">standby_two = #{standbyTwo},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="stockNo!= null">stock_no = #{stockNo},</if>
<if test="stockName!= null">stock_name = #{stockName},</if>
<if test="stockAddress!= null">stock_address = #{stockAddress},</if>
<if test="stockContact!= null">stock_contact = #{stockContact},</if>
<if test="stockPhone!= null">stock_phone = #{stockPhone},</if>
</trim>
where purchase_order_id = #{purchaseOrderId}
</update>
@ -181,4 +207,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectPurchaseOrderVo"/>
WHERE purchase_order_code like '%PO%' ORDER BY purchase_order_id DESC
</select>
<select id="selectPurchaseOrderByOrderCode" parameterType="String" resultMap="PurchaseOrderResult">
<include refid="selectPurchaseOrderVo"/>
where purchase_order_code = #{purchaseOrderCode}
</select>
</mapper>

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

@ -75,10 +75,10 @@
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="importPurchaseOrder()" shiro:hasPermission="purchase:purchaseOrder:add">
<i class="fa fa-plus"></i> 导入
<i class="fa fa-plus"></i> 导入合同
</a>
<a class="btn btn-warning" onclick="exportPurchaseOrder()" shiro:hasPermission="purchase:purchaseOrder:export">
<i class="fa fa-download"></i> 导出
<i class="fa fa-download"></i> 导出合同
</a>
<a class="btn btn-primary" onclick="reviewCloseCase()" shiro:hasPermission="purchase:purchaseOrder:close">
<i class="fa fa-hand-grab-o"></i> 结案
@ -102,38 +102,23 @@
</div>
<div class="modal-body" style="height: 180px">
<form id="form-closeCase-edit">
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label is-required">订单id</label>
<div class="form-group" hidden = "hidden">
<label class="col-sm-3 control-label is-required">采购订单ID</label>
<div class="col-sm-8">
<input id="purchaseOrderId" name="purchaseOrderId" class="form-control" type="text" required
readonly>
<input name="purchaseOrderId" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label ">结案否</label>
<div class="form-group" >
<label class="col-sm-3 control-label is-required">采购单号</label>
<div class="col-sm-8">
<select id="closeCaseNo" name="closeCaseNo" class="form-control"
th:with="type=${@dict.getType('sys_whether')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
<input name="purchaseOrderCode" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label ">结案时间:</label>
<table id="closeCaseTable"> </table>
<div class="form-row">
<label class="col-sm-3 control-label is-required">备注:</label>
<div class="col-sm-8">
<div class="input-group date">
<input id="closeCaseTime" name="closeCaseTime" class="form-control"
placeholder="yyyy-mm-dd hh:ii:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label ">结案人:</label>
<div class="col-sm-8">
<!-- <input id="auditName" name="auditName" class="form-control" type="text" th:value="${@permission.getPrincipalProperty('userName')}">-->
<input id="closeCaseName" name="closeCaseName" class="form-control" type="text">
<textarea id="remark" name="remark" class="form-control" rows="6"></textarea>
</div>
</div>
</form>
@ -172,9 +157,10 @@
detailView: true,
fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数
onExpandRow:function(index, row, $detail){
$detail.html('<table class="table-container" id="purchase_order_'+row.id+'"></table>');
initChildTable(row, index, $detail);
onExpandRow : function(index,row,$detail){
$detail.html('<table class="table-container" id="purchase_order_child_'+row.id+'"></table>').find('table');
// 一阶
initChildTable(index,row,$detail);
},
columns: [
{checkbox: true},
@ -215,6 +201,9 @@
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> ');
}
return actions.join('');
}
}
@ -223,13 +212,12 @@
$.table.init(options);
});
initChildTable = function(index, row, $detail) {
$("#"+"purchase_order_"+row.id).bootstrapTable({
$("#"+"purchase_order_child_"+row.id).bootstrapTable({
url: ctx + "purchase/purchaseOrderChild/list",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {
purchaseOrderCode: row.purchaseOrderCode
purchaseOrderCode: row.purchaseOrderCode,
},
columns: [
{title: '采购单子表编号',field: 'purchaseOrderChildId',visible: false},
@ -326,6 +314,32 @@
}
});
}
function addPurchaseOrderStorage(purchaseOrderCode){
$.model.open(ctx + "purchase/purchaseOrder/"+purchaseOrderCode, "新增入库检验通知", 800, 500);
}
function tableSet(data) {
var options = {
id: "closeCaseTable",
modalName: "采购订单",
search: false,
showExport: false,
showSearch: false,
showRefresh: false,
showColumns: false,
showToggle: false,
showFooter: false,
columns: [
{title: '采购订单编号',field: 'purchaseOrderCode',align: 'center',visible: false,},
{title: '采购单子表ID',field: 'purchaseOrderChildId', align: 'center',},
{title: '供应商名称',field: 'supplierName', align: 'center',},
{title: '供应商名称',field: 'supplierName',align: 'center',},
{title: '打款结案状态',field: 'paymentStatus',align: 'center',
formatter: function (value, row, index) {return $.table.selectDictLabel(paymentStatusDatas, value);}
},
],
}
}
</script>
</body>
</html>
Loading…
Cancel
Save