diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java index 3afe0925..29f0b1be 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java @@ -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 roleKeys = roleService.selectRoleKeys(userId); // 采购角色只能看到自己创建的数据 startPage(); - List list = purchaseOrderService.selectPurchaseOrderList(purchaseOrderVo); + List 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 list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); - ExcelUtil util = new ExcelUtil(PurchaseOrderVo.class); + List list = purchaseOrderService.selectPurchaseOrderList(purchaseOrder); + ExcelUtil util = new ExcelUtil(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); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java index 29852448..4300da38 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseOrderChild.java +++ b/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() { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java index a4f6cfb1..216bd7d1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseOrderMapper.java +++ b/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 selectPurchaseOrderList(PurchaseOrder purchaseOrder); + public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); /** * 新增采购订单 @@ -65,7 +65,7 @@ public interface PurchaseOrderMapper public List selectOrderByIdDesc(); //根据采购订单编号查询采购订单 - PurchaseOrderVo selectPurchaseOrderByOrderCode(String purchaseOrderCode); + PurchaseOrder selectPurchaseOrderByOrderCode(String purchaseOrderCode); //校验采购订单编号是否唯一 public Integer checkPurchaseOrderCodeUnique(String purchaseOrderCode); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java index de4840bb..bed37a35 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java +++ b/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 selectPurchaseOrderList(PurchaseOrderVo purchaseOrder); + public List selectPurchaseOrderList(PurchaseOrder purchaseOrder); /** * 新增采购订单 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index de043dfb..5780051f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -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 selectPurchaseOrderList(PurchaseOrderVo purchaseOrderVo) + public List selectPurchaseOrderList(PurchaseOrder purchaseOrder) { - - // PageHelper 仅对第一个 List 分页 - List 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 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 warehouseStorageOrderList = warehouseStorageOrderMapper.selectWarehouseStorageOrderList(warehouseStorageOrder1); List list = warehouseStorageOrder.getWarehouseStorageOrderDetailList(); - if(CollectionUtils.isEmpty(warehouseStorageOrderList)) { + int result = 0; + if(!CollectionUtils.isEmpty(list)) { //根据物料入库部门划分入库单,入库单类型:0 仓库,1 采购,生成入库单号 List list1 = list.stream().filter(e -> e.getMaterialDeptType().equals("0")).collect(Collectors.toList()); List 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 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/stock/mapper/StockInfoMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/stock/mapper/StockInfoMapper.java index 415efdc5..6afb0f25 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/stock/mapper/StockInfoMapper.java +++ b/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); diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml index 28123289..4394e42c 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderChildMapper.xml +++ b/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"> - + @@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + @@ -48,10 +48,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml index e775bcea..cf2bd08e 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml +++ b/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"> - + @@ -45,15 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - - - @@ -62,58 +53,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 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 diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html index 7e09361b..684d63ae 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/addPurchaseStorage.html @@ -10,11 +10,11 @@
- +
- +
@@ -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", diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html index e348a39e..b30ae4fd 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html @@ -3,6 +3,7 @@ + @@ -132,18 +133,13 @@
+ diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html index 4a8f317a..d468efa3 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html @@ -163,9 +163,10 @@ if(selections.length > 1 ){ //·拼接采购计划单号 for(let i=0;i