diff --git a/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java b/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java index b602414e..efbee6f7 100644 --- a/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java +++ b/src/main/java/com/glxp/api/controller/purchase/PurOrderController.java @@ -116,7 +116,10 @@ public class PurOrderController { if (purOrderRequest.getStatus() == null) { purOrderRequest.setStatus(11); //查询未审核和草稿状态 } - + String customerId = customerService.getCustomerId(); + if (!customerId.equals("110")) { + purOrderRequest.setSupId(customerId); + } List purApplyEntities = purOrderService.queryPageList(purOrderRequest); PageInfo pageInfo; pageInfo = new PageInfo<>(purApplyEntities); @@ -156,7 +159,7 @@ public class PurOrderController { purOrderEntity.setUpdateTime(new Date()); purOrderService.update(purOrderEntity); - if(postPurOrderRequest.isAutoPurchase() && StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())){ + if (postPurOrderRequest.isAutoPurchase() && StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())) { String billNo = ""; List purOrderDetailEntities = purOrderDetailService.findByOrderId(purOrderEntity.getId() + ""); @@ -164,61 +167,59 @@ public class PurOrderController { Map> map = purOrderDetailEntities.stream().collect(Collectors.groupingBy(PurOrderDetailEntity::getSupId)); + if (CollUtil.isNotEmpty(purOrderDetailEntities) && postPurOrderRequest.isAutoPurchase() == true + && StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())) { - if (CollUtil.isNotEmpty(purOrderDetailEntities) && postPurOrderRequest.isAutoPurchase() == true - && StrUtil.isNotEmpty(postPurOrderRequest.getTargetBillAction())) { - - for (Map.Entry> m : map.entrySet()) { - //生产单据表信息 - IoOrderEntity ioOrderEntity = new IoOrderEntity(); - ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd"))); - ioOrderEntity.setCorpOrderId(CustomUtil.getDate()); - ioOrderEntity.setMainAction(ConstantType.TYPE_PUT); - ioOrderEntity.setAction(postPurOrderRequest.getTargetBillAction()); - ioOrderEntity.setFromCorp(m.getKey()); - ioOrderEntity.setFromType(ConstantStatus.FROM_Order); - ioOrderEntity.setStatus(1); - ioOrderEntity.setDealStatus(1); - ioOrderEntity.setOrderType(1); - ioOrderEntity.setCreateTime(new Date()); - ioOrderEntity.setCreateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser()); - ioOrderEntity.setUpdateTime(new Date()); - ioOrderEntity.setUpdateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser()); - ioOrderEntity.setCustomerId("110"); - ioOrderEntity.setDeptCode(purOrderEntity.getDeptCode()); - ioOrderEntity.setInvCode(purOrderEntity.getInvCode()); - ioOrderService.insertOrder(ioOrderEntity); - billNo += ioOrderEntity.getBillNo() + ","; - //插入业务单表 - for (PurOrderDetailEntity obj : m.getValue()) { - BasicProductsEntity basicProductsEntity = purOrderDetailService.selectIoOrderDetailBiz(obj.getId()); - IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity(); - ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo()); - ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId())); - ioOrderDetailBizEntity.setCount(obj.getCount()); - ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid()); - ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode()); - ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc()); - ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh()); - ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc()); - ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory()); - ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname()); - ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh()); - if (basicProductsEntity.getPrice() != null) { - ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice())); - } - ioOrderDetailBizEntity.setSupId(obj.getSupId()); - ioOrderDetailBizService.insert(ioOrderDetailBizEntity); + for (Map.Entry> m : map.entrySet()) { + //生产单据表信息 + IoOrderEntity ioOrderEntity = new IoOrderEntity(); + ioOrderEntity.setBillNo(gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER, "yyyyMMdd"))); + ioOrderEntity.setCorpOrderId(CustomUtil.getDate()); + ioOrderEntity.setMainAction(ConstantType.TYPE_PUT); + ioOrderEntity.setAction(postPurOrderRequest.getTargetBillAction()); + ioOrderEntity.setFromCorp(m.getKey()); + ioOrderEntity.setFromType(ConstantStatus.FROM_Order); + ioOrderEntity.setStatus(1); + ioOrderEntity.setDealStatus(1); + ioOrderEntity.setOrderType(1); + ioOrderEntity.setCreateTime(new Date()); + ioOrderEntity.setCreateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser()); + ioOrderEntity.setUpdateTime(new Date()); + ioOrderEntity.setUpdateUser(postPurOrderRequest.getPurOrderEntity().getAuditUser()); + ioOrderEntity.setCustomerId("110"); + ioOrderEntity.setDeptCode(purOrderEntity.getDeptCode()); + ioOrderEntity.setInvCode(purOrderEntity.getInvCode()); + ioOrderService.insertOrder(ioOrderEntity); + billNo += ioOrderEntity.getBillNo() + ","; + //插入业务单表 + for (PurOrderDetailEntity obj : m.getValue()) { + BasicProductsEntity basicProductsEntity = purOrderDetailService.selectIoOrderDetailBiz(obj.getId()); + IoOrderDetailBizEntity ioOrderDetailBizEntity = new IoOrderDetailBizEntity(); + ioOrderDetailBizEntity.setOrderIdFk(ioOrderEntity.getBillNo()); + ioOrderDetailBizEntity.setBindRlFk(Long.valueOf(obj.getProductId())); + ioOrderDetailBizEntity.setCount(obj.getCount()); + ioOrderDetailBizEntity.setUuidFk(basicProductsEntity.getUuid()); + ioOrderDetailBizEntity.setNameCode(basicProductsEntity.getNameCode()); + ioOrderDetailBizEntity.setCoName(basicProductsEntity.getCpmctymc()); + ioOrderDetailBizEntity.setCertCode(basicProductsEntity.getZczbhhzbapzbh()); + ioOrderDetailBizEntity.setYlqxzcrbarmc(basicProductsEntity.getYlqxzcrbarmc()); + ioOrderDetailBizEntity.setManufacturer(basicProductsEntity.getManufactory()); + ioOrderDetailBizEntity.setMeasname(basicProductsEntity.getMeasname()); + ioOrderDetailBizEntity.setSpec(basicProductsEntity.getGgxh()); + if (basicProductsEntity.getPrice() != null) { + ioOrderDetailBizEntity.setPrice(BigDecimal.valueOf(basicProductsEntity.getPrice())); } + ioOrderDetailBizEntity.setSupId(obj.getSupId()); + ioOrderDetailBizService.insert(ioOrderDetailBizEntity); } - purOrderEntity.setStockOrderNo(billNo.substring(0, billNo.length() - 1)); - purOrderService.update(purOrderEntity); } + purOrderEntity.setStockOrderNo(billNo.substring(0, billNo.length() - 1)); + purOrderService.update(purOrderEntity); + } } - return ResultVOUtils.success("更新成功!"); } diff --git a/src/main/java/com/glxp/api/req/purchase/PurOrderRequest.java b/src/main/java/com/glxp/api/req/purchase/PurOrderRequest.java index f74661d5..845c4dc8 100644 --- a/src/main/java/com/glxp/api/req/purchase/PurOrderRequest.java +++ b/src/main/java/com/glxp/api/req/purchase/PurOrderRequest.java @@ -81,6 +81,7 @@ public class PurOrderRequest extends ListPageRequest { private Date auditTime; private String createUser; + private String supId; /** * 创建时间 diff --git a/src/main/resources/mybatis/mapper/purchase/PurOrderDao.xml b/src/main/resources/mybatis/mapper/purchase/PurOrderDao.xml index 8fcc3dd7..acf4c3d0 100644 --- a/src/main/resources/mybatis/mapper/purchase/PurOrderDao.xml +++ b/src/main/resources/mybatis/mapper/purchase/PurOrderDao.xml @@ -40,12 +40,15 @@ cb.employeeName createUserName, ab.employeeName auditUserName, auth_warehouse.NAME invName, - auth_dept.`name` deptName + auth_dept.`name` deptName, + basic_corp.name supName FROM pur_order LEFT JOIN auth_user cb ON pur_order.createUser = cb.id LEFT JOIN auth_user ab ON pur_order.auditUser = ab.id LEFT JOIN auth_warehouse ON pur_order.invCode = auth_warehouse.`code` LEFT JOIN auth_dept ON auth_dept.CODE = pur_order.deptCode + left join basic_corp on pur_order.supId = basic_corp.erpId + AND billNo = #{billNo} @@ -92,6 +95,9 @@ AND auditUser = #{auditUser} + + AND pur_order.supId = #{supId} + AND createUser = #{createUser}