Browse Source

[feat] 修改仓库mapper,修改采购入库单,合计物料,通知入库管理数据为通知入库单表中的表号。

dev
zhangsiqi 4 months ago
parent
commit
1b0b3c937f
  1. 20
      ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java
  2. 10
      ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java
  3. 6
      ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java
  4. 5
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java
  5. 261
      ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java
  6. 2
      ruoyi-admin/src/main/java/com/ruoyi/stock/mapper/StockInfoMapper.java
  7. 19
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  8. 125
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml
  9. 8
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml
  10. 16
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  11. 42
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html
  12. 98
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  13. 3
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html

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

@ -110,28 +110,26 @@ public class PurchaseOrderController extends BaseController
@RequiresPermissions("purchase:purchaseOrder:list") @RequiresPermissions("purchase:purchaseOrder:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public TableDataInfo list(PurchaseOrderVo purchaseOrderVo) public TableDataInfo list(PurchaseOrder purchaseOrder)
{ {
SysUser curUser = ShiroUtils.getSysUser();
Long userId = curUser.getUserId();
Set<String> roleKeys = roleService.selectRoleKeys(userId);
// 采购角色只能看到自己创建的数据 // 采购角色只能看到自己创建的数据
startPage(); startPage();
List<PurchaseOrderVo> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrderVo); List<PurchaseOrder> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder);
return getDataTable(list); return getDataTable(list);
} }
/** /**
*
* 导出采购订单列表 * 导出采购订单列表
*/ */
@RequiresPermissions("purchase:purchaseOrder:export") @RequiresPermissions("purchase:purchaseOrder:export")
@Log(title = "采购订单", businessType = BusinessType.EXPORT) @Log(title = "采购订单", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(PurchaseOrderVo purchaseOrder) public AjaxResult export(PurchaseOrder purchaseOrder)
{ {
List<PurchaseOrderVo> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); List<PurchaseOrder> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder);
ExcelUtil<PurchaseOrderVo> util = new ExcelUtil<PurchaseOrderVo>(PurchaseOrderVo.class); ExcelUtil<PurchaseOrder> util = new ExcelUtil<PurchaseOrder>(PurchaseOrder.class);
return util.exportExcel(list, "采购订单数据"); return util.exportExcel(list, "采购订单数据");
} }
@ -206,7 +204,7 @@ public class PurchaseOrderController extends BaseController
@RequiresPermissions("purchase:purchaseOrder:addPurchaseOrderStorage") @RequiresPermissions("purchase:purchaseOrder:addPurchaseOrderStorage")
@Log(title = "采购订单", businessType = BusinessType.INSERT) @Log(title = "采购订单", businessType = BusinessType.INSERT)
@PostMapping("/addPurchaseOrderStorage") @PostMapping("/addPurchaseOrderStorageSave")
@ResponseBody @ResponseBody
public AjaxResult addPurchaseOrderStorageSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) { public AjaxResult addPurchaseOrderStorageSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) {
// 数据校验,确保前端传入数据格式正确 // 数据校验,确保前端传入数据格式正确
@ -249,7 +247,7 @@ public class PurchaseOrderController extends BaseController
Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String processInstanceId = task.getProcessInstanceId(); String processInstanceId = task.getProcessInstanceId();
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult(); ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
PurchaseOrderVo purchaseOrderVo = purchaseOrderService.selectPurchaseOrderById(new Long(processInstance.getBusinessKey())); PurchaseOrder purchaseOrderVo = purchaseOrderService.selectPurchaseOrderById(new Long(processInstance.getBusinessKey()));
mmap.put("formData", purchaseOrderVo); mmap.put("formData", purchaseOrderVo);
mmap.put("taskId", taskId); mmap.put("taskId", taskId);
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1); String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
@ -308,7 +306,7 @@ public class PurchaseOrderController extends BaseController
* 自动绑定页面字段 * 自动绑定页面字段
*/ */
@ModelAttribute("/preloadObj") @ModelAttribute("/preloadObj")
public PurchaseOrderVo getObj(@RequestParam(value = "id", required = false) Long id, HttpSession session) { public PurchaseOrder getObj(@RequestParam(value = "id", required = false) Long id, HttpSession session) {
if (id != null) { if (id != null) {
return purchaseOrderService.selectPurchaseOrderById(id); return purchaseOrderService.selectPurchaseOrderById(id);
} }

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

@ -144,7 +144,7 @@ public class PurchaseOrderChild extends BaseEntity
@Excel(name = "通知到货数量") @Excel(name = "通知到货数量")
private Integer notifyArriveNum; private Integer notifyArriveNum;
private Integer notifyHasArriveNum; private Integer notifyHasArrivedNum;
/** 实际已到货数量 */ /** 实际已到货数量 */
@Excel(name = "实际已到货数量") @Excel(name = "实际已到货数量")
@ -152,12 +152,12 @@ public class PurchaseOrderChild extends BaseEntity
private Integer notifyArrivedNum; private Integer notifyArrivedNum;
public Integer getNotifyHasArriveNum() { public Integer getNotifyHasArrivedNum() {
return notifyHasArriveNum; return notifyHasArrivedNum;
} }
public void setNotifyHasArriveNum(Integer notifyHasArriveNum) { public void setNotifyHasArrivedNum(Integer notifyHasArrivedNum) {
this.notifyHasArriveNum = notifyHasArriveNum; this.notifyHasArrivedNum = notifyHasArrivedNum;
} }
public Integer getNotifyArrivedNum() { public Integer getNotifyArrivedNum() {

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

@ -19,7 +19,7 @@ public interface PurchaseOrderMapper
* @param purchaseOrderId 采购订单ID * @param purchaseOrderId 采购订单ID
* @return 采购订单 * @return 采购订单
*/ */
public PurchaseOrderVo selectPurchaseOrderById(Long purchaseOrderId); public PurchaseOrder selectPurchaseOrderById(Long purchaseOrderId);
/** /**
* 查询采购订单列表 * 查询采购订单列表
@ -27,7 +27,7 @@ public interface PurchaseOrderMapper
* @param purchaseOrder 采购订单 * @param purchaseOrder 采购订单
* @return 采购订单集合 * @return 采购订单集合
*/ */
public List<PurchaseOrderVo> selectPurchaseOrderList(PurchaseOrder purchaseOrder); public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder);
/** /**
* 新增采购订单 * 新增采购订单
@ -65,7 +65,7 @@ public interface PurchaseOrderMapper
public List<PurchaseOrderVo> selectOrderByIdDesc(); public List<PurchaseOrderVo> selectOrderByIdDesc();
//根据采购订单编号查询采购订单 //根据采购订单编号查询采购订单
PurchaseOrderVo selectPurchaseOrderByOrderCode(String purchaseOrderCode); PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode);
//校验采购订单编号是否唯一 //校验采购订单编号是否唯一
public Integer checkPurchaseOrderCodeUnique(String purchaseOrderCode); public Integer checkPurchaseOrderCodeUnique(String purchaseOrderCode);
} }

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

@ -1,7 +1,6 @@
package com.ruoyi.purchase.service; package com.ruoyi.purchase.service;
import com.ruoyi.purchase.domain.PurchaseOrder; import com.ruoyi.purchase.domain.PurchaseOrder;
import com.ruoyi.purchase.domain.PurchaseOrderVo;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder; import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -22,7 +21,7 @@ public interface IPurchaseOrderService
* @param purchaseOrderId 采购订单ID * @param purchaseOrderId 采购订单ID
* @return 采购订单 * @return 采购订单
*/ */
public PurchaseOrderVo selectPurchaseOrderById(Long purchaseOrderId); public PurchaseOrder selectPurchaseOrderById(Long purchaseOrderId);
/** /**
* 查询采购订单列表 * 查询采购订单列表
@ -30,7 +29,7 @@ public interface IPurchaseOrderService
* @param purchaseOrder 采购订单 * @param purchaseOrder 采购订单
* @return 采购订单集合 * @return 采购订单集合
*/ */
public List<PurchaseOrderVo> selectPurchaseOrderList(PurchaseOrderVo purchaseOrder); public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder);
/** /**
* 新增采购订单 * 新增采购订单

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

@ -1,15 +1,11 @@
package com.ruoyi.purchase.service.impl; package com.ruoyi.purchase.service.impl;
import com.github.pagehelper.Page;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.service.ICommonService;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper; import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.purchase.domain.PurchaseOrder; import com.ruoyi.purchase.domain.PurchaseOrder;
@ -30,10 +26,7 @@ import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -46,6 +39,8 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.github.pagehelper.page.PageMethod.startPage;
/** /**
* 采购订单Service业务层处理 * 采购订单Service业务层处理
* *
@ -104,30 +99,25 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
* @return 采购订单 * @return 采购订单
*/ */
@Override @Override
public PurchaseOrderVo selectPurchaseOrderById(Long purchaseOrderId) public PurchaseOrder selectPurchaseOrderById(Long purchaseOrderId)
{ {
PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(purchaseOrderId); // SysUser sysUser = userMapper.selectUserByLoginName(purchaseOrderVo.getApplyUser());
SysUser sysUser = userMapper.selectUserByLoginName(purchaseOrderVo.getApplyUser()); // if (sysUser != null) {
if (sysUser != null) { // purchaseOrderVo.setApplyUserName(sysUser.getUserName());
purchaseOrderVo.setApplyUserName(sysUser.getUserName()); // }
} return purchaseOrderMapper.selectPurchaseOrderById(purchaseOrderId);
return purchaseOrderVo ;
} }
/** /**
* 查询采购订单列表 * 查询采购订单列表
* *
* @param purchaseOrderVo 采购订单 * @param purchaseOrder 采购订单
* @return 采购订单 * @return 采购订单
*/ */
@Override @Override
public List<PurchaseOrderVo> selectPurchaseOrderList(PurchaseOrderVo purchaseOrderVo) public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder)
{ {
return purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder);
// PageHelper 仅对第一个 List 分页
List<PurchaseOrderVo> list = purchaseOrderMapper.selectPurchaseOrderList(purchaseOrderVo);
return list;
} }
/** /**
@ -167,32 +157,27 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
if (planCode != null) { if (planCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild(); PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
// 累加物料数量和金额 //获取物料供应商不含税采购价格
//获取物料供应商采购价格 BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb();
BigDecimal suplierMaterialNoRmb = child.getMaterialNoRmb(); // 获取物料供应商含税采购价格
// 获取物料供应商采购价格 BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
BigDecimal suplierMaterialRmb = child.getMaterialRmb();
// 获取物料数量 // 获取物料数量
Long suplierMaterialNum = child.getMaterialNum(); Long suplierMaterialNum = child.getMaterialNum();
if (suplierMaterialNum == null) {suplierMaterialNum = 0L;}
if (suplierMaterialRmb == null) {suplierMaterialRmb = BigDecimal.ZERO;}
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;} if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;}
// 累加物料数量 if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;}
materialNum += suplierMaterialNum; if(suplierMaterialNum == null){suplierMaterialNum = 0L;}
// 累加不含税物料价格 //获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
materialNoRmb = materialNoRmb.add(suplierMaterialNoRmb);
// 累加含税物料价格
materialRmb = materialRmb.add(suplierMaterialRmb);
// 计算不含税物料总价
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 计算物料含税 //获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 累加物料数量
materialNum += suplierMaterialNum;
// 累加物料总价 // 累加物料总价
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal); materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价 // 累加物料含税总价
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal); materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal);
// 设置采购报价单编号和供应商信息到QuoteChild // 设置采购报价单编号和供应商信息到QuoteChild
material.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode()); material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setSupplierCode(child.getSupplierCode()); material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit()); material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept()); material.setWarehouseDept(child.getWarehouseDept());
@ -203,23 +188,26 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
material.setMaterialDescribe(child.getMaterialDescribe()); material.setMaterialDescribe(child.getMaterialDescribe());
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl()); material.setMaterialPhotoUrl(child.getMaterialPhotoUrl());
material.setMaterialProcessMethod(child.getMaterialProcessMethod()); material.setMaterialProcessMethod(child.getMaterialProcessMethod());
material.setWarehouseDept(child.getWarehouseDept());
//计划采购数
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmb(child.getMaterialNoRmb()); material.setMaterialNoRmb(child.getMaterialNoRmb());
material.setMaterialRmb(child.getMaterialRmb()); material.setMaterialRmb(child.getMaterialRmb());
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setMaterialRmbSum(child.getMaterialRmbSum()); material.setMaterialRmbSum(child.getMaterialRmbSum());
//实际采购数
material.setMaterialRealNum(child.getMaterialRealNum()); material.setMaterialRealNum(child.getMaterialRealNum());
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb()); material.setMaterialRealNoRmb(child.getMaterialRealNoRmb());
material.setMaterialRealRmb(child.getMaterialRealRmb()); material.setMaterialRealRmb(child.getMaterialRealRmb());
material.setMaterialRealRmbSum(child.getMaterialRealRmbSum()); //实际采购单价合计
material.setMaterialRealNoRmbSum(child.getMaterialRealNoRmbSum()); material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(correlationCode); material.setCorrelationCode(child.getCorrelationCode());
material.setPurchasePlanCode(planCode); material.setPurchasePlanCode(child.getPurchasePlanCode());
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0"); material.setEceiptStatus("0");
material.setPaymentStatus("0"); material.setPaymentStatus("0");
material.setDelFlag("0");
// 执行子表插入操作 // 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(child); purchaseOrderChildService.insertPurchaseOrderChild(child);
PurchasePlan plan = new PurchasePlan(); PurchasePlan plan = new PurchasePlan();
@ -228,31 +216,26 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
int result = purchasePlanService.updatePurchasePlan(plan); int result = purchasePlanService.updatePurchasePlan(plan);
} }
} }
child.setMaterialNoRmb(BigDecimal.ZERO);
} }
else if ((child.getCorrelationCode().contains(",")==false) else if ((!child.getCorrelationCode().contains(","))
&& child.getPurchasePlanCode() != null) { && child.getPurchasePlanCode() != null) {
PurchaseOrderChild material = new PurchaseOrderChild(); PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode()); child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商采购价格 //获取物料供应商不含税采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialNoRmb(); BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb();
// 获取物料供应商采购价格 // 获取物料供应商含税采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRmb(); BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
// 获取物料数量 // 获取物料数量
Long suplierMaterialNum = child.getMaterialNum(); Long suplierMaterialNum = child.getMaterialNum();
// 累加物料数量
materialNum += suplierMaterialNum;
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;} if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;}
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;} if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;}
if(suplierMaterialNum == null){suplierMaterialNum = 0L;} if(suplierMaterialNum == null){suplierMaterialNum = 0L;}
// 累加不含税物料价格 //获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
materialNoRmb = materialNoRmb.add(suplierMaterialNoRmb);
// 累加含税物料价格
materialRmb = materialRmb.add(suplierMaterialRmb);
// 计算不含税物料总价
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 计算物料含税 //获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum)); BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 累加物料数量
materialNum += suplierMaterialNum;
// 累加物料总价 // 累加物料总价
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal); materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价 // 累加物料含税总价
@ -269,23 +252,26 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
material.setMaterialDescribe(child.getMaterialDescribe()); material.setMaterialDescribe(child.getMaterialDescribe());
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl()); material.setMaterialPhotoUrl(child.getMaterialPhotoUrl());
material.setMaterialProcessMethod(child.getMaterialProcessMethod()); material.setMaterialProcessMethod(child.getMaterialProcessMethod());
material.setWarehouseDept(child.getWarehouseDept());
//计划采购数
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmb(child.getMaterialNoRmb()); material.setMaterialNoRmb(child.getMaterialNoRmb());
material.setMaterialRmb(child.getMaterialRmb()); material.setMaterialRmb(child.getMaterialRmb());
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setMaterialRmbSum(child.getMaterialRmbSum()); material.setMaterialRmbSum(child.getMaterialRmbSum());
//实际采购数
material.setMaterialRealNum(child.getMaterialRealNum()); material.setMaterialRealNum(child.getMaterialRealNum());
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb()); material.setMaterialRealNoRmb(child.getMaterialRealNoRmb());
material.setMaterialRealRmb(child.getMaterialRealRmb()); material.setMaterialRealRmb(child.getMaterialRealRmb());
material.setMaterialRealRmbSum(child.getMaterialRmbSum()); //实际采购单价合计
material.setMaterialRealNoRmbSum(child.getMaterialRealNoRmbSum()); material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum()); material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(child.getCorrelationCode()); material.setCorrelationCode(child.getCorrelationCode());
material.setPurchasePlanCode(child.getPurchasePlanCode()); material.setPurchasePlanCode(child.getPurchasePlanCode());
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode()); material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0"); material.setEceiptStatus("0");
material.setPaymentStatus("0"); material.setPaymentStatus("0");
material.setDelFlag("0");
// 执行子表插入操作 // 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(child); purchaseOrderChildService.insertPurchaseOrderChild(child);
PurchasePlan plan = new PurchasePlan(); PurchasePlan plan = new PurchasePlan();
@ -297,12 +283,25 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
} }
// 遍历处理采购订单子表 // 遍历处理采购订单子表
// 设置累加的物料信息到子表 // 设置累加的物料信息到子表
purchaseOrder.setMaterialSum(Math.toIntExact(materialNum));
// purchaseOrder.setMaterialSum(purchaseOrder.getMaterialSum());
// purchaseOrder.setNoRmbSum(purchaseOrder.getNoRmbSum());
// purchaseOrder.setRmbSum(purchaseOrder.getRmbSum());
// 设置主表的供应商数量
purchaseOrder.setSupplierNum(purchaseOrder.getSupplierNum());
purchaseOrder.setNoRmbSum(materialNoRmbSum); purchaseOrder.setNoRmbSum(materialNoRmbSum);
purchaseOrder.setRmbSum(materialRmbSum); purchaseOrder.setRmbSum(materialRmbSum);
// 设置主表的供应商数量 purchaseOrder.setDelFlag("0");
purchaseOrder.setSupplierNum(supplierNum); purchaseOrder.setAuditStatus("1");
purchaseOrder.setUseStatus("1");
purchaseOrder.setEceiptStatus("0");
purchaseOrder.setPaymentStatus("0");
purchaseOrder.setPurchaseBuyer(purchaseOrder.getPurchaseBuyer());
purchaseOrder.setCreateTime(DateUtils.getNowDate());
purchaseOrder.setCreateBy(ShiroUtils.getLoginName());
Set<String> amountSet = purchaseOrder.getPurchaseOrderChildList().stream().map(PurchaseOrderChild::getMaterialCode).collect(Collectors.toSet());
Integer amount = amountSet.size();
purchaseOrder.setMaterialAmount(amount);
return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder); return purchaseOrderMapper.insertPurchaseOrder(purchaseOrder);
} }
@ -358,13 +357,14 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
* 采购订单创建采购入库通知单 * 采购订单创建采购入库通知单
* */ * */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = RuntimeException.class)
public int addPurchaseOrderStorage(WarehouseStorageOrder warehouseStorageOrder){ public int addPurchaseOrderStorage(WarehouseStorageOrder warehouseStorageOrder){
WarehouseStorageOrder warehouseStorageOrder1 = new WarehouseStorageOrder(); WarehouseStorageOrder warehouseStorageOrder1 = new WarehouseStorageOrder();
warehouseStorageOrder1.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode()); warehouseStorageOrder1.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
List<WarehouseStorageOrder> warehouseStorageOrderList = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder1); List<WarehouseStorageOrder> warehouseStorageOrderList = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder1);
List<WarehouseStorageOrderDetail> list = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); List<WarehouseStorageOrderDetail> list = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if(CollectionUtils.isEmpty(warehouseStorageOrderList)) { int result = 0;
if(!CollectionUtils.isEmpty(list)) {
//根据物料入库部门划分入库单,入库单类型:0 仓库,1 采购,生成入库单号 //根据物料入库部门划分入库单,入库单类型:0 仓库,1 采购,生成入库单号
List<WarehouseStorageOrderDetail> list1 = list.stream().filter(e -> e.getMaterialDeptType().equals("0")).collect(Collectors.toList()); List<WarehouseStorageOrderDetail> list1 = list.stream().filter(e -> e.getMaterialDeptType().equals("0")).collect(Collectors.toList());
List<WarehouseStorageOrderDetail> list2 = list.stream().filter(e -> e.getMaterialDeptType().equals("1")).collect(Collectors.toList()); List<WarehouseStorageOrderDetail> list2 = list.stream().filter(e -> e.getMaterialDeptType().equals("1")).collect(Collectors.toList());
@ -372,7 +372,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
//WarehouseStorageType 仓库入库类型(0采购入库、1供应商补货、2委内入库、3公司退货、4委外入库、5生产入库), //WarehouseStorageType 仓库入库类型(0采购入库、1供应商补货、2委内入库、3公司退货、4委外入库、5生产入库),
//setWarehouseOrderType仓库订单类型(0采购订单、1生产订单、2退换货订单、3委外订单), //setWarehouseOrderType仓库订单类型(0采购订单、1生产订单、2退换货订单、3委外订单),
//WarehouseDeptType 仓库入库部门类型(0仓库,1采购 ), //WarehouseDeptType 仓库入库部门类型(0仓库,1采购 ),
if(!CollectionUtils.isEmpty(list1)) { if(list1.size() > 0) {
//采购入库单,物料入库列表信息读取,放入生成的入库订单号 //采购入库单,物料入库列表信息读取,放入生成的入库订单号
String warehouseStorageCode = redisCache.generateBillNo("RK"); String warehouseStorageCode = redisCache.generateBillNo("RK");
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list1) { for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list1) {
@ -386,10 +386,13 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode);
warehouseStorageOrder.setWarehouseStorageType("0"); warehouseStorageOrder.setWarehouseStorageType("0");
warehouseStorageOrder.setWarehouseDeptType("0"); warehouseStorageOrder.setWarehouseDeptType("0");
warehouseStorageOrder.setWarehouseOrderType("1");
warehouseStorageOrder.setWarehouseStorageStatus("0"); warehouseStorageOrder.setWarehouseStorageStatus("0");
warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); warehouseStorageOrder.setCreateTime(DateUtils.getNowDate());
warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName());
result = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
} }
if(!CollectionUtils.isEmpty(list2)) { if(list.size()>0) {
String warehouseStorageCode1 = redisCache.generateBillNo("RK"); String warehouseStorageCode1 = redisCache.generateBillNo("RK");
//仓库入库单 //仓库入库单
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list2) { for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list2) {
@ -402,15 +405,19 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
//入库代表为仓库部分的入库单 //入库代表为仓库部分的入库单
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode1); warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode1);
warehouseStorageOrder.setWarehouseStorageStatus("0"); warehouseStorageOrder.setWarehouseStorageStatus("0");
warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseStorageType("1"); warehouseStorageOrder.setWarehouseStorageType("1");
warehouseStorageOrder.setWarehouseOrderType("0"); warehouseStorageOrder.setWarehouseOrderType("0");
warehouseStorageOrder.setWarehouseDeptType("1"); warehouseStorageOrder.setWarehouseDeptType("1");
warehouseStorageOrder.setCreateTime(DateUtils.getNowDate());
warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName());
warehouseStorageOrder.setWarehouseStorageOrderDetailList(list2); warehouseStorageOrder.setWarehouseStorageOrderDetailList(list2);
warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder); result = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
} }
} }
return 0;
return result;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -437,60 +444,70 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
return processInstance; return processInstance;
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public ProcessInstance cancelPurchaseOrderById(Long id) { public ProcessInstance cancelPurchaseOrderById(Long id) {
PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id); return null;
// 审核状态-待审核
purchaseOrderVo.setAuditStatus("0");
SysUser user = ShiroUtils.getSysUser();
// 启动流程
String applyTitle = user.getUserName()+"发起了物料信息作废审批-"+DateUtils.dateTimeNow();
String instanceType = "cancel";
PurchaseOrder purchaseOrder = new PurchaseOrder();
BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder);
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user);
String processInstanceId = processInstance.getProcessInstanceId();
// 作废实例id
purchaseOrder.setCancelInstanceId(processInstanceId);
// 存在提交完就流程结束的情况
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
if(processIsFinish){
// 审核状态-审核通过
purchaseOrder.setAuditStatus("1");
// 使用状态-已作废
purchaseOrder.setUseStatus("2");
}
purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
return processInstance;
} }
@Override @Override
public ProcessInstance restorePurchaseOrderById(Long id) { public ProcessInstance restorePurchaseOrderById(Long id) {
PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id); return null;
// 审核状态-待审核 }
purchaseOrderVo.setAuditStatus("0"); // @Override
SysUser user = ShiroUtils.getSysUser(); // @Transactional(rollbackFor = Exception.class)
// 启动流程 // public ProcessInstance cancelPurchaseOrderById(Long id) {
String applyTitle = user.getUserName()+"发起了物料信息恢复审批-"+DateUtils.dateTimeNow(); // PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id);
String instanceType = "restore"; // // 审核状态-待审核
PurchaseOrder purchaseOrder = new PurchaseOrder(); // purchaseOrderVo.setAuditStatus("0");
BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder); // SysUser user = ShiroUtils.getSysUser();
ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user); // // 启动流程
String processInstanceId = processInstance.getProcessInstanceId(); // String applyTitle = user.getUserName()+"发起了物料信息作废审批-"+DateUtils.dateTimeNow();
// 恢复实例id // String instanceType = "cancel";
purchaseOrder.setRestoreInstanceId(processInstanceId); // PurchaseOrder purchaseOrder = new PurchaseOrder();
// 存在提交完就流程结束的情况 // BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder);
boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId); // ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user);
if(processIsFinish){ // String processInstanceId = processInstance.getProcessInstanceId();
// 审核状态-审核通过 // // 作废实例id
purchaseOrder.setAuditStatus("1"); // purchaseOrder.setCancelInstanceId(processInstanceId);
// 使用状态-是 // // 存在提交完就流程结束的情况
purchaseOrder.setUseStatus("1"); // boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
} // if(processIsFinish){
purchaseOrderMapper.updatePurchaseOrder(purchaseOrder); // // 审核状态-审核通过
return processInstance; // purchaseOrder.setAuditStatus("1");
} // // 使用状态-已作废
// purchaseOrder.setUseStatus("2");
// }
// purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
// return processInstance;
// }
// @Override
// public ProcessInstance restorePurchaseOrderById(Long id) {
// PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id);
// // 审核状态-待审核
// purchaseOrderVo.setAuditStatus("0");
// SysUser user = ShiroUtils.getSysUser();
// // 启动流程
// String applyTitle = user.getUserName()+"发起了物料信息恢复审批-"+DateUtils.dateTimeNow();
// String instanceType = "restore";
// PurchaseOrder purchaseOrder = new PurchaseOrder();
// BeanUtils.copyProperties(purchaseOrderVo,purchaseOrder);
// ProcessInstance processInstance = startProcessInstance(applyTitle,instanceType,purchaseOrder, user);
// String processInstanceId = processInstance.getProcessInstanceId();
// // 恢复实例id
// purchaseOrder.setRestoreInstanceId(processInstanceId);
// // 存在提交完就流程结束的情况
// boolean processIsFinish = processService.judgeProcessIsFinish(processInstanceId);
// if(processIsFinish){
// // 审核状态-审核通过
// purchaseOrder.setAuditStatus("1");
// // 使用状态-是
// purchaseOrder.setUseStatus("1");
// }
// purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
// return processInstance;
// }
private ProcessInstance startProcessInstance(String applyTitle, String instanceType, PurchaseOrder purchaseOrder, SysUser user) { private ProcessInstance startProcessInstance(String applyTitle, String instanceType, PurchaseOrder purchaseOrder, SysUser user) {
Long materialId = purchaseOrder.getPurchaseOrderId(); Long materialId = purchaseOrder.getPurchaseOrderId();
String businessKey = materialId.toString(); // 实体类 ID,作为流程的业务 key String businessKey = materialId.toString(); // 实体类 ID,作为流程的业务 key

2
ruoyi-admin/src/main/java/com/ruoyi/stock/mapper/StockInfoMapper.java

@ -15,7 +15,7 @@ public interface StockInfoMapper
/** /**
* 查询仓库信息 * 查询仓库信息
* *
* @param StockNO 仓库信息ID * @param stockId 仓库信息ID
* @return 仓库信息 * @return 仓库信息
*/ */
public StockInfo selectStockInfoById(Long stockId); public StockInfo selectStockInfoById(Long stockId);

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

@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialProcessMethod" column="material_process_method" /> <result property="materialProcessMethod" column="material_process_method" />
<result property="materialUnit" column="material_unit" /> <result property="materialUnit" column="material_unit" />
<result property="hasStorageNum" column="has_storage_num" /> <result property="hasStorageNum" column="has_storage_num" />
<result property="notifyArrivedNum" column="notify_arrived_num" /> <result property="notifyHasArrivedNum" column="notify_has_arrived_num" />
<result property="materialNoRmb" column="material_no_rmb" /> <result property="materialNoRmb" column="material_no_rmb" />
<result property="materialRmb" column="material_rmb" /> <result property="materialRmb" column="material_rmb" />
<result property="materialNum" column="material_num" /> <result property="materialNum" column="material_num" />
@ -48,10 +48,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectPurchaseOrderChildVo"> <sql id="selectPurchaseOrderChildVo">
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_brand, material_ select purchase_order_child_id, purchase_order_code, purchase_plan_code, purchase_plan_correlation_code, supplier_code, supplier_name,
`describe`, material_photoUrl, warehouseDept, material_process_method, material_unit, has_storage_num, notify_arrived_num, material_no_rmb, material_rmb, material_num, material_amount, material_code, material_name, material_type, material_brand, material_describe, material_photoUrl, warehouseDept, material_process_method,
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_ material_unit, material_no_rmb, material_rmb, material_num, material_amount,
rate, create_by, create_time, update_by, update_time, del_flag, standby_one, standby_two from purchase_order_child 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> </sql>
<select id="selectPurchaseOrderChildList" parameterType="PurchaseOrderChild" resultMap="PurchaseOrderChildResult"> <select id="selectPurchaseOrderChildList" parameterType="PurchaseOrderChild" resultMap="PurchaseOrderChildResult">
@ -239,8 +242,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.material_rmb,p.material_num,p.material_amount,p.material_sum,p.material_no_rmb_sum,p.material_rmb_sum, 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.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, 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 sum(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, w.has_storage_num,sum(w.notify_arrive_num) as notify_has_arrived_num
(select sum(w.notify_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 left join warehouse_storage as w on p.purchase_order_code = w.purchase_order_code and p.material_code = w.material_code
from purchase_order_child as p where p.purchase_order_code = #{purchaseOrderCode}; where p.purchase_order_code = #{purchaseOrderCode} and GROUP BY supplier_code,material_code
</select> </select>
</mapper> </mapper>

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

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.purchase.mapper.PurchaseOrderMapper"> <mapper namespace="com.ruoyi.purchase.mapper.PurchaseOrderMapper">
<resultMap type="PurchaseOrderVo" id="PurchaseOrderResult"> <resultMap type="PurchaseOrder" id="PurchaseOrderResult">
<result property="purchaseOrderId" column="purchase_order_id" /> <result property="purchaseOrderId" column="purchase_order_id" />
<result property="purchaseOrderCode" column="purchase_order_code" /> <result property="purchaseOrderCode" column="purchase_order_code" />
<result property="purchaseBuyer" column="purchase_buyer" /> <result property="purchaseBuyer" column="purchase_buyer" />
@ -45,15 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="stockAddress" column="stock_address" /> <result property="stockAddress" column="stock_address" />
<result property="stockContact" column="stock_contact" /> <result property="stockContact" column="stock_contact" />
<result property="stockPhone" column="stock_phone" /> <result property="stockPhone" column="stock_phone" />
<result property="instanceId" column="instance_id" />
<result property="instanceType" column="instance_type" />
<result property="instanceTypeName" column="instance_type_name" />
<result property="submitInstanceId" column="submit_instance_id" />
<result property="cancelInstanceId" column="cancel_instance_id" />
<result property="restoreInstanceId" column="restore_instance_id" />
<result property="applyTitle" column="apply_title" />
<result property="applyUser" column="apply_user" />
<result property="applyTime" column="apply_time" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
@ -62,58 +53,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseOrderVo"> <sql id="selectPurchaseOrderVo">
select purchase_order_id, purchase_order_code, supplier_code, supplier_name, select purchase_order_id, purchase_order_code, supplier_code, supplier_name,
arrived_time, eceipt_type, arrived_time, eceipt_type,eceipt_status, payment_status, supplier_num, material_amount,
material_sum, noRmbSum, rmbSum, use_status, audit_status, purchase_buyer,
customer_contact, contact_number, customer_fax, delivery_address, payment_terms, customer_contact, contact_number, customer_fax, delivery_address, payment_terms,
delivery_conditions, delivery_method, purchase_name, billing_date, tax_rate, delivery_conditions, delivery_method, purchase_name, billing_date, tax_rate,
purchase_category, purchase_commander, customer_order_number, remark_content, purchase_category, purchase_commander, customer_order_number, remark_content,
close_case_no, close_case_name, close_case_time, close_case_no, close_case_name, close_case_time,confirm_no,confirm_time,confirm_name,
del_flag, stock_no, stock_name, stock_address, stock_contact, stock_phone, del_flag, stock_no, stock_name, stock_address, stock_contact, stock_phone,
approve_time, standby_one, standby_two, instance_id, instance_type, instance_type_name, approve_time, standby_one, standby_two,
submit_instance_id, cancel_instance_id, restore_instance_id, apply_title, apply_user, apply_time,
create_time, create_by, update_time, update_by from purchase_order create_time, create_by, update_time, update_by from purchase_order
</sql> </sql>
<select id="selectPurchaseOrderList" parameterType="PurchaseOrder" resultMap="PurchaseOrderResult"> <select id="selectPurchaseOrderList" parameterType="PurchaseOrder" resultMap="PurchaseOrderResult">
select s.purchaesse_order_id, s.purchase_order_code, s.supplier_code, s.supplier_name, <include refid="selectPurchaseOrderVo"/>
s.arrived_time, s.eceipt_type,
s.customer_contact, s.contact_number, s.customer_fax, s.delivery_address, s.payment_terms,
s.delivery_conditions, s.delivery_method, s.purchase_name, s.billing_date, s.tax_rate,
s.purchase_category, s.purchase_commander, s.customer_order_number, s.remark_content,
s.close_case_no, s.close_case_name, s.close_case_time,
s.del_flag, s.stock_no, s.stock_name, s.stock_address, s.stock_contact, s.stock_phone,
s.approve_time, s.standby_one, s.standby_two, s.instance_id, s.instance_type, p.dict_label as instance_type_name,
s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user, s.apply_time,
s.create_time, s.create_by, s.update_time, s.update_by
from purchase_order as s
left join(
select dict_value,dict_label from sys_dict_data where dict_type = 'processType'
) as p
on s.instance_type = p.dict_value
<where> <where>
<if test="purchaseOrderCode != null and purchaseOrderCode != ''"> and s.purchase_order_code like concat('%', #{purchaseOrderCode}, '%')</if> del_flag = '0'
<if test="purchaseBuyer != null and purchaseBuyer != ''"> and s.purchase_buyer = #{purchaseBuyer}</if> <if test="purchaseOrderCode != null and purchaseOrderCode != ''"> and purchase_order_code like concat('%', #{purchaseOrderCode}, '%')</if>
<if test="purchaseBuyer != null and purchaseBuyer != ''"> and purchase_buyer = #{purchaseBuyer}</if>
<if test="supplierCode != null and supplierCode != ''"> <if test="supplierCode != null and supplierCode != ''">
and s.purchase_order_code in ( select purchase_order_code from purchase_order_child where supplier_code = #{supplierCode}) and purchase_order_code in ( select purchase_order_code from purchase_order_child where supplier_code = #{supplierCode})
</if> </if>
<if test="supplierName != null and supplierName != ''"> <if test="supplierName != null and supplierName != ''">
and s.purchase_order_code in ( select purchase_order_code from purchase_order_child where supplier_name = #{supplierName}) and purchase_order_code in ( select purchase_order_code from purchase_order_child where supplier_name = #{supplierName})
</if> </if>
<if test="useStatus != null and useStatus != ''">and s.use_status = #{useStatus}</if> <if test="useStatus != null and useStatus != ''">and use_status = #{useStatus}</if>
<if test="eceiptStatus != null ">and s.eceipt_status = #{eceiptStatus}</if> <if test="eceiptStatus != null and eceiptStatus !='' ">and eceipt_status = #{eceiptStatus}</if>
<if test="paymentStatus != null">and s.payment_status = #{paymentStatus}</if> <if test="paymentStatus != null and paymentStatus != '' ">and payment_status = #{paymentStatus}</if>
<if test="instanceId != null and instanceId != ''"> and s.instance_id = #{instanceId}</if>
<if test="instanceType != null and instanceType != ''"> and s.instance_type = #{instanceType}</if>
<if test="submitInstanceId != null and submitInstanceId != ''"> and s.submit_instance_id = #{submitInstanceId}</if>
<if test="cancelInstanceId != null and cancelInstanceId != ''"> and s.cancel_instance_id = #{cancelInstanceId}</if>
<if test="restoreInstanceId != null and restoreInstanceId != ''"> and s.restore_instance_id = #{restoreInstanceId}</if>
<if test="applyTitle != null and applyTitle != ''"> and s.apply_title = #{applyTitle}</if>
<if test="applyUser != null and applyUser != ''"> and s.apply_user = #{applyUser}</if>
<if test="applyTime != null "> and s.apply_time = #{applyTime}</if>
<if test="keyword != null and keyword != ''"> and (s.purchaseOrderCode like concat('%',#{keyword},'%') or s.purchase_order_id like concat('%',#{keyword},'%'))</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>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if> <if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where> </where>
order by s.create_time desc order by purchase_order_id desc
</select> </select>
<select id="selectPurchaseOrderById" parameterType="Long" resultMap="PurchaseOrderResult"> <select id="selectPurchaseOrderById" parameterType="Long" resultMap="PurchaseOrderResult">
@ -125,8 +93,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into purchase_order insert into purchase_order
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="purchaseOrderCode != null">purchase_order_code,</if> <if test="purchaseOrderCode != null">purchase_order_code,</if>
<if test="supplierCode != null and supplierCode != ''">supplier_code,</if>
<if test="supplierName != null and supplierName != ''">supplier_name,</if>
<if test="customerContact != null">customer_contact,</if> <if test="customerContact != null">customer_contact,</if>
<if test="contactNumber != null">contact_number,</if> <if test="contactNumber != null">contact_number,</if>
<if test="customerFax != null">customer_fax,</if> <if test="customerFax != null">customer_fax,</if>
@ -140,40 +106,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="purchaseCategory != null">purchase_category,</if> <if test="purchaseCategory != null">purchase_category,</if>
<if test="purchaseCommander != null">purchase_commander,</if> <if test="purchaseCommander != null">purchase_commander,</if>
<if test="customerOrderNumber != null">customer_order_number,</if> <if test="customerOrderNumber != null">customer_order_number,</if>
<if test="remarkContent != null">remark_content,</if>
<if test="standbyOne != null">standby_one,</if> <if test="standbyOne != null">standby_one,</if>
<if test="standbyTwo != null">standby_two,</if> <if test="standbyTwo != null">standby_two,</if>
<if test="delFlag != null" >del_flag,</if>
<if test="stockNo!= null">stock_no,</if> <if test="stockNo!= null">stock_no,</if>
<if test="stockName!= null">stock_name,</if> <if test="stockName!= null">stock_name,</if>
<if test="stockAddress!= null">stock_address,</if> <if test="stockAddress!= null">stock_address,</if>
<if test="stockContact!= null">stock_contact,</if> <if test="stockContact!= null">stock_contact,</if>
<if test="stockPhone!= null">stock_phone,</if> <if test="stockPhone!= null">stock_phone,</if>
<if test="arrivedTime != null">arrived_time,</if> <if test="arrivedTime != null">arrived_time,</if>
<if test="eceiptType != null">eceipt_type,</if> <if test="eceiptStatus != null">eceipt_status,</if>
<if test="instanceId != null">instance_id,</if>
<if test="instanceType != null">instance_type,</if>
<if test="submitInstanceId != null">submit_instance_id,</if>
<if test="cancelInstanceId != null">cancel_instance_id,</if>
<if test="restoreInstanceId != null">restore_instance_id,</if>
<if test="applyTitle != null">apply_title,</if>
<if test="applyUser != null">apply_user,</if>
<if test="applyTime != null">apply_time,</if>
<if test="useStatus != null">use_status,</if> <if test="useStatus != null">use_status,</if>
<if test="auditStatus != null">audit_status,</if> <if test="auditStatus != null">audit_status,</if>
<if test="paymentStatus != null">payment_status,</if>
<if test="supplierNum != null">supplier_num,</if>
<if test="materialAmount != null">material_amount,</if>
<if test="materialSum != null">material_sum,</if>
<if test="noRmbSum != null">noRmbSum,</if>
<if test="rmbSum != null">rmbSum,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
<if test="delFlag != null" >del_flag,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="purchaseOrderCode != null">#{purchaseOrderCode},</if> <if test="purchaseOrderCode != null">#{purchaseOrderCode},</if>
<if test="supplierCode != null and supplierCode != ''">#{supplierCode},</if>
<if test="supplierName != null and supplierName != ''">#{supplierName},</if>
<if test="customerContact != null">#{customerContact},</if> <if test="customerContact != null">#{customerContact},</if>
<if test="contactNumber != null">#{contactNumber},</if> <if test="contactNumber != null">#{contactNumber},</if>
<if test="customerFax != null">#{customerFax},</if> <if test="customerFax != null">#{customerFax},</if>
<if test="deliveryAddress != null">#{deliveryAddress},</if> <if test="deliveryAddress != null">#{deliveryAddress},</if>
<if test="paymentTerms != null">#{paymentTerms},</if> <if test="paymentTerms != null">#{paymentTerms},</if>
<if test="deliveryConditions != null">#{deliveryConditions},</if>
<if test="deliveryMethod != null">#{deliveryMethod},</if> <if test="deliveryMethod != null">#{deliveryMethod},</if>
<if test="deliveryConditions != null">#{deliveryConditions},</if>
<if test="purchaseName != null">#{purchaseName},</if> <if test="purchaseName != null">#{purchaseName},</if>
<if test="billingDate != null">#{billingDate},</if> <if test="billingDate != null">#{billingDate},</if>
<if test="taxRate != null">#{taxRate},</if> <if test="taxRate != null">#{taxRate},</if>
@ -183,26 +146,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="remarkContent != null">#{remarkContent},</if> <if test="remarkContent != null">#{remarkContent},</if>
<if test="standbyOne != null">#{standbyOne},</if> <if test="standbyOne != null">#{standbyOne},</if>
<if test="standbyTwo != null">#{standbyTwo},</if> <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="stockNo!= null">#{stockNo},</if>
<if test="stockName!= null">#{stockName},</if> <if test="stockName!= null">#{stockName},</if>
<if test="stockAddress!= null">#{stockAddress},</if> <if test="stockAddress!= null">#{stockAddress},</if>
<if test="stockContact!= null">#{stockContact},</if> <if test="stockContact!= null">#{stockContact},</if>
<if test="stockPhone!= null">#{stockPhone},</if> <if test="stockPhone!= null">#{stockPhone},</if>
<if test="arrivedTime != null">#{arrivedTime},</if> <if test="arrivedTime != null">#{arrivedTime},</if>
<if test="eceiptType != null">#{eceiptType},</if> <if test="eceiptStatus != null">#{eceiptStatus},</if>
<if test="instanceId != null">#{instanceId},</if>
<if test="instanceType != null">#{instanceType},</if>
<if test="submitInstanceId != null">#{submitInstanceId},</if>
<if test="cancelInstanceId != null">#{cancelInstanceId},</if>
<if test="restoreInstanceId != null">#{restoreInstanceId},</if>
<if test="applyTitle != null">#{applyTitle},</if>
<if test="applyUser != null">#{applyUser},</if>
<if test="applyTime != null">#{applyTime},</if>
<if test="useStatus != null">#{useStatus},</if> <if test="useStatus != null">#{useStatus},</if>
<if test="auditStatus != null">#{auditStatus},</if> <if test="auditStatus != null">#{auditStatus},</if>
<if test="paymentStatus != null">#{paymentStatus},</if>
<if test="supplierNum != null">#{supplierNum},</if>
<if test="materialAmount != null">#{materialAmount},</if>
<if test="materialSum != null">#{materialSum},</if>
<if test="noRmbSum != null">#{noRmbSum},</if>
<if test="rmbSum != null">#{rmbSum},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="delFlag != null" >#{delFlag},</if>
</trim> </trim>
</insert> </insert>
@ -238,17 +199,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stockContact!= null">stock_contact = #{stockContact},</if> <if test="stockContact!= null">stock_contact = #{stockContact},</if>
<if test="stockPhone!= null">stock_phone = #{stockPhone},</if> <if test="stockPhone!= null">stock_phone = #{stockPhone},</if>
<if test="arrivedTime != null">arrived_time = #{arrivedTime},</if> <if test="arrivedTime != null">arrived_time = #{arrivedTime},</if>
<if test="eceiptType != null">eceipt_type = #{eceiptType},</if> <if test="eceiptStatus != null">eceipt_status = #{eceiptStatus},</if>
<if test="instanceId != null">instance_id = #{instanceId},</if>
<if test="instanceType != null">instance_type = #{instanceType},</if>
<if test="submitInstanceId != null">submit_instance_id = #{submitInstanceId},</if>
<if test="cancelInstanceId != null">cancel_instance_id = #{cancelInstanceId},</if>
<if test="restoreInstanceId != null">restore_instance_id = #{restoreInstanceId},</if>
<if test="applyTitle != null">apply_title = #{applyTitle},</if>
<if test="applyUser != null">apply_user = #{applyUser},</if>
<if test="applyTime != null">apply_time = #{applyTime},</if>
<if test="useStatus != null">use_status = #{useStatus},</if> <if test="useStatus != null">use_status = #{useStatus},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if> <if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
<if test="supplierNum != null">supplier_num = #{supplierNum},</if>
<if test="materialAmount != null">material_amount = #{materialAmount},</if>
<if test="materialSum != null">material_sum = #{materialSum},</if>
<if test="noRmbSum != null">noRmbSum = #{noRmbSum},</if>
<if test="rmbSum != null">rmbSum = #{rmbSum},</if>
<if test="updateTime !=null">update_time = #{updateTime},</if> <if test="updateTime !=null">update_time = #{updateTime},</if>
<if test="updateBy !=null">update_by = #{updateBy},</if> <if test="updateBy !=null">update_by = #{updateBy},</if>
</trim> </trim>

8
ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml

@ -36,7 +36,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectWarehouseStorageOrderVo"> <sql id="selectWarehouseStorageOrderVo">
select warehouse_storage_id, warehouse_storage_code, related_order_code, warehouse_storage_status, warehouse_quality_status, warehouse_storage_type, warehouse_order_type, warehouse_dept_type, notify_arrived_num, actual_arrived_num, temporary_qualified_num, temporary_unqualified_num, quality_qualified_num, quality_unqualified_num ,storage_num, arrived_time, temporary_time, delivery_inspection_time, quality_time, storage_time, warehouse_employee, warehouse_code, warehouse_name, warehouse_detail_address ,create_time, create_by, update_by, update_time from warehouse_storage_order select warehouse_storage_id, warehouse_storage_code, related_order_code, warehouse_storage_status,
warehouse_quality_status, warehouse_storage_type, warehouse_order_type, warehouse_dept_type,
notify_arrived_num, actual_arrived_num, temporary_qualified_num, temporary_unqualified_num,
quality_qualified_num, quality_unqualified_num ,storage_num, arrived_time, temporary_time,
delivery_inspection_time, quality_time, storage_time, warehouse_employee, warehouse_code,
warehouse_name, warehouse_detail_address ,create_time, create_by, update_by, update_time
from warehouse_storage_order
</sql> </sql>
<select id="selectWarehouseStorageOrderList" parameterType="WarehouseStorageOrder" resultMap="WarehouseStorageOrderResult"> <select id="selectWarehouseStorageOrderList" parameterType="WarehouseStorageOrder" resultMap="WarehouseStorageOrderResult">

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

@ -14,7 +14,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">采购单号:</label> <label class="col-sm-3 control-label is-required">采购单号:</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input name="purchaseOrder" th:field="*{purchaseOrderCode}" class="form-control" type="text" required readonly> <input name="relatedOrderCode" th:field="*{purchaseOrderCode}" class="form-control" type="text" required readonly>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -55,6 +55,7 @@
var processMethodDatas = [[${@dict.getType('processMethod')}]]; var processMethodDatas = [[${@dict.getType('processMethod')}]];
var materialUnitDatas = [[${@dict.getType('sysUnitClassDatas')}]]; var materialUnitDatas = [[${@dict.getType('sysUnitClassDatas')}]];
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; var materialTypeDatas = [[${@category.getChildByCode('materialType')}]];
var warehouseDeptDatas = [[${@dict.getType('warehouseDept')}]];
$("#form-addPurchaseStorage-edit").validate({ focusCleanup: true}); $("#form-addPurchaseStorage-edit").validate({ focusCleanup: true});
//生成的不同table的id集合 //生成的不同table的id集合
var tableDatas = []; var tableDatas = [];
@ -109,10 +110,15 @@
return $.table.selectDictLabel(processMethodDatas, value); return $.table.selectDictLabel(processMethodDatas, value);
} }
}, },
{title: '入库部门',field: 'warehouseDept',visible: false,
formatter:function (value) {
return $.table.selectDictLabel(warehouseDeptDatas, value);
}
},
{title: '计划采购数',field: 'materialNum',}, {title: '计划采购数',field: 'materialNum',},
{title: '实际采购数',field: 'materialRealNum',}, {title: '实际采购数',field: 'materialRealNum',},
{title: '交付时间',field: 'deliveryTime',}, {title: '交付时间',field: 'deliveryTime',},
{title: '通知已到货数',field: 'notifyArriveNum', {title: '通知已到货数',field: 'notifyHasArriveNum',
formatter: function (value, row, index) { formatter: function (value, row, index) {
if (value == null || value == '') { if (value == null || value == '') {
return 0; return 0;
@ -166,6 +172,7 @@
"materialDescribe": item.materialDescribe, "materialDescribe": item.materialDescribe,
"materialBrand": item.materialBrand, "materialBrand": item.materialBrand,
"materialUnit": item.materialUnit, "materialUnit": item.materialUnit,
"materialDeptType": item.warehouseDept,
"materialProcessMethod": item.materialProcessMethod, "materialProcessMethod": item.materialProcessMethod,
"notifyHasArrivedNum": item.notifyHasArrivedNum, "notifyHasArrivedNum": item.notifyHasArrivedNum,
"actualHasArrivedNum": item.actualHasArrivedNum, "actualHasArrivedNum": item.actualHasArrivedNum,
@ -174,9 +181,6 @@
"notifyArriveNum": item.notifyArriveNum, //通知到货数量 "notifyArriveNum": item.notifyArriveNum, //通知到货数量
"actualArriveNum": item.actualArriveNum, //实际到货数量 "actualArriveNum": item.actualArriveNum, //实际到货数量
"relatedOrderCode":purchaseOrderCode, "relatedOrderCode":purchaseOrderCode,
"warehouseCode":warehouseCode,
"warehouseName":warehouseName,
"warehouseDetailAddress":warehouseDetailAddress,
// ...其他字段 // ...其他字段
}; };
}); });
@ -191,7 +195,7 @@
// 使用 JSON.stringify() 序列化数据 // 使用 JSON.stringify() 序列化数据
const jsonData = JSON.stringify(combinedData); const jsonData = JSON.stringify(combinedData);
// 发送 AJAX 请求到后端接口 // 发送 AJAX 请求到后端接口
$.operate.saveJson(prefix + "/addPurchaseOrderStorage", jsonData); $.operate.saveJson(prefix + "/addPurchaseOrderStorageSave", jsonData);
} }
$("input[name='arrivedTime']").datetimepicker({ $("input[name='arrivedTime']").datetimepicker({
format: "yyyy-mm-dd", format: "yyyy-mm-dd",

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

@ -3,6 +3,7 @@
<head> <head>
<th:block th:include="include :: header('采购订单列表')" /> <th:block th:include="include :: header('采购订单列表')" />
<th:block th:include="include :: datetimepicker-css"/> <th:block th:include="include :: datetimepicker-css"/>
<th:block th:include="include :: bootstrap-select-css"/>
<script type="text/javascript" th:src="@{/js/axios.min.js}"></script> <script type="text/javascript" th:src="@{/js/axios.min.js}"></script>
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
@ -132,18 +133,13 @@
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js"/> <th:block th:include="include :: datetimepicker-js"/>
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript"> <script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('purchase:purchaseOrder:edit')}]]; var editFlag = [[${@permission.hasPermi('purchase:purchaseOrder:edit')}]];
var removeFlag = [[${@permission.hasPermi('purchase:purchaseOrder:remove')}]];
var closeCaseNoDatas = [[${@dict.getType('sys_whether')}]];
var confirmNoDatas = [[${@dict.getType('sys_whether')}]];
var auditNoDatas = [[${@dict.getType('sys_whether')}]];
var approveNoDatas = [[${@dict.getType('sys_whether')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]]; var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]]; var useStatusDatas = [[${@dict.getType('useStatus')}]];
var eceiptStatusDatas = [[${@dict.getType('eceiptStatus')}]]; var eceiptStatusDatas = [[${@dict.getType('sys_eceipt_status')}]];
var paymentStatusDatas = [[${@dict.getType('sys_pay_status')}]]; var paymentStatusDatas = [[${@dict.getType('sys_pay_close')}]];
var purchaseCategoryDatas = [[${@dict.getType('purchase_category')}]];
var prefix = ctx + "purchase/purchaseOrder"; var prefix = ctx + "purchase/purchaseOrder";
$(function() { $(function() {
var options = { var options = {
@ -153,10 +149,16 @@
removeUrl: prefix + "/remove", removeUrl: prefix + "/remove",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
clickToSelect: true, clickToSelect: true,
pageList: [5, 10, 25, 50],
pageSize: 10,
sortable: true, // 是否启用排序
sortStable: true, // 设置为 true 将获得稳定的排序
modalName: "采购订单", modalName: "采购订单",
detailView: true, detailView: true,
fixedColumns: true, // 启用冻结列 fixedColumns: true, // 启用冻结列
fixedRightNumber: 1, // 冻结右列个数 fixedRightNumber: 1, // 冻结右列个数
method: 'post',
contentType: "application/x-www-form-urlencoded",
onExpandRow : function(index,row,$detail){ onExpandRow : function(index,row,$detail){
$detail.html('<table class="table-container" id="purchase_order_child_'+row.id+'"></table>').find('table'); $detail.html('<table class="table-container" id="purchase_order_child_'+row.id+'"></table>').find('table');
// 一阶 // 一阶
@ -166,37 +168,25 @@
{checkbox: true}, {checkbox: true},
{title: '采购订单id',field: 'purchaseOrderId', visible: false}, {title: '采购订单id',field: 'purchaseOrderId', visible: false},
{title:'审核状态',field: 'auditStatus',formatter: function (value, row, index) { {title:'审核状态',field: 'auditStatus',formatter: function (value, row, index) {
$.table.selectDictLabel(auditStatusDatas, value); return $.table.selectDictLabel(auditStatusDatas, value);
}}, }},
{title:'使用状态',field: 'useStatus',formatter: function (value, row, index) { {title:'使用状态',field: 'useStatus',formatter: function (value, row, index) {
$.table.selectDictLabel(useStatusDatas, value); return $.table.selectDictLabel(useStatusDatas, value);
}}, }},
{title:'收货状态',field: 'eceiptStatus',formatter: function (value, row, index) { {title:'收货状态',field: 'eceiptStatus',formatter: function (value, row, index) {
$.table.selectDictLabel(eceiptStatusDatas, value);} return $.table.selectDictLabel(eceiptStatusDatas, value);}
}, },
{title:'打款结案状态',field:'paymentStatus',formatter: function (value, row, index) { {title:'打款结案状态',field:'paymentStatus',formatter: function (value, row, index) {
$.table.selectDictLabel(paymentStatusDatas, value); return $.table.selectDictLabel(paymentStatusDatas, value);
}}, }},
{title:'采购单号',field: 'purchaseOrderCode'}, {title:'采购单号',field: 'purchaseOrderCode'},
{title: '联系人',field: 'customerContact',visible: false},
{title: '联系电话',field: 'contactNumber',visible: false},
{title:'供应商数量',field: 'supplierNum'}, {title:'供应商数量',field: 'supplierNum'},
{title:'物料合计',field: 'materialAmount'}, {title:'物料合计',field: 'materialAmount'},
{title:'数量合计',field: 'materialSum'}, {title:'数量合计',field: 'materialSum'},
{title:'不含税总价(RMB)',field: 'noRmbSum'}, {title:'不含税总价(RMB)',field: 'noRmbSum'},
{title:'含税总价(RMB)',field: 'rmbSum'}, {title:'含税总价(RMB)',field: 'rmbSum'},
{field: 'createTime', title: '录入时间', {title: '录入时间',field: 'createTime', },
formatter: function (value, row, index) { {title: '上次更新时间',field: 'updateTime',},
if (value == null) { return " ";}
else { var vArr = value.split(',');return vArr[0];}
}
},
{field: 'updateTime',title: '上次更新时间',
formatter: function (value, row, index) {
if (value == null) {return ""; }
else { var vArr = value.split(',');return vArr[0];}
}
},
{title: '操作',align: 'center', {title: '操作',align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];

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

@ -2,8 +2,8 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('新增采购计划单')" /> <th:block th:include="include :: header('新增采购计划单')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" /> <th:block th:include="include :: select2-css" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-editable-css" /> <th:block th:include="include :: bootstrap-editable-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
@ -81,8 +81,8 @@
</div> </div>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" /> <th:block th:include="include :: select2-js" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-table-editable-js" /> <th:block th:include="include :: bootstrap-table-editable-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "purchase/purchaseOrder"; var prefix = ctx + "purchase/purchaseOrder";
@ -158,7 +158,7 @@
else{ else{
material.purchaseSupplierList.forEach(supplier => { material.purchaseSupplierList.forEach(supplier => {
const key = `${supplier.supplierCode}_${supplier.materialCode}`; const key = `${supplier.supplierCode}_${supplier.materialCode}`;
$supplierInfo = $('<div class="card supplier-card" id="supplierInfo-' + tableId + '"></div>'); $supplierInfo = $('<div class="supplier-card" id="supplierInfo-' + tableId + '"></div>');
if (!uniqueSuppliers.map(s => `${s.supplierCode}_${s.materialCode}`).includes(key)) { if (!uniqueSuppliers.map(s => `${s.supplierCode}_${s.materialCode}`).includes(key)) {
uniqueSuppliers.push(supplier); uniqueSuppliers.push(supplier);
}else{ }else{
@ -172,31 +172,31 @@
// 卡片样式容器,用于包裹每个供应商的信息 // 卡片样式容器,用于包裹每个供应商的信息
// 构建供应商信息头部 // 构建供应商信息头部
var $headerContent = var $headerContent =
$('<div class="card-header" id = "supplier-' + tableId + '_' + supplierIndex + '">' + $('<div class="card-header suppplier_card" id = "supplier-' + tableId + '_' + supplierIndex + '">' +
'<div class="row">' + '<div class="row">' +
'<div class="crad-text">'+ '<div class="crad-text">'+
'<h4>供应商 ' + supplierIndex + ':' + '</h4>' + '<h4>供应商 ' + supplierIndex + ':' + '</h4>' +
'<span class="supplierCode_'+ supplierIndex +'">' + supplier.supplierCode + '</span>' + '-' + '<span class="supplierCode">' + supplier.supplierCode + '</span>' + '-' +
'<span class="supplierName_'+ supplierIndex +'">' + supplier.supplierName + '</span>' + '<span class="supplierName">' + supplier.supplierName + '</span>' +
'-最新不含税采购价: ' +'<span id="supplierMaterialNoRmb-' + tableId + '" class="supplierMaterialNoRmb_'+ supplierIndex +'">' + supplier.materialNoRmb +'</span>'+ '-最新不含税采购价: ' +'<span id="supplierMaterialNoRmb-' + tableId + '" class="supplierMaterialNoRmb">' + supplier.materialNoRmb +'</span>'+
' RMB 最新含税采购价: ' +'<span class="supplierMaterialRmb_'+ supplierIndex +'">' + supplier.materialRmb + '</span> RMB ' + ' RMB 最新含税采购价: ' +'<span class="supplierMaterialRmb">' + supplier.materialRmb + '</span> RMB ' +
'<span class="supplierPurchasePlanCode_'+ supplierIndex +'" hidden="hidden" >' + material.planCodes + '</span>' + '<span class="supplierPurchasePlanCode" hidden="hidden" >' + material.planCodes + '</span>' +
'<span class="supplierCorrelationCode_'+ supplierIndex +'" hidden="hidden" >' + material.correlationCodes + '</span>' + '<span class="supplierCorrelationCode" hidden="hidden" >' + material.correlationCodes + '</span>' +
'<span class="supplierPurchaseQuoteCode_'+ supplierIndex +'" hidden="hidden" >' + supplier.purchaseQuoteCode + '</span>' + '<span class="supplierPurchaseQuoteCode" hidden="hidden" >' + supplier.purchaseQuoteCode + '</span>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<div class="row">' + '<div class="row">' +
'<div class="form-row">' + '<div class="form-row">' +
'<label class="col-sm-2"> 实际采购数: </label>' + '<label class="col-sm-2"> 实际采购数: </label>' +
'<div class ="col-sm-4">' + '<div class ="col-sm-4">' +
'<input type="text" name="materialNum" class="form-control supplierMaterialNum_'+ supplierIndex +'"" id="actualPurchaseNum_' + tableId + '">' + '<input type="text" name="materialNum" class="form-control supplierMaterialNum" id="actualPurchaseNum_' + tableId + '">' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<div class="form-row">' + '<div class="form-row">' +
'<label class="col-sm-2">计划交付时间: </label>' + '<label class="col-sm-2">计划交付时间: </label>' +
'<div class ="col-sm-4">' + '<div class ="col-sm-4">' +
'<div class="input-group date"> ' + '<div class="input-group date"> ' +
'<input type="text" name="deliveryTime" class="form-control supplierDeliveryTime_'+ supplierIndex +'"" id="deliveryTime_' + tableId + '">' + '<input type="text" name="deliveryTime" class="form-control supplierDeliveryTime" id="deliveryTime_' + tableId + '">' +
'<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' + '<span class="input-group-addon"><i class="fa fa-calendar"></i></span>' +
'</div> ' + '</div> ' +
'</div>' + '</div>' +
@ -249,7 +249,6 @@
} }
recalculateTotals(tableId); // 重新计算当前物料的合计 recalculateTotals(tableId); // 重新计算当前物料的合计
}); });
getWarehouseInfo();
}); });
// 新增函数:重新计算某物料的采购数量合计、不含税采购总价和含税采购总价 // 新增函数:重新计算某物料的采购数量合计、不含税采购总价和含税采购总价
function recalculateTotals(tableId) { function recalculateTotals(tableId) {
@ -362,8 +361,13 @@
} }
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
var materialSum = 0;
var materialNoRmbSum = 0;
var materialRmbSum = 0;
//添加去除供应商编号数组
var supplierNumList = [];
var purchaseOrder = { var purchaseOrder = {
supplierNum: 0,materialNum: 0,materialNoRmbSum: 0,materialRmbSum: 0, supplierNum: 0,materialNum: 0,noRmbSum: 0,rmbSum: 0,
stockNo: $("#stockNo").val(), stockNo: $("#stockNo").val(),
stockName: $("#stockName").val(), stockName: $("#stockName").val(),
stockAddress: $("#stockAddress").val(), stockAddress: $("#stockAddress").val(),
@ -376,18 +380,27 @@
var tableId = tableIdList[index]; var tableId = tableIdList[index];
let materialObj = materialList[index]; let materialObj = materialList[index];
if (typeof materialObj === 'undefined') return; if (typeof materialObj === 'undefined') return;
$('#' + 'material-' + tableId).find('.supplier-card').each(function(supplierIndex, supplierCard) { $('#' + 'material-' + tableId).find('.suppplier_card').each(function(supplierIndex, supplierCard) {
var supplierCode = $(supplierCard).find('.supplierCode_'+ supplierIndex ).text().trim(); var supplierCode = $(supplierCard).find('.supplierCode').text().trim();
var supplierName = $(supplierCard).find('.supplierName_'+ supplierIndex).text().trim(); var supplierName = $(supplierCard).find('.supplierName').text().trim();
var materialRealNum = parseInt($(supplierCard).find('.supplierMaterialNum_'+ supplierIndex ).val(), 10) || 0; var materialRealNum = parseInt($(supplierCard).find('.supplierMaterialNum' ).val(), 10) || 0;
var materialRealRmb = parseFloat($(supplierCard).find('.supplierMaterialRmb_'+ supplierIndex).text(), 10) || 0; var materialRealRmb = parseFloat($(supplierCard).find('.supplierMaterialRmb').text(), 10) || 0;
var materialRealNoRmb = parseFloat($(supplierCard).find('.supplierMaterialNoRmb_'+ supplierIndex ).text(), 10) || 0; var materialRealNoRmb = parseFloat($(supplierCard).find('.supplierMaterialNoRmb').text(), 10) || 0;
var deliveryTime = $(supplierCard).find('.supplierDeliveryTime_'+ supplierIndex ).val(); var deliveryTime = $(supplierCard).find('.supplierDeliveryTime' ).val();
var purchasePlanCode = $(supplierCard).find('.supplierPurchasePlanCode_'+ supplierIndex).text().trim(); var purchasePlanCode = $(supplierCard).find('.supplierPurchasePlanCode').text().trim();
var correlationCode = $(supplierCard).find('.supplierCorrelationCode_'+ supplierIndex ).text().trim(); var correlationCode = $(supplierCard).find('.supplierCorrelationCode' ).text().trim();
var purchaseQuoteCode = $(supplierCard).find('.supplierPurchaseQuoteCode_'+ supplierIndex ).text().trim(); var purchaseQuoteCode = $(supplierCard).find('.supplierPurchaseQuoteCode').text().trim();
var materialRealRmbSum = parseFloat(materialRealRmb) * parseFloat(materialRealNum); var materialRealRmbSum = parseFloat(materialRealRmb) * parseFloat(materialRealNum);
var materialRealNoRmbSum = parseFloat(materialRealNoRmb) * parseFloat(materialRealNum); var materialRealNoRmbSum = parseFloat(materialRealNoRmb) * parseFloat(materialRealNum);
if (materialRealNum > 0) {
materialSum += materialRealNum;
materialNoRmbSum += materialRealNoRmbSum;
materialRmbSum += materialRealRmbSum;
if (supplierNumList.indexOf(supplierCode) === -1) {
supplierNumList.push(supplierCode);
purchaseOrder.supplierNum += 1;
}
}
var materialData = { var materialData = {
materialCode: materialObj.materialCode, materialCode: materialObj.materialCode,
materialName: materialObj.materialName, materialName: materialObj.materialName,
@ -417,25 +430,24 @@
}); });
}); });
// 计算整个订单的合计值,这部分应在遍历完所有物料后执行
let totalMaterialNum = purchaseOrder.materialNum;
let totalNoRmbSum = purchaseOrder.materialNoRmbSum;
let totalRmbSum = purchaseOrder.materialRmbSum;
let totalPurchaseSum = totalNoRmbSum; // 或者根据实际业务逻辑调整
// 将合计值附加到purchaseOrder对象 // 将合计值附加到purchaseOrder对象
purchaseOrder.totalMaterialSum = totalMaterialNum; purchaseOrder.materialSum = materialSum;
purchaseOrder.totalPurchaseSum = totalPurchaseSum; purchaseOrder.materialNoRmbSum = materialNoRmbSum;
purchaseOrder.totalNoRmbSum = totalNoRmbSum.toFixed(2); purchaseOrder.materialRmbSum = materialRmbSum;
purchaseOrder.totalRmbSum = totalRmbSum.toFixed(2); purchaseOrder.supplierNum = supplierNumList.length;
// 发送数据到后端API // 发送数据到后端API
$.operate.saveJson(prefix + "/addPurchaseOrder",JSON.stringify(purchaseOrder)); $.operate.saveJson(prefix + "/addPurchaseOrder",JSON.stringify(purchaseOrder));
} }
} }
//获取仓库相关信息 //获取仓库相关信息Select2
function getWarehouseInfo() { $("#stockNo").on("select2:select", function (e) {
var data = e.params.data;
$("#stockName").val(data.stockName);
$("#stockAddress").val(data.stockAddr);
$("#stockContact").val(data.stockManager);
});
$("#stockNo").select2({ $("#stockNo").select2({
theme: "bootstrap", theme: "bootstrap",
allowClear: true, allowClear: true,
@ -461,20 +473,12 @@
}, },
escapeMarkup: function (markup) {return markup;}, escapeMarkup: function (markup) {return markup;},
} }
})
}
$("#stockNo").on("select2:select", function (e) {
var data = e.params.data;
$("#stockName").val(data.stockName);
$("#stockAddress").val(data.stockAddr);
$("#stockContact").val(data.stockmanager);
}); });
$("input[name='deliveryTime']").datepicker({ $("input[name='deliveryTime']").datepicker({
language: 'zh-CN', language: 'zh-CN',
autoclose: true,
todayHighlight: true, todayHighlight: true,
format: "yyyy-mm-dd" format: "yyyy-mm-dd",
autoClose: true,
}); });
</script> </script>
</body> </body>

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

@ -163,9 +163,10 @@
if(selections.length > 1 ){ if(selections.length > 1 ){
//·拼接采购计划单号 //·拼接采购计划单号
for(let i=0;i<selections.length;i++){ for(let i=0;i<selections.length;i++){
purchasePlanCodes += selections[i].purchasePlanCode + ",";
if(i === selections.length - 1){ if(i === selections.length - 1){
purchasePlanCodes += selections[i].purchasePlanCode ; purchasePlanCodes += selections[i].purchasePlanCode ;
}else{
purchasePlanCodes += selections[i].purchasePlanCode + ",";
} }
} }
}else if(selections.length === 1){ }else if(selections.length === 1){

Loading…
Cancel
Save