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. 21
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml
  8. 125
      ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml
  9. 20
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml
  10. 64
      ruoyi-admin/src/main/resources/mapper/warehouse/WarehouseStorageOrderMapper.xml
  11. 18
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html
  12. 44
      ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html
  13. 140
      ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html
  14. 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")
@PostMapping("/list")
@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();
List<PurchaseOrderVo> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrderVo);
List<PurchaseOrder> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder);
return getDataTable(list);
}
/**
*
* 导出采购订单列表
*/
@RequiresPermissions("purchase:purchaseOrder:export")
@Log(title = "采购订单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(PurchaseOrderVo purchaseOrder)
public AjaxResult export(PurchaseOrder purchaseOrder)
{
List<PurchaseOrderVo> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder);
ExcelUtil<PurchaseOrderVo> util = new ExcelUtil<PurchaseOrderVo>(PurchaseOrderVo.class);
List<PurchaseOrder> list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder);
ExcelUtil<PurchaseOrder> util = new ExcelUtil<PurchaseOrder>(PurchaseOrder.class);
return util.exportExcel(list, "采购订单数据");
}
@ -206,7 +204,7 @@ public class PurchaseOrderController extends BaseController
@RequiresPermissions("purchase:purchaseOrder:addPurchaseOrderStorage")
@Log(title = "采购订单", businessType = BusinessType.INSERT)
@PostMapping("/addPurchaseOrderStorage")
@PostMapping("/addPurchaseOrderStorageSave")
@ResponseBody
public AjaxResult addPurchaseOrderStorageSave(@RequestBody WarehouseStorageOrder warehouseStorageOrder) {
// 数据校验,确保前端传入数据格式正确
@ -249,7 +247,7 @@ public class PurchaseOrderController extends BaseController
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
String processInstanceId = task.getProcessInstanceId();
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("taskId", taskId);
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
@ -308,7 +306,7 @@ public class PurchaseOrderController extends BaseController
* 自动绑定页面字段
*/
@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) {
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 = "通知到货数量")
private Integer notifyArriveNum;
private Integer notifyHasArriveNum;
private Integer notifyHasArrivedNum;
/** 实际已到货数量 */
@Excel(name = "实际已到货数量")
@ -152,12 +152,12 @@ public class PurchaseOrderChild extends BaseEntity
private Integer notifyArrivedNum;
public Integer getNotifyHasArriveNum() {
return notifyHasArriveNum;
public Integer getNotifyHasArrivedNum() {
return notifyHasArrivedNum;
}
public void setNotifyHasArriveNum(Integer notifyHasArriveNum) {
this.notifyHasArriveNum = notifyHasArriveNum;
public void setNotifyHasArrivedNum(Integer notifyHasArrivedNum) {
this.notifyHasArrivedNum = notifyHasArrivedNum;
}
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
* @return 采购订单
*/
public PurchaseOrderVo selectPurchaseOrderById(Long purchaseOrderId);
public PurchaseOrder selectPurchaseOrderById(Long purchaseOrderId);
/**
* 查询采购订单列表
@ -27,7 +27,7 @@ public interface PurchaseOrderMapper
* @param purchaseOrder 采购订单
* @return 采购订单集合
*/
public List<PurchaseOrderVo> selectPurchaseOrderList(PurchaseOrder purchaseOrder);
public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder);
/**
* 新增采购订单
@ -65,7 +65,7 @@ public interface PurchaseOrderMapper
public List<PurchaseOrderVo> selectOrderByIdDesc();
//根据采购订单编号查询采购订单
PurchaseOrderVo selectPurchaseOrderByOrderCode(String purchaseOrderCode);
PurchaseOrder selectPurchaseOrderByOrderCode(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;
import com.ruoyi.purchase.domain.PurchaseOrder;
import com.ruoyi.purchase.domain.PurchaseOrderVo;
import com.ruoyi.warehouse.domain.WarehouseStorageOrder;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.transaction.annotation.Transactional;
@ -22,7 +21,7 @@ public interface IPurchaseOrderService
* @param purchaseOrderId 采购订单ID
* @return 采购订单
*/
public PurchaseOrderVo selectPurchaseOrderById(Long purchaseOrderId);
public PurchaseOrder selectPurchaseOrderById(Long purchaseOrderId);
/**
* 查询采购订单列表
@ -30,7 +29,7 @@ public interface IPurchaseOrderService
* @param purchaseOrder 采购订单
* @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;
import com.github.pagehelper.Page;
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.text.Convert;
import com.ruoyi.common.service.ICommonService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.process.todoitem.mapper.BizTodoItemMapper;
import com.ruoyi.purchase.domain.PurchaseOrder;
@ -30,10 +26,7 @@ import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper;
import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper;
import lombok.extern.slf4j.Slf4j;
import org.activiti.engine.TaskService;
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl;
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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -46,6 +39,8 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static com.github.pagehelper.page.PageMethod.startPage;
/**
* 采购订单Service业务层处理
*
@ -104,30 +99,25 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
* @return 采购订单
*/
@Override
public PurchaseOrderVo selectPurchaseOrderById(Long purchaseOrderId)
public PurchaseOrder selectPurchaseOrderById(Long purchaseOrderId)
{
PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(purchaseOrderId);
SysUser sysUser = userMapper.selectUserByLoginName(purchaseOrderVo.getApplyUser());
if (sysUser != null) {
purchaseOrderVo.setApplyUserName(sysUser.getUserName());
}
return purchaseOrderVo ;
// SysUser sysUser = userMapper.selectUserByLoginName(purchaseOrderVo.getApplyUser());
// if (sysUser != null) {
// purchaseOrderVo.setApplyUserName(sysUser.getUserName());
// }
return purchaseOrderMapper.selectPurchaseOrderById(purchaseOrderId);
}
/**
* 查询采购订单列表
*
* @param purchaseOrderVo 采购订单
* @param purchaseOrder 采购订单
* @return 采购订单
*/
@Override
public List<PurchaseOrderVo> selectPurchaseOrderList(PurchaseOrderVo purchaseOrderVo)
public List<PurchaseOrder> selectPurchaseOrderList(PurchaseOrder purchaseOrder)
{
// PageHelper 仅对第一个 List 分页
List<PurchaseOrderVo> list = purchaseOrderMapper.selectPurchaseOrderList(purchaseOrderVo);
return list;
return purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder);
}
/**
@ -167,32 +157,27 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
if (planCode != null) {
PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
// 累加物料数量和金额
//获取物料供应商采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialNoRmb();
// 获取物料供应商采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRmb();
//获取物料供应商不含税采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb();
// 获取物料供应商含税采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
// 获取物料数量
Long suplierMaterialNum = child.getMaterialNum();
if (suplierMaterialNum == null) {suplierMaterialNum = 0L;}
if (suplierMaterialRmb == null) {suplierMaterialRmb = BigDecimal.ZERO;}
if (suplierMaterialNoRmb == null) {suplierMaterialNoRmb = BigDecimal.ZERO;}
// 累加物料数量
materialNum += suplierMaterialNum;
// 累加不含税物料价格
materialNoRmb = materialNoRmb.add(suplierMaterialNoRmb);
// 累加含税物料价格
materialRmb = materialRmb.add(suplierMaterialRmb);
// 计算不含税物料总价
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;}
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;}
if(suplierMaterialNum == null){suplierMaterialNum = 0L;}
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 计算物料含税
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 累加物料数量
materialNum += suplierMaterialNum;
// 累加物料总价
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价
materialRmbSum = materialRmbSum.add(suplierMaterialRmbSumLocal);
// 设置采购报价单编号和供应商信息到QuoteChild
material.setPurchaseQuoteCode(purchaseOrder.getPurchaseOrderCode());
material.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
material.setSupplierCode(child.getSupplierCode());
material.setMaterialUnit(child.getMaterialUnit());
material.setWarehouseDept(child.getWarehouseDept());
@ -203,23 +188,26 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
material.setMaterialDescribe(child.getMaterialDescribe());
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl());
material.setMaterialProcessMethod(child.getMaterialProcessMethod());
material.setWarehouseDept(child.getWarehouseDept());
//计划采购数
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmb(child.getMaterialNoRmb());
material.setMaterialRmb(child.getMaterialRmb());
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setMaterialRmbSum(child.getMaterialRmbSum());
//实际采购数
material.setMaterialRealNum(child.getMaterialRealNum());
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb());
material.setMaterialRealRmb(child.getMaterialRealRmb());
material.setMaterialRealRmbSum(child.getMaterialRealRmbSum());
material.setMaterialRealNoRmbSum(child.getMaterialRealNoRmbSum());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setCorrelationCode(correlationCode);
material.setPurchasePlanCode(planCode);
//实际采购单价合计
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(child.getCorrelationCode());
material.setPurchasePlanCode(child.getPurchasePlanCode());
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0");
material.setPaymentStatus("0");
material.setDelFlag("0");
// 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(child);
PurchasePlan plan = new PurchasePlan();
@ -228,31 +216,26 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
int result = purchasePlanService.updatePurchasePlan(plan);
}
}
child.setMaterialNoRmb(BigDecimal.ZERO);
}
else if ((child.getCorrelationCode().contains(",")==false)
else if ((!child.getCorrelationCode().contains(","))
&& child.getPurchasePlanCode() != null) {
PurchaseOrderChild material = new PurchaseOrderChild();
child.setPurchaseOrderCode(purchaseOrder.getPurchaseOrderCode());
//获取物料供应商采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialNoRmb();
// 获取物料供应商采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRmb();
//获取物料供应商不含税采购价格
BigDecimal suplierMaterialNoRmb = child.getMaterialRealNoRmb();
// 获取物料供应商含税采购价格
BigDecimal suplierMaterialRmb = child.getMaterialRealRmb();
// 获取物料数量
Long suplierMaterialNum = child.getMaterialNum();
// 累加物料数量
materialNum += suplierMaterialNum;
if(suplierMaterialNoRmb == null){suplierMaterialNoRmb = BigDecimal.ZERO;}
if(suplierMaterialRmb == null){suplierMaterialRmb = BigDecimal.ZERO;}
if(suplierMaterialNum == null){suplierMaterialNum = 0L;}
// 累加不含税物料价格
materialNoRmb = materialNoRmb.add(suplierMaterialNoRmb);
// 累加含税物料价格
materialRmb = materialRmb.add(suplierMaterialRmb);
// 计算不含税物料总价
//获取供应商不含税价格合计 = 物料数量 * 供应商采购不含税价格
BigDecimal suplierMaterialNoRmbSumLocal = suplierMaterialNoRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 计算物料含税
//获取供应商含税价格合计 = 物料数量 * 供应商采购含税价格
BigDecimal suplierMaterialRmbSumLocal = suplierMaterialRmb.multiply(BigDecimal.valueOf(suplierMaterialNum));
// 累加物料数量
materialNum += suplierMaterialNum;
// 累加物料总价
materialNoRmbSum = materialNoRmbSum.add(suplierMaterialNoRmbSumLocal);
// 累加物料含税总价
@ -269,23 +252,26 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
material.setMaterialDescribe(child.getMaterialDescribe());
material.setMaterialPhotoUrl(child.getMaterialPhotoUrl());
material.setMaterialProcessMethod(child.getMaterialProcessMethod());
material.setWarehouseDept(child.getWarehouseDept());
//计划采购数
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmb(child.getMaterialNoRmb());
material.setMaterialRmb(child.getMaterialRmb());
material.setMaterialNum(child.getMaterialNum());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
material.setMaterialRmbSum(child.getMaterialRmbSum());
//实际采购数
material.setMaterialRealNum(child.getMaterialRealNum());
material.setMaterialRealNoRmb(child.getMaterialRealNoRmb());
material.setMaterialRealRmb(child.getMaterialRealRmb());
material.setMaterialRealRmbSum(child.getMaterialRmbSum());
material.setMaterialRealNoRmbSum(child.getMaterialRealNoRmbSum());
material.setMaterialNoRmbSum(child.getMaterialNoRmbSum());
//实际采购单价合计
material.setMaterialRealRmbSum(suplierMaterialRmbSumLocal);
material.setMaterialRealNoRmbSum(suplierMaterialNoRmbSumLocal);
material.setCorrelationCode(child.getCorrelationCode());
material.setPurchasePlanCode(child.getPurchasePlanCode());
material.setPurchaseQuoteCode(child.getPurchaseQuoteCode());
//收货状态,0:未收货,1:已收货 收款状态:0:待付款,1:已付款
material.setEceiptStatus("0");
material.setPaymentStatus("0");
material.setDelFlag("0");
// 执行子表插入操作
purchaseOrderChildService.insertPurchaseOrderChild(child);
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.setRmbSum(materialRmbSum);
// 设置主表的供应商数量
purchaseOrder.setSupplierNum(supplierNum);
purchaseOrder.setDelFlag("0");
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);
}
@ -358,13 +357,14 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
* 采购订单创建采购入库通知单
* */
@Override
@Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = RuntimeException.class)
public int addPurchaseOrderStorage(WarehouseStorageOrder warehouseStorageOrder){
WarehouseStorageOrder warehouseStorageOrder1 = new WarehouseStorageOrder();
warehouseStorageOrder1.setRelatedOrderCode(warehouseStorageOrder.getRelatedOrderCode());
List<WarehouseStorageOrder> warehouseStorageOrderList = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder1);
List<WarehouseStorageOrderDetail> list = warehouseStorageOrder.getWarehouseStorageOrderDetailList();
if(CollectionUtils.isEmpty(warehouseStorageOrderList)) {
int result = 0;
if(!CollectionUtils.isEmpty(list)) {
//根据物料入库部门划分入库单,入库单类型:0 仓库,1 采购,生成入库单号
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());
@ -372,7 +372,7 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
//WarehouseStorageType 仓库入库类型(0采购入库、1供应商补货、2委内入库、3公司退货、4委外入库、5生产入库),
//setWarehouseOrderType仓库订单类型(0采购订单、1生产订单、2退换货订单、3委外订单),
//WarehouseDeptType 仓库入库部门类型(0仓库,1采购 ),
if(!CollectionUtils.isEmpty(list1)) {
if(list1.size() > 0) {
//采购入库单,物料入库列表信息读取,放入生成的入库订单号
String warehouseStorageCode = redisCache.generateBillNo("RK");
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list1) {
@ -386,10 +386,13 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode);
warehouseStorageOrder.setWarehouseStorageType("0");
warehouseStorageOrder.setWarehouseDeptType("0");
warehouseStorageOrder.setWarehouseOrderType("1");
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");
//仓库入库单
for (WarehouseStorageOrderDetail warehouseStorageOrderDetail: list2) {
@ -402,15 +405,19 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
//入库代表为仓库部分的入库单
warehouseStorageOrder.setWarehouseStorageCode(warehouseStorageCode1);
warehouseStorageOrder.setWarehouseStorageStatus("0");
warehouseStorageOrder.setWarehouseQualityStatus("0");
warehouseStorageOrder.setWarehouseStorageType("1");
warehouseStorageOrder.setWarehouseOrderType("0");
warehouseStorageOrder.setWarehouseDeptType("1");
warehouseStorageOrder.setCreateTime(DateUtils.getNowDate());
warehouseStorageOrder.setCreateBy(ShiroUtils.getLoginName());
warehouseStorageOrder.setWarehouseStorageOrderDetailList(list2);
warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
result = warehouseStorageOrderMapper.insertWarehouseStorageOrder(warehouseStorageOrder);
}
}
return 0;
return result;
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -437,60 +444,70 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService
purchaseOrderMapper.updatePurchaseOrder(purchaseOrder);
return processInstance;
}
@Override
@Transactional(rollbackFor = Exception.class)
public ProcessInstance cancelPurchaseOrderById(Long id) {
PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id);
// 审核状态-待审核
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;
return null;
}
@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;
return null;
}
// @Override
// @Transactional(rollbackFor = Exception.class)
// public ProcessInstance cancelPurchaseOrderById(Long id) {
// PurchaseOrderVo purchaseOrderVo = purchaseOrderMapper.selectPurchaseOrderById(id);
// // 审核状态-待审核
// 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
// 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) {
Long materialId = purchaseOrder.getPurchaseOrderId();
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 仓库信息
*/
public StockInfo selectStockInfoById(Long stockId);

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

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.purchase.mapper.PurchaseOrderChildMapper">
<resultMap type="PurchaseOrderChild" id="PurchaseOrderChildResult">
<resultMap type="PurchaseOrderChild" id="PurchaseOrderChildResult">
<result property="purchaseOrderChildId" column="purchase_order_child_id" />
<result property="purchaseOrderCode" column="purchase_order_code" />
<result property="purchasePlanCode" column="purchase_plan_code" />
@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialProcessMethod" column="material_process_method" />
<result property="materialUnit" column="material_unit" />
<result property="hasStorageNum" column="has_storage_num" />
<result property="notifyArrivedNum" column="notify_arrived_num" />
<result property="notifyHasArrivedNum" column="notify_has_arrived_num" />
<result property="materialNoRmb" column="material_no_rmb" />
<result property="materialRmb" column="material_rmb" />
<result property="materialNum" column="material_num" />
@ -48,10 +48,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<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_
`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_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
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_describe, material_photoUrl, warehouseDept, material_process_method,
material_unit, material_no_rmb, material_rmb, material_num, material_amount,
material_sum, material_no_rmb_sum, material_rmb_sum, material_real_num, material_real_no_rmb, material_real_rmb,
material_real_no_rmb_sum, material_real_rmb_sum, delivery_time,
eceipt_status, payment_status, tax_rate, create_by, create_time, update_by, update_time, del_flag, standby_one, standby_two
from purchase_order_child
</sql>
<select id="selectPurchaseOrderChildList" parameterType="PurchaseOrderChild" resultMap="PurchaseOrderChildResult">
@ -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_real_num,p.material_real_no_rmb,p.material_real_rmb,p.material_real_no_rmb_sum,p.material_real_rmb_sum,
p.delivery_time,p.eceipt_status,p.payment_status,p.tax_rate,p.create_by,p.create_time,p.update_by,p.update_time,p.del_flag,
(select 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,
(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 where p.purchase_order_code = #{purchaseOrderCode};
w.has_storage_num,sum(w.notify_arrive_num) 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
where p.purchase_order_code = #{purchaseOrderCode} and GROUP BY supplier_code,material_code
</select>
</mapper>

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

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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="purchaseOrderCode" column="purchase_order_code" />
<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="stockContact" column="stock_contact" />
<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="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
@ -62,58 +53,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPurchaseOrderVo">
select purchase_order_id, purchase_order_code, supplier_code, supplier_name,
arrived_time, eceipt_type,
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,
delivery_conditions, delivery_method, purchase_name, billing_date, tax_rate,
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,
approve_time, standby_one, standby_two, instance_id, instance_type, instance_type_name,
submit_instance_id, cancel_instance_id, restore_instance_id, apply_title, apply_user, apply_time,
approve_time, standby_one, standby_two,
create_time, create_by, update_time, update_by from purchase_order
</sql>
<select id="selectPurchaseOrderList" parameterType="PurchaseOrder" resultMap="PurchaseOrderResult">
select s.purchaesse_order_id, s.purchase_order_code, s.supplier_code, s.supplier_name,
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
<include refid="selectPurchaseOrderVo"/>
<where>
<if test="purchaseOrderCode != null and purchaseOrderCode != ''"> and s.purchase_order_code like concat('%', #{purchaseOrderCode}, '%')</if>
<if test="purchaseBuyer != null and purchaseBuyer != ''"> and s.purchase_buyer = #{purchaseBuyer}</if>
del_flag = '0'
<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 != ''">
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 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 test="useStatus != null and useStatus != ''">and s.use_status = #{useStatus}</if>
<if test="eceiptStatus != null ">and s.eceipt_status = #{eceiptStatus}</if>
<if test="paymentStatus != null">and s.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="useStatus != null and useStatus != ''">and use_status = #{useStatus}</if>
<if test="eceiptStatus != null and eceiptStatus !='' ">and eceipt_status = #{eceiptStatus}</if>
<if test="paymentStatus != null and paymentStatus != '' ">and payment_status = #{paymentStatus}</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>
order by s.create_time desc
order by purchase_order_id desc
</select>
<select id="selectPurchaseOrderById" parameterType="Long" resultMap="PurchaseOrderResult">
@ -125,8 +93,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into purchase_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<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="contactNumber != null">contact_number,</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="purchaseCommander != null">purchase_commander,</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="standbyTwo != null">standby_two,</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>
<if test="arrivedTime != null">arrived_time,</if>
<if test="eceiptType != null">eceipt_type,</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="eceiptStatus != null">eceipt_status,</if>
<if test="useStatus != null">use_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="createBy != null">create_by,</if>
<if test="delFlag != null" >del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<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="contactNumber != null">#{contactNumber},</if>
<if test="customerFax != null">#{customerFax},</if>
<if test="deliveryAddress != null">#{deliveryAddress},</if>
<if test="paymentTerms != null">#{paymentTerms},</if>
<if test="deliveryConditions != null">#{deliveryConditions},</if>
<if test="deliveryMethod != null">#{deliveryMethod},</if>
<if test="deliveryConditions != null">#{deliveryConditions},</if>
<if test="purchaseName != null">#{purchaseName},</if>
<if test="billingDate != null">#{billingDate},</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="standbyOne != null">#{standbyOne},</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="stockName!= null">#{stockName},</if>
<if test="stockAddress!= null">#{stockAddress},</if>
<if test="stockContact!= null">#{stockContact},</if>
<if test="stockPhone!= null">#{stockPhone},</if>
<if test="arrivedTime != null">#{arrivedTime},</if>
<if test="eceiptType != null">#{eceiptType},</if>
<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="eceiptStatus != null">#{eceiptStatus},</if>
<if test="useStatus != null">#{useStatus},</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>
</insert>
@ -238,17 +199,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="stockContact!= null">stock_contact = #{stockContact},</if>
<if test="stockPhone!= null">stock_phone = #{stockPhone},</if>
<if test="arrivedTime != null">arrived_time = #{arrivedTime},</if>
<if test="eceiptType != null">eceipt_type = #{eceiptType},</if>
<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="eceiptStatus != null">eceipt_status = #{eceiptStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</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="updateBy !=null">update_by = #{updateBy},</if>
</trim>

20
ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml

@ -50,16 +50,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="customerRemarks" column="customer_remarks" />
<result property="updateBy" column="update_by" />
<result property="customerSign" column="customer_sign" />
<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="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" />
</resultMap>
<sql id="selectSysCustomerVo">
select id,enterprise_code,enterprise_name,english_name,customer_abbreviation ,customer_purser ,

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

@ -5,38 +5,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper">
<resultMap type="WarehouseStorageOrder" id="WarehouseStorageOrderResult">
<result property="warehouseStorageId" column="warehouse_storage_id" />
<result property="warehouseStorageCode" column="warehouse_storage_code" />
<result property="relatedOrderCode" column="related_order_code" />
<result property="warehouseStorageStatus" column="warehouse_storage_status" />
<result property="warehouseQualityStatus" column="warehouse_quality_status" />
<result property="warehouseStorageType" column="warehouse_storage_type" />
<result property="warehouseOrderType" column="warehouse_order_type" />
<result property="warehouseDeptType" column="warehouse_dept_type" />
<result property="notifyArrivedNum" column="notify_arrived_num" />
<result property="actualArrivedNum" column="actual_arrived_num" />
<result property="temporaryQualifiedNum" column="temporary_qualified_num" />
<result property="temporaryUnqualifiedNum" column="temporary_unqualified_num" />
<result property="qualityQualifiedNum" column="quality_qualified_num" />
<result property="qualityUnqualifiedNum" column="quality_unqualified_num" />
<result property="storageNum" column="storage_num" />
<result property="arrivedTime" column="arrived_time" />
<result property="temporaryTime" column="temporary_time" />
<result property="deliveryInspectionTime" column="delivery_inspection_time" />
<result property="qualityTime" column="quality_time" />
<result property="storageTime" column="storage_time" />
<result property="warehouseEmployee" column="warehouse_employee" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="warehouseDetailAddress" column="warehouse_detail_address" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="warehouseStorageId" column="warehouse_storage_id" />
<result property="warehouseStorageCode" column="warehouse_storage_code" />
<result property="relatedOrderCode" column="related_order_code" />
<result property="warehouseStorageStatus" column="warehouse_storage_status" />
<result property="warehouseQualityStatus" column="warehouse_quality_status" />
<result property="warehouseStorageType" column="warehouse_storage_type" />
<result property="warehouseOrderType" column="warehouse_order_type" />
<result property="warehouseDeptType" column="warehouse_dept_type" />
<result property="notifyArrivedNum" column="notify_arrived_num" />
<result property="actualArrivedNum" column="actual_arrived_num" />
<result property="temporaryQualifiedNum" column="temporary_qualified_num" />
<result property="temporaryUnqualifiedNum" column="temporary_unqualified_num" />
<result property="qualityQualifiedNum" column="quality_qualified_num" />
<result property="qualityUnqualifiedNum" column="quality_unqualified_num" />
<result property="storageNum" column="storage_num" />
<result property="arrivedTime" column="arrived_time" />
<result property="temporaryTime" column="temporary_time" />
<result property="deliveryInspectionTime" column="delivery_inspection_time" />
<result property="qualityTime" column="quality_time" />
<result property="storageTime" column="storage_time" />
<result property="warehouseEmployee" column="warehouse_employee" />
<result property="warehouseCode" column="warehouse_code" />
<result property="warehouseName" column="warehouse_name" />
<result property="warehouseDetailAddress" column="warehouse_detail_address" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<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>
<select id="selectWarehouseStorageOrderList" parameterType="WarehouseStorageOrder" resultMap="WarehouseStorageOrderResult">

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

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

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

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

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

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

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

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

Loading…
Cancel
Save