Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

1018653686@qq.com vor 1 Jahr
Ursprung
Commit
f3a8654438
56 geänderte Dateien mit 990 neuen und 703 gelöschten Zeilen
  1. 4 21
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountManagement.java
  2. 9 3
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountPayment.java
  3. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountPaymentRecords.java
  4. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRequestFunds.java
  5. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRequestFundsDetail.java
  6. 6 0
      hx-account/src/main/java/com/fjhx/account/entity/transaction/po/Transaction.java
  7. 6 0
      hx-account/src/main/java/com/fjhx/account/entity/transaction/po/TransactionDepartment.java
  8. 5 0
      hx-account/src/main/java/com/fjhx/account/entity/write/dto/WriteOffRecordsDto.java
  9. 9 22
      hx-account/src/main/java/com/fjhx/account/flow/AccountRequestFundsFlow.java
  10. 25 17
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountManagementServiceImpl.java
  11. 9 0
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentServiceImpl.java
  12. 4 0
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java
  13. 5 1
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRunningWaterServiceImpl.java
  14. 7 0
      hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionDepartmentServiceImpl.java
  15. 9 0
      hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionServiceImpl.java
  16. 9 0
      hx-account/src/main/java/com/fjhx/account/service/write/impl/WriteOffRecordsServiceImpl.java
  17. 5 0
      hx-iot/src/main/java/com/fjhx/iot/entity/tda/dto/TdaDeviceSelectDto.java
  18. 43 14
      hx-iot/src/main/java/com/fjhx/iot/entity/tda/po/TdaDevice.java
  19. 69 73
      hx-iot/src/main/java/com/fjhx/iot/service/tda/impl/TdaDeviceServiceImpl.java
  20. 27 13
      hx-iot/src/main/resources/mapper/tda/TdaDeviceMapper.xml
  21. 1 1
      hx-jushuitan/src/main/java/com/fjhx/jushuitan/initializers/JstInitializer.java
  22. 0 8
      hx-mes/src/main/java/com/fjhx/mes/entity/production/dto/ProductionReportingDto.java
  23. 21 3
      hx-mes/src/main/java/com/fjhx/mes/entity/production/po/ProductionReporting.java
  24. 5 5
      hx-mes/src/main/java/com/fjhx/mes/entity/production/po/ProductionReportingDetail.java
  25. 5 0
      hx-mes/src/main/java/com/fjhx/mes/entity/production/vo/ProductionReportingDetailVo.java
  26. 1 39
      hx-mes/src/main/java/com/fjhx/mes/service/border/impl/BorderOfLineServiceImpl.java
  27. 2 2
      hx-mes/src/main/java/com/fjhx/mes/service/completion/impl/CompletionInfoServiceImpl.java
  28. 68 75
      hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionReportingDetailServiceImpl.java
  29. 123 35
      hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionReportingServiceImpl.java
  30. 2 2
      hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionTaskDetailServiceImpl.java
  31. 2 2
      hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionTaskServiceImpl.java
  32. 2 1
      hx-mes/src/main/resources/mapper/production/ProductionReportingDetailMapper.xml
  33. 8 3
      hx-purchase/src/main/java/com/fjhx/purchase/entity/invoice/po/InvoiceDetails.java
  34. 8 3
      hx-purchase/src/main/java/com/fjhx/purchase/entity/pay/po/PayDetail.java
  35. 127 127
      hx-purchase/src/main/java/com/fjhx/purchase/flow/SalesReturnFlow.java
  36. 2 21
      hx-purchase/src/main/java/com/fjhx/purchase/service/arrival/impl/ArrivalServiceImpl.java
  37. 24 20
      hx-purchase/src/main/java/com/fjhx/purchase/service/invoice/impl/InvoiceServiceImpl.java
  38. 4 8
      hx-purchase/src/main/java/com/fjhx/purchase/service/pay/impl/PayServiceImpl.java
  39. 2 8
      hx-sale/src/main/java/com/fjhx/sale/flow/EhsdPurchaseFlow.java
  40. 8 3
      hx-sale/src/main/java/com/fjhx/sale/flow/PayFlow.java
  41. 2 6
      hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java
  42. 4 0
      hx-sale/src/main/java/com/fjhx/sale/service/purchase/impl/EhsdPurchaseServiceImpl.java
  43. 1 3
      hx-sale/src/main/resources/mapper/contract/ContractMapper.xml
  44. 0 8
      hx-wms/src/main/java/com/fjhx/wms/controller/stock/StockJournalDetailsController.java
  45. 50 1
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/dto/StockDto.java
  46. 10 0
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/dto/StockJournalSelectDto.java
  47. 43 28
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/emums/JournalType.java
  48. 64 61
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/emums/StockWaitType.java
  49. 0 10
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/po/Stock.java
  50. 42 5
      hx-wms/src/main/java/com/fjhx/wms/entity/stock/po/StockJournal.java
  51. 0 5
      hx-wms/src/main/java/com/fjhx/wms/service/stock/StockJournalDetailsService.java
  52. 1 26
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockJournalDetailsServiceImpl.java
  53. 28 6
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockJournalServiceImpl.java
  54. 62 3
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockServiceImpl.java
  55. 1 1
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitDetailsServiceImpl.java
  56. 1 10
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java

+ 4 - 21
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountManagement.java

@@ -81,26 +81,9 @@ public class AccountManagement extends BasePo {
     private String beneficiaryAddress;
 
 
-
-
-
-//    /**
-//     * 云帆ID
-//     */
-//    private String yfId;
-//
-//    /**
-//     * 云帆——归属公司id(common模块corporation表id)
-//     */
-//    private String yfCorporationId;
-//
-//    private String yfCreateUser;
-//
-//    private String yfUpdateUser;
-//
-//    private String tenantId;
-
-
-
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
 
 }

+ 9 - 3
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountPayment.java

@@ -1,12 +1,13 @@
 package com.fjhx.account.entity.account.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.math.BigDecimal;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+import java.util.Date;
+
 /**
  * <p>
  * 打款表
@@ -126,4 +127,9 @@ public class AccountPayment extends BasePo {
      * 数据所属人
      */
     private Long dataUser;
+
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountPaymentRecords.java

@@ -51,4 +51,9 @@ public class AccountPaymentRecords extends BasePo {
      */
     private String remark;
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRequestFunds.java

@@ -122,4 +122,9 @@ public class AccountRequestFunds extends BasePo {
      */
     private Long advanceId;
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/account/po/AccountRequestFundsDetail.java

@@ -61,4 +61,9 @@ public class AccountRequestFundsDetail extends BasePo {
      */
     private Integer dataType;
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 6 - 0
hx-account/src/main/java/com/fjhx/account/entity/transaction/po/Transaction.java

@@ -53,4 +53,10 @@ public class Transaction extends BasePo {
      */
     private String remark;
 
+
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 6 - 0
hx-account/src/main/java/com/fjhx/account/entity/transaction/po/TransactionDepartment.java

@@ -28,4 +28,10 @@ public class TransactionDepartment extends BasePo {
      */
     private String remark;
 
+
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/entity/write/dto/WriteOffRecordsDto.java

@@ -14,4 +14,9 @@ import lombok.Setter;
 @Setter
 public class WriteOffRecordsDto extends WriteOffRecords {
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 9 - 22
hx-account/src/main/java/com/fjhx/account/flow/AccountRequestFundsFlow.java

@@ -1,7 +1,6 @@
 package com.fjhx.account.flow;
 
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fjhx.account.entity.account.dto.AccountPaymentDto;
@@ -13,7 +12,6 @@ import com.fjhx.account.entity.account.po.AccountRequestFundsDetail;
 import com.fjhx.account.service.account.AccountPaymentService;
 import com.fjhx.account.service.account.AccountRequestFundsDetailService;
 import com.fjhx.account.service.account.AccountRequestFundsService;
-import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.enums.FlowStatusEnum1;
 import com.fjhx.common.utils.Assert;
 import com.fjhx.file.utils.ObsFileUtil;
@@ -64,25 +62,6 @@ public class AccountRequestFundsFlow extends FlowDelegate {
      */
     @Override
     public Long start(Long flowId, JSONObject submitData) {
-//
-//        // 获取提交数据
-//        AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
-//
-//        // 添加请款表的信息
-//        accountRequestFundsDto.setStatus(AccountRequestFundsStatusEnum.UNDER_REVIEW.getKey());
-//        accountRequestFundsService.save(accountRequestFundsDto);
-//
-//        // 添加请款详情表的信息
-//        List<AccountRequestFundsDetail> accountRequestFundsDetailList = accountRequestFundsDto.getAccountRequestFundsDetailList();
-//        if (CollectionUtils.isNotEmpty(accountRequestFundsDetailList)) {
-//            accountRequestFundsDetailList.forEach(item -> item.setAccountRequestFundsId(accountRequestFundsDto.getId()));
-//            accountRequestFundsDetailService.saveBatch(accountRequestFundsDetailList);
-//        }
-//
-//        // 添加附件信息
-//        ObsFileUtil.saveFile(accountRequestFundsDto.getFileList(), accountRequestFundsDto.getId());
-//
-//        return accountRequestFundsDto.getId();
 
         // 获取提交数据
         AccountRequestFundsDto accountRequestFundsDto = submitData.toJavaObject(AccountRequestFundsDto.class);
@@ -207,6 +186,11 @@ public class AccountRequestFundsFlow extends FlowDelegate {
      * @param opType 操作类型 0直接发起 1重新发起
      */
     private AccountRequestFundsDto commStart(AccountRequestFundsDto accountRequestFundsDto, Integer opType) {
+        //赋值归属公司
+        Long companyId = SecurityUtils.getCompanyId();
+        accountRequestFundsDto.setCompanyId(companyId);
+
+
         if (opType == 1) {
             Assert.notEmpty(accountRequestFundsDto.getId(), "请款id不能为空");
         }
@@ -223,7 +207,10 @@ public class AccountRequestFundsFlow extends FlowDelegate {
                 accountRequestFundsDetailService.editLinked(accountRequestFundsDetailList, AccountRequestFundsDetail::getContractId, accountRequestFundsDto.getId());
             }
 
-            accountRequestFundsDetailList.forEach(item -> item.setAccountRequestFundsId(accountRequestFundsDto.getId()));
+            accountRequestFundsDetailList.forEach(item -> {
+                item.setAccountRequestFundsId(accountRequestFundsDto.getId());
+                item.setCompanyId(companyId);
+            });
             accountRequestFundsDetailService.saveOrUpdateBatch(accountRequestFundsDetailList);
         }
 

+ 25 - 17
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountManagementServiceImpl.java

@@ -25,6 +25,7 @@ import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
 import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
 import com.fjhx.tenant.service.dict.DictTenantDataService;
 import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -75,6 +76,10 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
                         .like(AccountManagement::getOpeningBank, dto.getKeyword());
             });
         }
+
+        //权限过滤:资金账户
+        wrapper.eq(AccountManagement::getCompanyId, SecurityUtils.getCompanyId());
+
         Page<AccountManagementVo> page = baseMapper.getPage(dto.getPage(), wrapper);
         List<AccountManagementVo> records = page.getRecords();
         //赋值归属公司名称
@@ -110,10 +115,13 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
     @Override
     @Transactional(rollbackFor = {Exception.class})
     public void add(AccountManagementDto accountManagementDto) {
+        //赋值归属公司
+        accountManagementDto.setCompanyId(SecurityUtils.getCompanyId());
+
         //判断账户的别名是否已存在
         List<AccountManagement> accountManagements = this.list(Wrappers.<AccountManagement>lambdaQuery()
                 .eq(AccountManagement::getAlias, accountManagementDto.getAlias()));
-        if (accountManagements.size()>0){
+        if (accountManagements.size() > 0) {
             throw new ServiceException("数据错误:账户别名已存在请重新创建");
         }
         //添加账户管理表的信息
@@ -132,15 +140,15 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         //判断账户的别名是否已存在
         List<AccountManagement> accountManagements = this.list(Wrappers.<AccountManagement>lambdaQuery()
                 .eq(AccountManagement::getAlias, accountManagementDto.getAlias()));
-        if (accountManagements.size()>1){
+        if (accountManagements.size() > 1) {
             throw new ServiceException("数据错误:账户别名已存在请重新创建");
         }
         //删除账户-余额表的信息
         List<AccountRemainder> accountRemainderList = accountManagementDto.getAccountRemainderList();
         List<Long> ids = accountRemainderList.stream().map(accountRemainder -> accountRemainder.getId()).collect(Collectors.toList());
         accountRemainderService.remove(Wrappers.<AccountRemainder>lambdaQuery()
-                .eq(AccountRemainder::getAccountManagementId,accountManagementDto.getId())
-                .notIn(AccountRemainder::getId,ids)
+                .eq(AccountRemainder::getAccountManagementId, accountManagementDto.getId())
+                .notIn(AccountRemainder::getId, ids)
         );
         //添加账户余额表的信息
         saveAccountRemainder(accountManagementDto);
@@ -156,21 +164,21 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         List<AccountRunningWater> accountRunningWaterList = accountRunningWaterService.list(Wrappers.<AccountRunningWater>lambdaQuery()
                 .eq(AccountRunningWater::getAccountManagementId, id));
         //如果存在流水表的数据则不能删除账户表的信息
-        if (accountRunningWaterList.size()>0){
+        if (accountRunningWaterList.size() > 0) {
             throw new ServiceException("无法删除,该账户已存在流水数据");
         }
         //删除账户-管理表的信息
         this.removeById(id);
         //删除账户-余额表的信息
         accountRemainderService.remove(Wrappers.<AccountRemainder>lambdaQuery()
-                .eq(AccountRemainder::getAccountManagementId,id));
+                .eq(AccountRemainder::getAccountManagementId, id));
     }
 
     /**
      * 账户统计(账户列表)
      */
     @Override
-    public  List<Map<String, Object>> managementStatistics(AccountManagementSelectDto dto) {
+    public List<Map<String, Object>> managementStatistics(AccountManagementSelectDto dto) {
         //存放账户统计数据
         List<Map<String, Object>> list = new ArrayList<>();
 
@@ -185,24 +193,24 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
         List<DictTenantDataVo> dictTenantDataVos = getDict("customer_source");
         DynamicDataSourceContextHolder.poll();
 
-        if (dictTenantDataVos.size()==0){
+        if (dictTenantDataVos.size() == 0) {
             throw new ServiceException("数据有误:没有配置币种字典,请先配置");
         }
 
         //赋值
         for (DictTenantDataVo dictTenantDataVo : dictTenantDataVos) {
             //赋初始值信息
-            Map<String,Object> map = new HashMap<>();
-            map.put("currencyKey",dictTenantDataVo.getDictKey());
-            map.put("currencyValue",dictTenantDataVo.getDictValue());
-            map.put("remainder",new BigDecimal(0));
+            Map<String, Object> map = new HashMap<>();
+            map.put("currencyKey", dictTenantDataVo.getDictKey());
+            map.put("currencyValue", dictTenantDataVo.getDictValue());
+            map.put("remainder", new BigDecimal(0));
             //赋值余额信息
-            if (accountRemainderList.size()>0){
+            if (accountRemainderList.size() > 0) {
                 Map<String, List<AccountRemainder>> accountRemainderMap = accountRemainderList.stream()
                         .collect(Collectors.groupingBy(AccountRemainder::getCurrency));
                 List<AccountRemainder> accountRemainderList1 = accountRemainderMap.get(dictTenantDataVo.getDictKey());
-                if (ObjectUtil.isNotEmpty(accountRemainderList1)){
-                    map.put("remainder",accountRemainderList1.get(0).getRemainder());
+                if (ObjectUtil.isNotEmpty(accountRemainderList1)) {
+                    map.put("remainder", accountRemainderList1.get(0).getRemainder());
                 }
             }
             list.add(map);
@@ -212,7 +220,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
     }
 
     //根据字典编码获取字典的数据
-    private List<DictTenantDataVo> getDict(String code){
+    private List<DictTenantDataVo> getDict(String code) {
         DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
         dto.setDictCode(code);
         return dictTenantDataService.getList(dto);
@@ -319,7 +327,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
     /**
      * 添加账户-余额表的信息
      */
-    private void saveAccountRemainder(AccountManagementDto accountManagementDto){
+    private void saveAccountRemainder(AccountManagementDto accountManagementDto) {
         List<AccountRemainder> accountRemainderList = accountManagementDto.getAccountRemainderList();
         accountRemainderList.forEach(accountRemainder -> {
             accountRemainder.setAccountManagementId(accountManagementDto.getId());

+ 9 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountPaymentServiceImpl.java

@@ -100,6 +100,10 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
         //对方账户过滤
         wrapper.like(ObjectUtil.isNotEmpty(dto.getOppositeAccountName()), "ap.name", dto.getOppositeAccountName());
 
+        //权限过滤:打款-子公司看自己的
+        wrapper.eq("ap.company_id", SecurityUtils.getCompanyId());
+
+
         Page<AccountPaymentVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<AccountPaymentVo> records = page.getRecords();
         if (records.size() == 0) {
@@ -178,6 +182,10 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
     public void add(AccountPaymentDto accountPaymentDto) {
         Assert.notEmpty(accountPaymentDto.getId(), "打款id不能为空");
 
+        //赋值归属公司
+        Long companyId = SecurityUtils.getCompanyId();
+        accountPaymentDto.setCompanyId(companyId);
+
         AccountRemainder accountRemainder = accountRemainderService.getOne(Wrappers.<AccountRemainder>lambdaQuery()
                 .eq(AccountRemainder::getAccountManagementId, accountPaymentDto.getAccountManagementId())
                 .eq(AccountRemainder::getCurrency, accountPaymentDto.getCurrency()));
@@ -223,6 +231,7 @@ public class AccountPaymentServiceImpl extends ServiceImpl<AccountPaymentMapper,
         accountPaymentRecords.setCurrency(accountPaymentDto.getCurrency());
         accountPaymentRecords.setExpensesTime(accountPaymentDto.getExpensesTime());
         accountPaymentRecords.setRemark(accountPaymentDto.getRemark());
+        accountPaymentRecords.setCompanyId(companyId);
         accountPaymentRecordsService.save(accountPaymentRecords);
 
         // 赋值变更金额

+ 4 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java

@@ -105,6 +105,7 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
                     && !permissionList.contains("financeOfficer")
                     && !permissionList.contains("cashier")
                     && !permissionList.contains("Intern_cashier")
+                    && !permissionList.contains("admin")//管理员
             ) {
                 // 添加权限自己看自己
                 wrapper.eq("arf.create_user", SecurityUtils.getUserId());
@@ -112,6 +113,9 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
         }
         //-----------------------------------------------------------------------
 
+        //权限过滤:请款-子公司看自己的
+        wrapper.eq("arf.company_id", SecurityUtils.getCompanyId());
+
 
         // 归属公司
         wrapper.eq(ObjectUtil.isNotEmpty(dto.getCorporationId()), "arf.corporation_id", dto.getCorporationId());

+ 5 - 1
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRunningWaterServiceImpl.java

@@ -132,7 +132,7 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
         if (!Objects.equals(companyId, 100L)) {
             wrapper.eq("arw.company_id", companyId);
         } else {
-            wrapper.eq("arw.company_id", dto.getCompanyId());
+            wrapper.eq(ObjectUtil.isNotEmpty(dto.getCompanyId()), "arw.company_id", dto.getCompanyId());
         }
 
         return wrapper;
@@ -221,6 +221,10 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
             throw new ServiceException("币种不能为空");
         }
 
+        //赋值归属公司
+        dto.setCompanyId(SecurityUtils.getCompanyId());
+
+
 //        dto.setRate(ExchangeRateUtil.getCnyToCodeRate(dto.getCurrency()));
 
         //计算汇率如果有填转人民币金额则反推

+ 7 - 0
hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionDepartmentServiceImpl.java

@@ -8,6 +8,7 @@ import com.fjhx.account.entity.transaction.po.TransactionDepartment;
 import com.fjhx.account.entity.transaction.vo.TransactionDepartmentVo;
 import com.fjhx.account.mapper.transaction.TransactionDepartmentMapper;
 import com.fjhx.account.service.transaction.TransactionDepartmentService;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.springframework.stereotype.Service;
 
@@ -34,6 +35,10 @@ public class TransactionDepartmentServiceImpl extends ServiceImpl<TransactionDep
     public Page<TransactionDepartmentVo> getPage(TransactionDepartmentSelectDto dto) {
         IWrapper<TransactionDepartment> wrapper = getWrapper();
         wrapper.orderByDesc("td", TransactionDepartment::getId);
+
+        //权限过滤:往来管理
+        wrapper.eq("td", TransactionDepartment::getCompanyId, SecurityUtils.getCompanyId());
+
         Page<TransactionDepartmentVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         return page;
     }
@@ -41,6 +46,8 @@ public class TransactionDepartmentServiceImpl extends ServiceImpl<TransactionDep
 
     @Override
     public void add(TransactionDepartmentDto transactionDepartmentDto) {
+        //赋值归属公司
+        transactionDepartmentDto.setCompanyId(SecurityUtils.getCompanyId());
         this.save(transactionDepartmentDto);
     }
 

+ 9 - 0
hx-account/src/main/java/com/fjhx/account/service/transaction/impl/TransactionServiceImpl.java

@@ -12,6 +12,7 @@ import com.fjhx.account.mapper.transaction.TransactionMapper;
 import com.fjhx.account.service.account.AccountManagementService;
 import com.fjhx.account.service.transaction.TransactionDepartmentService;
 import com.fjhx.account.service.transaction.TransactionService;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -54,6 +55,12 @@ public class TransactionServiceImpl extends ServiceImpl<TransactionMapper, Trans
         }
         //排序
         wrapper.orderByDesc("t", Transaction::getId);
+
+
+        //权限过滤:往来管理
+        wrapper.eq("t", Transaction::getCompanyId, SecurityUtils.getCompanyId());
+
+
         Page<TransactionVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         //赋值往来单位名称
         List<TransactionVo> records = page.getRecords();
@@ -69,6 +76,8 @@ public class TransactionServiceImpl extends ServiceImpl<TransactionMapper, Trans
 
     @Override
     public void add(TransactionDto transactionDto) {
+        //赋值归属公司
+        transactionDto.setCompanyId(SecurityUtils.getCompanyId());
         this.save(transactionDto);
     }
 

+ 9 - 0
hx-account/src/main/java/com/fjhx/account/service/write/impl/WriteOffRecordsServiceImpl.java

@@ -17,6 +17,7 @@ import com.fjhx.common.service.corporation.CorporationService;
 import com.fjhx.common.utils.Assert;
 import com.fjhx.file.utils.ObsFileUtil;
 import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -54,6 +55,10 @@ public class WriteOffRecordsServiceImpl extends ServiceImpl<WriteOffRecordsMappe
         IWrapper<WriteOffRecords> wrapper = getWrapper();
         wrapper.eq("ap.corporation_id", dto.getCorporationId());
         wrapper.eq("ap.type", dto.getType());
+
+        //权限过滤:冲销记录
+        wrapper.eq("wor.company_id", SecurityUtils.getCompanyId());
+
         wrapper.orderByDesc("wor", WriteOffRecords::getId);
         Page<WriteOffRecordsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<WriteOffRecordsVo> records = page.getRecords();
@@ -76,6 +81,10 @@ public class WriteOffRecordsServiceImpl extends ServiceImpl<WriteOffRecordsMappe
         accountPayment.setStatus("20");
         //清空已打款金额
         accountPayment.setAmount(BigDecimal.ZERO);
+
+        //赋值归属公司
+        writeOffRecordsDto.setCompanyId(SecurityUtils.getCompanyId());
+
         accountPaymentService.updateById(accountPayment);
 
         //赋值最后一次打款时间

+ 5 - 0
hx-iot/src/main/java/com/fjhx/iot/entity/tda/dto/TdaDeviceSelectDto.java

@@ -14,4 +14,9 @@ import lombok.Setter;
 @Setter
 public class TdaDeviceSelectDto extends BaseSelectDto {
 
+    /**
+     * 归属公司Id
+     */
+    private Long companyId;
+
 }

+ 43 - 14
hx-iot/src/main/java/com/fjhx/iot/entity/tda/po/TdaDevice.java

@@ -1,8 +1,7 @@
 package com.fjhx.iot.entity.tda.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -20,33 +19,63 @@ import lombok.Setter;
 public class TdaDevice extends BasePo {
 
     /**
-     * 产品表id
+     * 设备名称
      */
-    private Long tdaProductId;
-
+    private String deviceName;
     /**
-     * 华为tda产品id
+     * 设备编号
      */
-    private String productId;
-
+    private String deviceCode;
     /**
-     * 设备节点(设备标识)
+     * 设备规格
      */
-    private String nodeId;
-
+    private String deviceSpec;
     /**
-     * 设备名称
+     * 设备出产时间
      */
-    private String deviceName;
+    private String deviceDeliveryTime;
+    /**
+     * 制造商名称
+     */
+    private String makerName;
+    /**
+     * 制造商电话
+     */
+    private String makerPhone;
+    /**
+     * 备注
+     */
+    private String remark;
+
+    //+=========================================s
 
     /**
      * 设备id
      */
     private String deviceId;
-
     /**
      * 设备密匙
      */
     private String secret;
 
+    /**
+     * 产品表id
+     */
+    private Long tdaProductId;
+
+    /**
+     * 华为tda产品id
+     */
+    private String productId;
+
+    /**
+     * 设备节点(设备标识)
+     */
+    private String nodeId;
+
+    /**
+     * 归属公司Id
+     */
+    private Long companyId;
+
 }

+ 69 - 73
hx-iot/src/main/java/com/fjhx/iot/service/tda/impl/TdaDeviceServiceImpl.java

@@ -1,32 +1,24 @@
 package com.fjhx.iot.service.tda.impl;
 
 import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.iot.constants.RedisConstant;
-import com.fjhx.iot.entity.tda.dto.EbcDto;
 import com.fjhx.iot.entity.tda.dto.TdaDeviceDto;
 import com.fjhx.iot.entity.tda.dto.TdaDeviceSelectDto;
-import com.fjhx.iot.entity.tda.po.TdaApplication;
 import com.fjhx.iot.entity.tda.po.TdaDevice;
-import com.fjhx.iot.entity.tda.po.TdaProduct;
 import com.fjhx.iot.entity.tda.vo.TdaDeviceVo;
 import com.fjhx.iot.mapper.tda.TdaDeviceMapper;
-import com.fjhx.iot.service.tda.TdaApplicationService;
 import com.fjhx.iot.service.tda.TdaDeviceService;
-import com.fjhx.iot.service.tda.TdaProductService;
-import com.fjhx.iot.utils.IoTDAUtil;
 import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.common.utils.wrapper.SqlField;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
@@ -44,14 +36,6 @@ import java.util.stream.Collectors;
 @Service
 public class TdaDeviceServiceImpl extends ServiceImpl<TdaDeviceMapper, TdaDevice> implements TdaDeviceService {
 
-    @Lazy
-    @Autowired
-    private TdaProductService tdaProductService;
-
-    @Lazy
-    @Autowired
-    private TdaApplicationService tdaApplicationService;
-
     @Autowired
     private RedisCache redisCache;
 
@@ -60,6 +44,15 @@ public class TdaDeviceServiceImpl extends ServiceImpl<TdaDeviceMapper, TdaDevice
         IWrapper<TdaDevice> wrapper = getWrapper();
         wrapper.orderByDesc("td", TdaDevice::getId);
         wrapper.keyword(dto, new SqlField("td.device_name"));
+
+        //权限过滤:设备管理-子公司看自己的,总公司看全部
+        Long companyId = SecurityUtils.getCompanyId();
+        if (!Objects.equals(companyId, 100L)) {
+            wrapper.eq("td.company_id", companyId);
+        } else {
+            wrapper.eq("td.company_id", dto.getCompanyId());
+        }
+
         Page<TdaDeviceVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
 
         List<TdaDeviceVo> records = page.getRecords();
@@ -68,41 +61,41 @@ public class TdaDeviceServiceImpl extends ServiceImpl<TdaDeviceMapper, TdaDevice
             return page;
         }
 
-        for (TdaDeviceVo record : records) {
-
-            HashMap<String, Object> other = new HashMap<>();
-            record.setOther(other);
-
-            // 设备id
-            String deviceId = record.getDeviceId();
-
-            // 产品设备类型
-            String deviceType = record.getDeviceType();
-
-            if (StrUtil.isBlank(deviceId)) {
-                continue;
-            }
-
-            Object obj = redisCache.getCacheObject(RedisConstant.DEVICE_PREFIX + deviceId);
-            if (obj == null) {
-                continue;
-            }
-
-            switch (deviceType) {
-                case "ebc":
-                    EbcDto ebcDto = (EbcDto) obj;
-                    EbcDto.Status status = ebcDto.getStatus();
-                    String sysSta = status.getSys_sta();
-                    record.setStatus(sysSta);
-                    record.setEventTime(ebcDto.getEventTime());
-
-                    other.put("ebc", "1");
-                    other.put("jiaka", status.getJiaka());
-                    other.put("hengyi", status.getHengyi());
-                    break;
-            }
-
-        }
+//        for (TdaDeviceVo record : records) {
+//
+//            HashMap<String, Object> other = new HashMap<>();
+//            record.setOther(other);
+//
+//            // 设备id
+//            String deviceId = record.getDeviceId();
+//
+//            // 产品设备类型
+//            String deviceType = record.getDeviceType();
+//
+//            if (StrUtil.isBlank(deviceId)) {
+//                continue;
+//            }
+//
+//            Object obj = redisCache.getCacheObject(RedisConstant.DEVICE_PREFIX + deviceId);
+//            if (obj == null) {
+//                continue;
+//            }
+//
+//            switch (deviceType) {
+//                case "ebc":
+//                    EbcDto ebcDto = (EbcDto) obj;
+//                    EbcDto.Status status = ebcDto.getStatus();
+//                    String sysSta = status.getSys_sta();
+//                    record.setStatus(sysSta);
+//                    record.setEventTime(ebcDto.getEventTime());
+//
+//                    other.put("ebc", "1");
+//                    other.put("jiaka", status.getJiaka());
+//                    other.put("hengyi", status.getHengyi());
+//                    break;
+//            }
+//
+//        }
 
 
         return page;
@@ -118,25 +111,28 @@ public class TdaDeviceServiceImpl extends ServiceImpl<TdaDeviceMapper, TdaDevice
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void add(TdaDeviceDto tdaDeviceDto) {
-        String nodeId = tdaDeviceDto.getNodeId();
-        String deviceName = tdaDeviceDto.getDeviceName();
-        Long tdaProductId = tdaDeviceDto.getTdaProductId();
-
-        // 查询资源所在空间和产品id
-        TdaProduct tdaProduct = tdaProductService.getById(tdaProductId);
-        String productId = tdaProduct.getProductId();
-
-        TdaApplication tdaApplication = tdaApplicationService.getById(tdaProduct.getTdaApplicationId());
-
-        // 华为ioDta添加设备
-        IoTDAUtil.DeviceKey deviceKey = IoTDAUtil.addDevice(tdaApplication.getTdaConfigId(),
-                nodeId, deviceName, tdaProduct.getAppId(), productId, tdaDeviceDto.getSecret());
-
-        tdaDeviceDto.setProductId(productId);
-        tdaDeviceDto.setDeviceId(tdaDeviceDto.getNodeId());
+//        String nodeId = tdaDeviceDto.getNodeId();
+//        String deviceName = tdaDeviceDto.getDeviceName();
+//        Long tdaProductId = tdaDeviceDto.getTdaProductId();
+//
+//        // 查询资源所在空间和产品id
+//        TdaProduct tdaProduct = tdaProductService.getById(tdaProductId);
+//        String productId = tdaProduct.getProductId();
+//
+//        TdaApplication tdaApplication = tdaApplicationService.getById(tdaProduct.getTdaApplicationId());
+//
+//        // 华为ioDta添加设备
+//        IoTDAUtil.DeviceKey deviceKey = IoTDAUtil.addDevice(tdaApplication.getTdaConfigId(),
+//                nodeId, deviceName, tdaProduct.getAppId(), productId, tdaDeviceDto.getSecret());
+//
+//        tdaDeviceDto.setProductId(productId);
+//        tdaDeviceDto.setDeviceId(tdaDeviceDto.getNodeId());
 
         // tdaDeviceDto.setSecret(deviceKey.getSecret());
 
+        //赋值归属公司Id
+        tdaDeviceDto.setCompanyId(SecurityUtils.getCompanyId());
+
         this.save(tdaDeviceDto);
     }
 
@@ -144,11 +140,11 @@ public class TdaDeviceServiceImpl extends ServiceImpl<TdaDeviceMapper, TdaDevice
     @Override
     public void delete(Long id) {
 
-        TdaDevice tdaDevice = getById(id);
-        TdaProduct tdaProduct = tdaProductService.getById(tdaDevice.getTdaProductId());
-        TdaApplication tdaApplication = tdaApplicationService.getById(tdaProduct.getTdaApplicationId());
-
-        IoTDAUtil.deleteDevice(tdaApplication.getTdaConfigId(), tdaDevice.getDeviceId());
+//        TdaDevice tdaDevice = getById(id);
+//        TdaProduct tdaProduct = tdaProductService.getById(tdaDevice.getTdaProductId());
+//        TdaApplication tdaApplication = tdaApplicationService.getById(tdaProduct.getTdaApplicationId());
+//
+//        IoTDAUtil.deleteDevice(tdaApplication.getTdaConfigId(), tdaDevice.getDeviceId());
 
         this.removeById(id);
     }

+ 27 - 13
hx-iot/src/main/resources/mapper/tda/TdaDeviceMapper.xml

@@ -2,23 +2,37 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.iot.mapper.tda.TdaDeviceMapper">
     <select id="getPage" resultType="com.fjhx.iot.entity.tda.vo.TdaDeviceVo">
-        select td.id,
-               td.tda_product_id,
-               td.product_id,
-               td.node_id,
-               td.device_name,
+        --         select td.id,
+--                td.tda_product_id,
+--                td.product_id,
+--                td.node_id,
+--                td.device_name,
+--                td.device_id,
+--                td.secret,
+--                td.create_user,
+--                td.create_time,
+--                td.update_user,
+--                td.update_time,
+--                tp.name        productName,
+--                tp.device_type deviceType,
+--                ta.app_name
+--         from tda_device td
+--                  left join tda_product tp on td.tda_product_id = tp.id
+--                  left join tda_application ta on tp.tda_application_id = ta.id
+        SELECT td.id,
                td.device_id,
-               td.secret,
+               td.device_name,
+               td.device_code,
+               td.device_spec,
+               td.device_delivery_time,
+               td.maker_name,
+               td.maker_phone,
+               td.remark,
                td.create_user,
                td.create_time,
                td.update_user,
-               td.update_time,
-               tp.name        productName,
-               tp.device_type deviceType,
-               ta.app_name
-        from tda_device td
-                 left join tda_product tp on td.tda_product_id = tp.id
-                 left join tda_application ta on tp.tda_application_id = ta.id
+               td.update_time
+        FROM tda_device td
             ${ew.customSqlSegment}
     </select>
 

+ 1 - 1
hx-jushuitan/src/main/java/com/fjhx/jushuitan/initializers/JstInitializer.java

@@ -13,7 +13,7 @@ public class JstInitializer {
 
     @PostConstruct
     public void dataInitializer() {
-//        jstApiService.startOrder();
+        jstApiService.startOrder();
     }
 
 

+ 0 - 8
hx-mes/src/main/java/com/fjhx/mes/entity/production/dto/ProductionReportingDto.java

@@ -1,12 +1,9 @@
 package com.fjhx.mes.entity.production.dto;
 
 import com.fjhx.mes.entity.production.po.ProductionReporting;
-import com.fjhx.mes.entity.production.po.ProductionReportingDetail;
 import lombok.Getter;
 import lombok.Setter;
 
-import java.util.List;
-
 /**
  * 生产报工新增编辑入参实体
  *
@@ -17,9 +14,4 @@ import java.util.List;
 @Setter
 public class ProductionReportingDto extends ProductionReporting {
 
-    /**
-     * 报工明细列表
-     */
-    List<ProductionReportingDetail> productionReportingDetailList;
-
 }

+ 21 - 3
hx-mes/src/main/java/com/fjhx/mes/entity/production/po/ProductionReporting.java

@@ -1,17 +1,18 @@
 package com.fjhx.mes.entity.production.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * <p>
  * 生产报工
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-03-30
  */
 @Getter
@@ -23,5 +24,22 @@ public class ProductionReporting extends BasePo {
      * 生产任务id
      */
     private Long productionTaskId;
+    /**
+     * 工序id
+     */
+    private Long productionProcessesId;
+    /**
+     * 报工数量
+     */
+    private BigDecimal quantity;
+    /**
+     * 报工用户列表
+     */
+    private String userSet;
+
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
 
 }

+ 5 - 5
hx-mes/src/main/java/com/fjhx/mes/entity/production/po/ProductionReportingDetail.java

@@ -35,11 +35,6 @@ public class ProductionReportingDetail extends BasePo {
      */
     private Long productionProcessesId;
 
-//    /**
-//     * 报工姓名
-//     */
-//    private String name;
-
     /**
      * 报工数量
      */
@@ -50,4 +45,9 @@ public class ProductionReportingDetail extends BasePo {
      */
     private Long companyId;
 
+    /**
+     * 报工人Id
+     */
+    private Long userId;
+
 }

+ 5 - 0
hx-mes/src/main/java/com/fjhx/mes/entity/production/vo/ProductionReportingDetailVo.java

@@ -31,4 +31,9 @@ public class ProductionReportingDetailVo extends ProductionReportingDetail {
 
     private String companyName;
 
+    /**
+     * 报工人名称
+     */
+    private String userName;
+
 }

+ 1 - 39
hx-mes/src/main/java/com/fjhx/mes/service/border/impl/BorderOfLineServiceImpl.java

@@ -16,7 +16,6 @@ import com.fjhx.mes.entity.border.vo.BorderOfLineVo;
 import com.fjhx.mes.mapper.border.BorderOfLineMapper;
 import com.fjhx.mes.service.border.BorderOfLineJournalService;
 import com.fjhx.mes.service.border.BorderOfLineService;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
 import com.fjhx.wms.entity.stock.po.StockWait;
 import com.fjhx.wms.entity.stock.po.StockWaitDetails;
 import com.fjhx.wms.service.stock.StockWaitDetailsService;
@@ -28,8 +27,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 
 
 /**
@@ -76,41 +73,6 @@ public class BorderOfLineServiceImpl extends ServiceImpl<BorderOfLineMapper, Bor
             item.setProductTypeName(classify.getName());
         });
 
-//        //赋值产品信息
-//        List<Long> productIds = records.stream().map(BorderOfLine::getProductId).collect(Collectors.toList());
-//        if (ObjectUtil.isEmpty(productIds)) {
-//            return page;
-//        }
-//
-//        List<ProductInfo> productInfos = productInfoService.listByIds(productIds);
-//        List<Long> productClassifyIds = productInfos.stream().map(ProductInfo::getProductClassifyId).collect(Collectors.toList());
-//        if (ObjectUtil.isEmpty(productClassifyIds)) {
-//            return page;
-//        }
-//
-//        List<ProductClassify> productClassifies = productClassifyService.listByIds(productClassifyIds);
-//        if (ObjectUtil.isNotEmpty(productClassifies)) {
-//            Map<Long, ProductInfo> productInfoMap = productInfos.stream().collect(Collectors.groupingBy(ProductInfo::getId,
-//                    Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
-//            Map<Long, ProductClassify> productClassifyMap = productClassifies.stream().collect(Collectors.groupingBy(ProductClassify::getId,
-//                    Collectors.collectingAndThen(Collectors.toList(), value -> value.get(0))));
-//            for (BorderOfLineVo borderOfLineVo : records) {
-//                ProductInfo productInfo = productInfoMap.get(borderOfLineVo.getProductId());
-//                if (ObjectUtil.isNotEmpty(productInfo)) {
-//
-//                    borderOfLineVo.setProductName(productInfo.getName());
-//
-//                    ProductClassify productClassify = productClassifyMap.get(productInfo.getProductClassifyId());
-//                    if (ObjectUtil.isNotEmpty(productClassify)) {
-//
-//                        borderOfLineVo.setProductTypeName(productClassify.getName());
-//
-//                    }
-//                }
-//            }
-//        }
-
-
         return page;
     }
 
@@ -164,7 +126,7 @@ public class BorderOfLineServiceImpl extends ServiceImpl<BorderOfLineMapper, Bor
         if (borderOfLineDto.getType() == 2) {
             StockWait stockWait = new StockWait();
             stockWait.setType(1);
-            stockWait.setBusinessType(StockWaitType.BORDER_OF_LINE_IN.getDetailType());
+//            stockWait.setBusinessType(StockWaitType.BORDER_OF_LINE_IN.getDetailType());
             stockWait.setBusinessId(borderOfLineJournal.getId());
             stockWait.setStatus(0);
             stockWaitService.save(stockWait);

+ 2 - 2
hx-mes/src/main/java/com/fjhx/mes/service/completion/impl/CompletionInfoServiceImpl.java

@@ -19,7 +19,7 @@ import com.fjhx.mes.service.completion.CompletionInfoService;
 import com.fjhx.mes.service.production.ProductionPlanService;
 import com.fjhx.mes.service.production.ProductionTaskService;
 import com.fjhx.mes.service.work.WorkOrderService;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
+import com.fjhx.wms.entity.stock.emums.JournalType;
 import com.fjhx.wms.entity.stock.po.StockWait;
 import com.fjhx.wms.entity.stock.po.StockWaitDetails;
 import com.fjhx.wms.service.stock.StockWaitDetailsService;
@@ -114,7 +114,7 @@ public class CompletionInfoServiceImpl extends ServiceImpl<CompletionInfoMapper,
         //添加一条完工入库类型的待入库数据
         StockWait stockWait = new StockWait();
         stockWait.setType(1);
-        stockWait.setBusinessType(StockWaitType.COMPLETION_IN.getDetailType());
+        stockWait.setBusinessType(JournalType.COMPLETION_IN.getDetailType());
         stockWait.setBusinessId(completionInfoDto.getId());
         stockWait.setStatus(0);
         stockWaitService.save(stockWait);

+ 68 - 75
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionReportingDetailServiceImpl.java

@@ -5,17 +5,11 @@ import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.fjhx.common.utils.Assert;
-import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.mes.entity.production.dto.ProductionReportingDetailDto;
 import com.fjhx.mes.entity.production.dto.ProductionReportingDetailSelectDto;
-import com.fjhx.mes.entity.production.po.ProductionOrder;
-import com.fjhx.mes.entity.production.po.ProductionOrderDetail;
 import com.fjhx.mes.entity.production.po.ProductionReportingDetail;
-import com.fjhx.mes.entity.production.po.ProductionTaskProgress;
 import com.fjhx.mes.entity.production.vo.ProductionReportingDetailVo;
-import com.fjhx.mes.entity.technology.po.TechnologyProcessLine;
 import com.fjhx.mes.mapper.production.ProductionReportingDetailMapper;
 import com.fjhx.mes.service.production.ProduceOrderDetailService;
 import com.fjhx.mes.service.production.ProduceOrderService;
@@ -23,15 +17,12 @@ import com.fjhx.mes.service.production.ProductionReportingDetailService;
 import com.fjhx.mes.service.production.ProductionTaskProgressService;
 import com.fjhx.mes.service.technology.TechnologyProcessLineService;
 import com.fjhx.tenant.utils.DeptUstil;
-import com.ruoyi.common.core.domain.BasePo;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.math.BigDecimal;
-import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -83,6 +74,8 @@ public class ProductionReportingDetailServiceImpl extends ServiceImpl<Production
         }
         //赋值创建人名称
         UserUtil.assignmentNickName(records, ProductionReportingDetail::getCreateUser, ProductionReportingDetailVo::setCreateUserName);
+        //赋值报工人名称
+        UserUtil.assignmentNickName(records, ProductionReportingDetail::getUserId, ProductionReportingDetailVo::setUserName);
 
         //获取生产公司信息
         List<Long> companyIds = records.stream().map(ProductionReportingDetail::getCompanyId).collect(Collectors.toList());
@@ -106,72 +99,72 @@ public class ProductionReportingDetailServiceImpl extends ServiceImpl<Production
     @Override
     @DSTransactional
     public synchronized void add(ProductionReportingDetailDto dto) {
-        Long productionTaskId = dto.getProductionTaskId();
-        Long productionProcessesId = dto.getProductionProcessesId();
-        BigDecimal reportingQuantity = dto.getQuantity();
-
-        Assert.notEmpty(productionTaskId, "生产任务id不能为空!");
-        Assert.notEmpty(productionProcessesId, "生产工序id不能为空!");
-        Assert.notEmpty(reportingQuantity, "报工数量不能为空!");
-
-
-        ProductionTaskProgress productionTaskProgress = productionTaskProgressService.getOne(q -> q
-                .eq(ProductionTaskProgress::getTaskId, productionTaskId)
-                .eq(ProductionTaskProgress::getProcessesId, productionProcessesId)
-        );
-
-        Assert.notEmpty(productionTaskProgress, "查询不到生产进度信息");
-
-        //更新生产进度信息
-        productionTaskProgressService.update(q -> q
-                .eq(ProductionTaskProgress::getId, productionTaskProgress.getId())
-                .setSql("finish_quantity = finish_quantity + " + dto.getQuantity())
-                .set(BasePo::getUpdateTime, new Date())
-                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-        );
-
-        //更新完工数量
-        ProductionOrderDetail productionOrderDetail = produceOrderDetailService.getById(productionTaskId);
-        Assert.notEmpty(productionOrderDetail, "查询不到生产任务信息!");
-        ProductInfo productInfo = productInfoService.getById(productionOrderDetail.getProductId());
-        Assert.notEmpty(productInfo, "查询不到生产产品信息!");
-        Long technologyId = productInfo.getTechnologyId();
-        //判断报工工序是不是最后一道工序,是增加完工数量
-        long count = technologyProcessLineService.count(q -> q
-                .eq(TechnologyProcessLine::getTechnologyId, technologyId)
-                .eq(TechnologyProcessLine::getSourceProcessesId, productionProcessesId)
-                .eq(TechnologyProcessLine::getTargetProcessesId, 99)
-        );
-        if (count > 0) {
-            //是最后一道工序添加完工数量
-            BigDecimal quantity = productionOrderDetail.getQuantity();
-            BigDecimal finishQuantity = productionOrderDetail.getFinishQuantity();
-            //计算完工数量
-            BigDecimal add = finishQuantity.add(reportingQuantity);
-            productionOrderDetail.setFinishQuantity(add);
-            //全部完成赋值完工时间
-            if (add.compareTo(quantity) >= 0) {
-                productionOrderDetail.setFinishTime(new Date());
-                productionOrderDetail.setProduceStatus(2);
-            }
-            produceOrderDetailService.updateById(productionOrderDetail);
-        }
-        //检查订单下的任务是否完成,更改状态
-        Long produceOrderId = productionOrderDetail.getProduceOrderId();
-        long count1 = produceOrderDetailService.count(q -> q
-                .eq(ProductionOrderDetail::getProduceOrderId, produceOrderId)
-                .ne(ProductionOrderDetail::getProduceStatus, 2)
-        );
-        if (count1 == 0) {
-            produceOrderService.update(q -> q
-                    .eq(BasePo::getId, produceOrderId)
-                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
-                    .set(BasePo::getUpdateTime, new Date())
-                    .set(ProductionOrder::getProduceStatus, 2)
-            );
-        }
-
-        this.save(dto);
+//        Long productionTaskId = dto.getProductionTaskId();
+//        Long productionProcessesId = dto.getProductionProcessesId();
+//        BigDecimal reportingQuantity = dto.getQuantity();
+//
+//        Assert.notEmpty(productionTaskId, "生产任务id不能为空!");
+//        Assert.notEmpty(productionProcessesId, "生产工序id不能为空!");
+//        Assert.notEmpty(reportingQuantity, "报工数量不能为空!");
+//
+//
+//        ProductionTaskProgress productionTaskProgress = productionTaskProgressService.getOne(q -> q
+//                .eq(ProductionTaskProgress::getTaskId, productionTaskId)
+//                .eq(ProductionTaskProgress::getProcessesId, productionProcessesId)
+//        );
+//
+//        Assert.notEmpty(productionTaskProgress, "查询不到生产进度信息");
+//
+//        //更新生产进度信息
+//        productionTaskProgressService.update(q -> q
+//                .eq(ProductionTaskProgress::getId, productionTaskProgress.getId())
+//                .setSql("finish_quantity = finish_quantity + " + dto.getQuantity())
+//                .set(BasePo::getUpdateTime, new Date())
+//                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+//        );
+//
+//        //更新完工数量
+//        ProductionOrderDetail productionOrderDetail = produceOrderDetailService.getById(productionTaskId);
+//        Assert.notEmpty(productionOrderDetail, "查询不到生产任务信息!");
+//        ProductInfo productInfo = productInfoService.getById(productionOrderDetail.getProductId());
+//        Assert.notEmpty(productInfo, "查询不到生产产品信息!");
+//        Long technologyId = productInfo.getTechnologyId();
+//        //判断报工工序是不是最后一道工序,是增加完工数量
+//        long count = technologyProcessLineService.count(q -> q
+//                .eq(TechnologyProcessLine::getTechnologyId, technologyId)
+//                .eq(TechnologyProcessLine::getSourceProcessesId, productionProcessesId)
+//                .eq(TechnologyProcessLine::getTargetProcessesId, 99)
+//        );
+//        if (count > 0) {
+//            //是最后一道工序添加完工数量
+//            BigDecimal quantity = productionOrderDetail.getQuantity();
+//            BigDecimal finishQuantity = productionOrderDetail.getFinishQuantity();
+//            //计算完工数量
+//            BigDecimal add = finishQuantity.add(reportingQuantity);
+//            productionOrderDetail.setFinishQuantity(add);
+//            //全部完成赋值完工时间
+//            if (add.compareTo(quantity) >= 0) {
+//                productionOrderDetail.setFinishTime(new Date());
+//                productionOrderDetail.setProduceStatus(2);
+//            }
+//            produceOrderDetailService.updateById(productionOrderDetail);
+//        }
+//        //检查订单下的任务是否完成,更改状态
+//        Long produceOrderId = productionOrderDetail.getProduceOrderId();
+//        long count1 = produceOrderDetailService.count(q -> q
+//                .eq(ProductionOrderDetail::getProduceOrderId, produceOrderId)
+//                .ne(ProductionOrderDetail::getProduceStatus, 2)
+//        );
+//        if (count1 == 0) {
+//            produceOrderService.update(q -> q
+//                    .eq(BasePo::getId, produceOrderId)
+//                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+//                    .set(BasePo::getUpdateTime, new Date())
+//                    .set(ProductionOrder::getProduceStatus, 2)
+//            );
+//        }
+//
+//        this.save(dto);
     }
 
     @Override

+ 123 - 35
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionReportingServiceImpl.java

@@ -2,32 +2,32 @@ package com.fjhx.mes.service.production.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.utils.Assert;
 import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.mes.entity.production.dto.ProductionReportingDto;
 import com.fjhx.mes.entity.production.dto.ProductionReportingSelectDto;
-import com.fjhx.mes.entity.production.po.ProductionProcesses;
-import com.fjhx.mes.entity.production.po.ProductionReporting;
-import com.fjhx.mes.entity.production.po.ProductionReportingDetail;
-import com.fjhx.mes.entity.production.po.ProductionTask;
+import com.fjhx.mes.entity.production.po.*;
 import com.fjhx.mes.entity.production.vo.ProductionReportingDetailVo;
 import com.fjhx.mes.entity.production.vo.ProductionReportingVo;
+import com.fjhx.mes.entity.technology.po.TechnologyProcessLine;
 import com.fjhx.mes.mapper.production.ProductionReportingMapper;
-import com.fjhx.mes.service.production.ProductionProcessesService;
-import com.fjhx.mes.service.production.ProductionReportingDetailService;
-import com.fjhx.mes.service.production.ProductionReportingService;
-import com.fjhx.mes.service.production.ProductionTaskService;
+import com.fjhx.mes.service.production.*;
+import com.fjhx.mes.service.technology.TechnologyProcessLineService;
+import com.ruoyi.common.core.domain.BasePo;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
 import java.util.stream.Collectors;
 
 
@@ -36,7 +36,7 @@ import java.util.stream.Collectors;
  * 生产报工 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-03-30
  */
 @Service
@@ -49,15 +49,24 @@ public class ProductionReportingServiceImpl extends ServiceImpl<ProductionReport
     ProductionProcessesService productionProcessesService;
     @Autowired
     ProductionTaskService productionTaskService;
+    @Autowired
+    private ProductionTaskProgressService productionTaskProgressService;
+    @Autowired
+    private ProduceOrderDetailService produceOrderDetailService;
+    @Autowired
+    private TechnologyProcessLineService technologyProcessLineService;
+    @Autowired
+    private ProduceOrderService produceOrderService;
+
 
     @Override
     public Page<ProductionReportingVo> getPage(ProductionReportingSelectDto dto) {
         IWrapper<ProductionReporting> wrapper = getWrapper();
         wrapper.orderByDesc("pr", ProductionReporting::getId);
-        wrapper.like("pt.code",dto.getKeyword());
+        wrapper.like("pt.code", dto.getKeyword());
         Page<ProductionReportingVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<ProductionReportingVo> records = page.getRecords();
-        UserUtil.assignmentNickName(records,ProductionReporting::getCreateUser,ProductionReportingVo::setOperatorName);
+        UserUtil.assignmentNickName(records, ProductionReporting::getCreateUser, ProductionReportingVo::setOperatorName);
         return page;
     }
 
@@ -65,11 +74,11 @@ public class ProductionReportingServiceImpl extends ServiceImpl<ProductionReport
     public ProductionReportingVo detail(Long id) {
         ProductionReportingVo productionReporting = baseMapper.detail(id);
         ProductInfo productInfo = productInfoService.getById(productionReporting.getProductId());
-        if(ObjectUtil.isNotEmpty(productInfo)){
+        if (ObjectUtil.isNotEmpty(productInfo)) {
             productionReporting.setProductName(productInfo.getName());
         }
         Map<Long, String> nickNameMapByIds = UserUtil.getNickNameMapByIds(Arrays.asList(productionReporting.getPersonLiableId()));
-        if(ObjectUtil.isNotEmpty(nickNameMapByIds)) {
+        if (ObjectUtil.isNotEmpty(nickNameMapByIds)) {
             String name = nickNameMapByIds.get(productionReporting.getPersonLiableId());
             productionReporting.setPersonLiableName(name);
         }
@@ -95,38 +104,117 @@ public class ProductionReportingServiceImpl extends ServiceImpl<ProductionReport
         return productionReporting;
     }
 
-    @Transactional(rollbackFor = Exception.class)
+    @DSTransactional
     @Override
-    public void add(ProductionReportingDto productionReportingDto) {
-        this.save(productionReportingDto);
-        //保存报工明细
-        List<ProductionReportingDetail> productionReportingDetailList = productionReportingDto.getProductionReportingDetailList();
-        for (ProductionReportingDetail productionReportingDetail : productionReportingDetailList) {
-            productionReportingDetail.setProductionReportingId(productionReportingDto.getId());
+    public synchronized void add(ProductionReportingDto dto) {
+        Long productionTaskId = dto.getProductionTaskId();
+        Long productionProcessesId = dto.getProductionProcessesId();
+        BigDecimal reportingQuantity = dto.getQuantity();
+        String userSet = dto.getUserSet();
+
+        Assert.notEmpty(userSet, "报工人不能为空");
+        Assert.notEmpty(productionTaskId, "生产任务id不能为空!");
+        Assert.notEmpty(productionProcessesId, "生产工序id不能为空!");
+        Assert.notEmpty(reportingQuantity, "报工数量不能为空!");
+
+        //赋值归属公司
+        Long companyId = SecurityUtils.getCompanyId();
+        dto.setCompanyId(companyId);
+
+        //保存报工
+        this.save(dto);
+
+        //生成报工明细
+        long[] userIdList = Arrays.asList(userSet.split(",")).stream().mapToLong(Long::parseLong).toArray();
+        //报工数量所有人平分
+        BigDecimal divide = reportingQuantity.divide(BigDecimal.valueOf(userIdList.length), 4, RoundingMode.HALF_UP);
+        List<ProductionReportingDetail> productionReportingDetailList = new ArrayList<>();
+        for (long userId : userIdList) {
+            ProductionReportingDetail productionReportingDetail = new ProductionReportingDetail();
+            productionReportingDetail.setProductionReportingId(dto.getId());
+            productionReportingDetail.setProductionTaskId(productionTaskId);
+            productionReportingDetail.setProductionProcessesId(productionProcessesId);
+            productionReportingDetail.setQuantity(divide);
+            productionReportingDetail.setUserId(userId);
+            productionReportingDetail.setCompanyId(companyId);
+            productionReportingDetailList.add(productionReportingDetail);
         }
         productionReportingDetailService.saveBatch(productionReportingDetailList);
-        Long productionTaskId = productionReportingDto.getProductionTaskId();
-        //设置生产任务状态为进行中
-        ProductionTask byId = productionTaskService.getById(productionTaskId);
-        byId.setStatus(1);
-        productionTaskService.updateById(byId);
+
+        ProductionTaskProgress productionTaskProgress = productionTaskProgressService.getOne(q -> q
+                .eq(ProductionTaskProgress::getTaskId, productionTaskId)
+                .eq(ProductionTaskProgress::getProcessesId, productionProcessesId)
+        );
+
+        Assert.notEmpty(productionTaskProgress, "查询不到生产进度信息");
+
+        //更新生产进度信息
+        productionTaskProgressService.update(q -> q
+                .eq(ProductionTaskProgress::getId, productionTaskId)
+                .setSql("finish_quantity = finish_quantity + " + dto.getQuantity())
+                .set(BasePo::getUpdateTime, new Date())
+                .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+        );
+
+        //更新完工数量
+        ProductionOrderDetail productionOrderDetail = produceOrderDetailService.getById(productionTaskId);
+        Assert.notEmpty(productionOrderDetail, "查询不到生产任务信息!");
+        ProductInfo productInfo = productInfoService.getById(productionOrderDetail.getProductId());
+        Assert.notEmpty(productInfo, "查询不到生产产品信息!");
+        Long technologyId = productInfo.getTechnologyId();
+        //判断报工工序是不是最后一道工序,是增加完工数量
+        long count = technologyProcessLineService.count(q -> q
+                .eq(TechnologyProcessLine::getTechnologyId, technologyId)
+                .eq(TechnologyProcessLine::getSourceProcessesId, productionProcessesId)
+                .eq(TechnologyProcessLine::getTargetProcessesId, 99)
+        );
+        if (count > 0) {
+            //是最后一道工序添加完工数量
+            BigDecimal quantity = productionOrderDetail.getQuantity();
+            BigDecimal finishQuantity = productionOrderDetail.getFinishQuantity();
+            //计算完工数量
+            BigDecimal add = finishQuantity.add(reportingQuantity);
+            productionOrderDetail.setFinishQuantity(add);
+            //全部完成赋值完工时间
+            if (add.compareTo(quantity) >= 0) {
+                productionOrderDetail.setFinishTime(new Date());
+                productionOrderDetail.setProduceStatus(2);
+            }
+            produceOrderDetailService.updateById(productionOrderDetail);
+        }
+        //检查订单下的任务是否完成,更改状态
+        Long produceOrderId = productionOrderDetail.getProduceOrderId();
+        long count1 = produceOrderDetailService.count(q -> q
+                .eq(ProductionOrderDetail::getProduceOrderId, produceOrderId)
+                .ne(ProductionOrderDetail::getProduceStatus, 2)
+        );
+        if (count1 == 0) {
+            produceOrderService.update(q -> q
+                    .eq(BasePo::getId, produceOrderId)
+                    .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
+                    .set(BasePo::getUpdateTime, new Date())
+                    .set(ProductionOrder::getProduceStatus, 2)
+            );
+        }
+
     }
 
     @Transactional(rollbackFor = Exception.class)
     @Override
     public void edit(ProductionReportingDto productionReportingDto) {
-        this.updateById(productionReportingDto);
-        //保存报工明细
-        List<ProductionReportingDetail> productionReportingDetailList = productionReportingDto.getProductionReportingDetailList();
-        for (ProductionReportingDetail productionReportingDetail : productionReportingDetailList) {
-            productionReportingDetail.setProductionReportingId(productionReportingDto.getId());
-        }
-        productionReportingDetailService.updateBatchById(productionReportingDetailList);
+//        this.updateById(productionReportingDto);
+//        //保存报工明细
+//        List<ProductionReportingDetail> productionReportingDetailList = productionReportingDto.getProductionReportingDetailList();
+//        for (ProductionReportingDetail productionReportingDetail : productionReportingDetailList) {
+//            productionReportingDetail.setProductionReportingId(productionReportingDto.getId());
+//        }
+//        productionReportingDetailService.updateBatchById(productionReportingDetailList);
     }
 
     @Override
     public void delete(Long id) {
         this.removeById(id);
+        productionReportingDetailService.remove(q -> q.eq(ProductionReportingDetail::getProductionReportingId, id));
     }
 
 }

+ 2 - 2
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionTaskDetailServiceImpl.java

@@ -21,7 +21,7 @@ import com.fjhx.mes.service.production.*;
 import com.fjhx.mes.service.technology.TechnologyService;
 import com.fjhx.mes.service.work.WorkOrderProductionProcessesService;
 import com.fjhx.mes.service.work.WorkOrderService;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
+import com.fjhx.wms.entity.stock.emums.JournalType;
 import com.fjhx.wms.entity.stock.po.StockWait;
 import com.fjhx.wms.entity.stock.po.StockWaitDetails;
 import com.fjhx.wms.service.stock.StockWaitDetailsService;
@@ -184,7 +184,7 @@ public class ProductionTaskDetailServiceImpl extends ServiceImpl<ProductionTaskD
         StockWait stockWait = new StockWait();
         stockWait.setType(1);//入库
         stockWait.setStatus(0);//待入库
-        stockWait.setBusinessType(StockWaitType.COMPLETION_IN.getDetailType());//
+        stockWait.setBusinessType(JournalType.COMPLETION_IN.getDetailType());//
         stockWait.setBusinessId(productionTaskDetail.getId());//生产任务明细id
         stockWait.setBusinessCode(productionTaskDetail.getProductSn());//产品sn
         stockWaitService.save(stockWait);

+ 2 - 2
hx-mes/src/main/java/com/fjhx/mes/service/production/impl/ProductionTaskServiceImpl.java

@@ -31,7 +31,7 @@ import com.fjhx.mes.service.work.WorkOrderBomService;
 import com.fjhx.mes.service.work.WorkOrderProductionProcessesService;
 import com.fjhx.mes.service.work.WorkOrderService;
 import com.fjhx.mes.utils.code.CodeEnum;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
+import com.fjhx.wms.entity.stock.emums.JournalType;
 import com.fjhx.wms.entity.stock.po.StockWait;
 import com.fjhx.wms.entity.stock.po.StockWaitDetails;
 import com.fjhx.wms.service.stock.StockWaitDetailsService;
@@ -174,7 +174,7 @@ public class ProductionTaskServiceImpl extends ServiceImpl<ProductionTaskMapper,
         stockWait.setBusinessId(productionTaskDto.getId());
         stockWait.setType(2);//出库
         stockWait.setStatus(0);//待出库
-        stockWait.setBusinessType(StockWaitType.PRODUCTION_TASK_OUT.getDetailType());//生产任务出库
+        stockWait.setBusinessType(JournalType.PROD_OUT.getDetailType());//生产任务出库
         stockWaitService.save(stockWait);
         //创建待出库明细
         List<StockWaitDetails> stockWaitDetailsList = new ArrayList<>();

+ 2 - 1
hx-mes/src/main/resources/mapper/production/ProductionReportingDetailMapper.xml

@@ -12,7 +12,8 @@
                prd.update_time,
                po.`code` AS orderCode,
                pp.`name` AS processesName,
-               prd.company_id
+               prd.company_id,
+               prd.user_id
         FROM production_reporting_detail prd
                  LEFT JOIN production_order_detail pod ON prd.production_task_id = pod.id
                  LEFT JOIN production_order po ON pod.produce_order_id = po.id

+ 8 - 3
hx-purchase/src/main/java/com/fjhx/purchase/entity/invoice/po/InvoiceDetails.java

@@ -1,12 +1,12 @@
 package com.fjhx.purchase.entity.invoice.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.math.BigDecimal;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * <p>
  * 发票明细
@@ -40,4 +40,9 @@ public class InvoiceDetails extends BasePo {
      */
     private String remark;
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 8 - 3
hx-purchase/src/main/java/com/fjhx/purchase/entity/pay/po/PayDetail.java

@@ -1,12 +1,12 @@
 package com.fjhx.purchase.entity.pay.po;
 
-import com.ruoyi.common.core.domain.BasePo;
 import com.baomidou.mybatisplus.annotation.TableName;
-import java.math.BigDecimal;
-import java.util.Date;
+import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
+
 /**
  * <p>
  * 采购付款明细
@@ -40,4 +40,9 @@ public class PayDetail extends BasePo {
      */
     private Long payId;
 
+    /**
+     * 归属公司id
+     */
+    private Long companyId;
+
 }

+ 127 - 127
hx-purchase/src/main/java/com/fjhx/purchase/flow/SalesReturnFlow.java

@@ -1,127 +1,127 @@
-package com.fjhx.purchase.flow;
-
-import cn.hutool.extra.spring.SpringUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.dynamic.datasource.annotation.DS;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.fjhx.common.constant.SourceConstant;
-import com.fjhx.common.enums.CodingRuleEnum;
-import com.fjhx.common.service.coding.CodingRuleService;
-import com.fjhx.flow.core.FlowDelegate;
-import com.fjhx.flow.enums.FlowStatusEnum;
-import com.fjhx.purchase.entity.sales.enums.SalesReturnDetailStatusEnum;
-import com.fjhx.purchase.entity.sales.enums.SalesReturnStatusEnum;
-import com.fjhx.purchase.entity.sales.po.SalesReturn;
-import com.fjhx.purchase.entity.sales.po.SalesReturnDetail;
-import com.fjhx.purchase.service.sales.SalesReturnDetailService;
-import com.fjhx.purchase.service.sales.SalesReturnService;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
-import com.fjhx.wms.entity.stock.po.StockWait;
-import com.fjhx.wms.entity.stock.po.StockWaitDetails;
-import com.fjhx.wms.service.stock.StockWaitDetailsService;
-import com.fjhx.wms.service.stock.StockWaitService;
-import com.ruoyi.common.exception.ServiceException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * 退货流程
- *
- * @Author:caozj
- * @DATE:2023/4/3 17:38
- */
-//@DS(SourceConstant.PURCHASE)
-@Component
-public class SalesReturnFlow extends FlowDelegate {
-
-    @Autowired
-    StockWaitDetailsService stockWaitDetailsService;
-
-    @Autowired
-    private CodingRuleService codingRuleService;
-
-    @Override
-    public String getFlowKey() {
-        return "sales_return_flow";
-    }
-
-
-    /**
-     * 发起流程
-     *
-     * @param flowId     流程ID
-     * @param submitData 数据
-     * @return
-     */
-    @Override
-    public Long start(Long flowId, JSONObject submitData) {
-        SalesReturnService salesReturnService = SpringUtil.getBean(SalesReturnService.class);
-        SalesReturnDetailService salesReturnDetailService = SpringUtil.getBean(SalesReturnDetailService.class);
-        SalesReturn salesReturn = submitData.toJavaObject(SalesReturn.class);
-//        salesReturn.setCode(CodeEnum.SALES_RETURN.getCode());
-        salesReturn.setCode(codingRuleService.createCode(CodingRuleEnum.SALES_RETURN.getKey(),null));
-        salesReturnService.save(salesReturn);
-        List<SalesReturnDetail> salesReturnDetailList = salesReturn.getSalesReturnDetailList();
-        if (CollectionUtils.isNotEmpty(salesReturnDetailList)) {
-            for (SalesReturnDetail s : salesReturnDetailList) {
-                s.setSalesReturnId(salesReturn.getId());
-            }
-            salesReturnDetailService.saveBatch(salesReturnDetailList);
-        }
-        return salesReturn.getId();
-    }
-
-    /**
-     * 结束流程
-     *
-     * @param flowId     流程ID
-     * @param businessId 业务ID
-     * @param submitData 数据
-     */
-    @Override
-    public void end(Long flowId, Long businessId, JSONObject submitData) {
-        SalesReturnService salesReturnService = SpringUtil.getBean(SalesReturnService.class);
-        SalesReturnDetailService salesReturnDetailService = SpringUtil.getBean(SalesReturnDetailService.class);
-        StockWaitService stockWaitService = SpringUtil.getBean(StockWaitService.class);
-        //通过业务ID查询退货数据
-        SalesReturn salesReturn = salesReturnService.getById(businessId);
-        if (ObjectUtils.isEmpty(salesReturn)) {
-            throw new ServiceException("退货单单不存在");
-        }
-        //修改退货状态为待退货
-        salesReturn.setStatus(SalesReturnStatusEnum.PASS.getKey());
-        salesReturn.setApprovedDate(new Date());
-        salesReturnService.updateById(salesReturn);
-        //修改退货明细状态为待退货
-        SalesReturnDetail detail = new SalesReturnDetail();
-        detail.setStatus(SalesReturnDetailStatusEnum.STATUS_20.getKey());
-        salesReturnDetailService.update(detail, Wrappers.<SalesReturnDetail>query()
-                .lambda().eq(SalesReturnDetail::getSalesReturnId, salesReturn.getId()));
-        List<SalesReturnDetail> salesReturnDetailList = salesReturnDetailService.list(Wrappers.<SalesReturnDetail>query()
-                .lambda().eq(SalesReturnDetail::getSalesReturnId, salesReturn.getId()));
-        //添加一份待出库数据
-        StockWait stockWait = new StockWait();
-        stockWait.setBusinessId(businessId);
-        stockWait.setType(2);//入库
-        stockWait.setStatus(0);//待入库
-        stockWait.setBusinessType(StockWaitType.BACK_OUT.getDetailType());//退货出库
-        stockWaitService.save(stockWait);
-        List<StockWaitDetails> stockWaitDetailsList = new ArrayList<>();
-        for (SalesReturnDetail s : salesReturnDetailList) {
-            StockWaitDetails stockWaitDetails = new StockWaitDetails();
-            stockWaitDetails.setStockWaitId(stockWait.getId());
-            stockWaitDetails.setProductId(s.getBussinessId());
-            stockWaitDetails.setBusinessDetailsId(s.getId());//到货明细ID
-            stockWaitDetails.setQuantity(s.getCount());
-            stockWaitDetailsList.add(stockWaitDetails);
-        }
-        stockWaitDetailsService.saveBatch(stockWaitDetailsList);
-    }
-
-}
+//package com.fjhx.purchase.flow;
+//
+//import cn.hutool.extra.spring.SpringUtil;
+//import com.alibaba.fastjson.JSONObject;
+//import com.baomidou.dynamic.datasource.annotation.DS;
+//import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+//import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+//import com.fjhx.common.constant.SourceConstant;
+//import com.fjhx.common.enums.CodingRuleEnum;
+//import com.fjhx.common.service.coding.CodingRuleService;
+//import com.fjhx.flow.core.FlowDelegate;
+//import com.fjhx.flow.enums.FlowStatusEnum;
+//import com.fjhx.purchase.entity.sales.enums.SalesReturnDetailStatusEnum;
+//import com.fjhx.purchase.entity.sales.enums.SalesReturnStatusEnum;
+//import com.fjhx.purchase.entity.sales.po.SalesReturn;
+//import com.fjhx.purchase.entity.sales.po.SalesReturnDetail;
+//import com.fjhx.purchase.service.sales.SalesReturnDetailService;
+//import com.fjhx.purchase.service.sales.SalesReturnService;
+//import com.fjhx.wms.entity.stock.emums.StockWaitType;
+//import com.fjhx.wms.entity.stock.po.StockWait;
+//import com.fjhx.wms.entity.stock.po.StockWaitDetails;
+//import com.fjhx.wms.service.stock.StockWaitDetailsService;
+//import com.fjhx.wms.service.stock.StockWaitService;
+//import com.ruoyi.common.exception.ServiceException;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//
+//import java.util.ArrayList;
+//import java.util.Date;
+//import java.util.List;
+//
+///**
+// * 退货流程
+// *
+// * @Author:caozj
+// * @DATE:2023/4/3 17:38
+// */
+////@DS(SourceConstant.PURCHASE)
+//@Component
+//public class SalesReturnFlow extends FlowDelegate {
+//
+//    @Autowired
+//    StockWaitDetailsService stockWaitDetailsService;
+//
+//    @Autowired
+//    private CodingRuleService codingRuleService;
+//
+//    @Override
+//    public String getFlowKey() {
+//        return "sales_return_flow";
+//    }
+//
+//
+//    /**
+//     * 发起流程
+//     *
+//     * @param flowId     流程ID
+//     * @param submitData 数据
+//     * @return
+//     */
+//    @Override
+//    public Long start(Long flowId, JSONObject submitData) {
+//        SalesReturnService salesReturnService = SpringUtil.getBean(SalesReturnService.class);
+//        SalesReturnDetailService salesReturnDetailService = SpringUtil.getBean(SalesReturnDetailService.class);
+//        SalesReturn salesReturn = submitData.toJavaObject(SalesReturn.class);
+////        salesReturn.setCode(CodeEnum.SALES_RETURN.getCode());
+//        salesReturn.setCode(codingRuleService.createCode(CodingRuleEnum.SALES_RETURN.getKey(),null));
+//        salesReturnService.save(salesReturn);
+//        List<SalesReturnDetail> salesReturnDetailList = salesReturn.getSalesReturnDetailList();
+//        if (CollectionUtils.isNotEmpty(salesReturnDetailList)) {
+//            for (SalesReturnDetail s : salesReturnDetailList) {
+//                s.setSalesReturnId(salesReturn.getId());
+//            }
+//            salesReturnDetailService.saveBatch(salesReturnDetailList);
+//        }
+//        return salesReturn.getId();
+//    }
+//
+//    /**
+//     * 结束流程
+//     *
+//     * @param flowId     流程ID
+//     * @param businessId 业务ID
+//     * @param submitData 数据
+//     */
+//    @Override
+//    public void end(Long flowId, Long businessId, JSONObject submitData) {
+//        SalesReturnService salesReturnService = SpringUtil.getBean(SalesReturnService.class);
+//        SalesReturnDetailService salesReturnDetailService = SpringUtil.getBean(SalesReturnDetailService.class);
+//        StockWaitService stockWaitService = SpringUtil.getBean(StockWaitService.class);
+//        //通过业务ID查询退货数据
+//        SalesReturn salesReturn = salesReturnService.getById(businessId);
+//        if (ObjectUtils.isEmpty(salesReturn)) {
+//            throw new ServiceException("退货单单不存在");
+//        }
+//        //修改退货状态为待退货
+//        salesReturn.setStatus(SalesReturnStatusEnum.PASS.getKey());
+//        salesReturn.setApprovedDate(new Date());
+//        salesReturnService.updateById(salesReturn);
+//        //修改退货明细状态为待退货
+//        SalesReturnDetail detail = new SalesReturnDetail();
+//        detail.setStatus(SalesReturnDetailStatusEnum.STATUS_20.getKey());
+//        salesReturnDetailService.update(detail, Wrappers.<SalesReturnDetail>query()
+//                .lambda().eq(SalesReturnDetail::getSalesReturnId, salesReturn.getId()));
+//        List<SalesReturnDetail> salesReturnDetailList = salesReturnDetailService.list(Wrappers.<SalesReturnDetail>query()
+//                .lambda().eq(SalesReturnDetail::getSalesReturnId, salesReturn.getId()));
+//        //添加一份待出库数据
+//        StockWait stockWait = new StockWait();
+//        stockWait.setBusinessId(businessId);
+//        stockWait.setType(2);//入库
+//        stockWait.setStatus(0);//待入库
+//        stockWait.setBusinessType(StockWaitType.BACK_OUT.getDetailType());//退货出库
+//        stockWaitService.save(stockWait);
+//        List<StockWaitDetails> stockWaitDetailsList = new ArrayList<>();
+//        for (SalesReturnDetail s : salesReturnDetailList) {
+//            StockWaitDetails stockWaitDetails = new StockWaitDetails();
+//            stockWaitDetails.setStockWaitId(stockWait.getId());
+//            stockWaitDetails.setProductId(s.getBussinessId());
+//            stockWaitDetails.setBusinessDetailsId(s.getId());//到货明细ID
+//            stockWaitDetails.setQuantity(s.getCount());
+//            stockWaitDetailsList.add(stockWaitDetails);
+//        }
+//        stockWaitDetailsService.saveBatch(stockWaitDetailsList);
+//    }
+//
+//}

+ 2 - 21
hx-purchase/src/main/java/com/fjhx/purchase/service/arrival/impl/ArrivalServiceImpl.java

@@ -10,7 +10,6 @@ import com.fjhx.common.enums.CodingRuleEnum;
 import com.fjhx.common.service.coding.CodingRuleService;
 import com.fjhx.common.utils.Assert;
 import com.fjhx.item.service.product.ProductInfoService;
-import com.fjhx.kd100.service.company.CompanyInfoService;
 import com.fjhx.purchase.entity.arrival.dto.ArrivalDto;
 import com.fjhx.purchase.entity.arrival.dto.ArrivalSelectDto;
 import com.fjhx.purchase.entity.arrival.po.Arrival;
@@ -21,12 +20,8 @@ import com.fjhx.purchase.entity.purchase.po.Purchase;
 import com.fjhx.purchase.mapper.arrival.ArrivalMapper;
 import com.fjhx.purchase.service.arrival.ArrivalDetailService;
 import com.fjhx.purchase.service.arrival.ArrivalService;
-import com.fjhx.purchase.service.purchase.PurchaseDetailService;
 import com.fjhx.purchase.service.purchase.PurchaseService;
-import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
-import com.fjhx.purchase.service.subscribe.SubscribeService;
-import com.fjhx.supply.service.supplier.SupplierInfoService;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
+import com.fjhx.wms.entity.stock.emums.JournalType;
 import com.fjhx.wms.entity.stock.po.StockWait;
 import com.fjhx.wms.entity.stock.po.StockWaitDetails;
 import com.fjhx.wms.service.stock.StockWaitDetailsService;
@@ -65,20 +60,6 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
 
     @Autowired
     private StockWaitDetailsService stockWaitDetailsService;
-
-    @Autowired
-    private SubscribeDetailService subscribeDetailService;
-
-    @Autowired
-    private SubscribeService subscribeService;
-
-    @Autowired
-    private PurchaseDetailService purchaseDetailService;
-
-    @Autowired
-    private CompanyInfoService companyInfoService;
-    @Autowired
-    private SupplierInfoService supplierInfoService;
     @Autowired
     private ProductInfoService productInfoService;
 
@@ -131,7 +112,7 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
             stockWait.setBusinessCode(purchase.getCode());// 采购编码
             stockWait.setType(1);// 入库
             stockWait.setStatus(0);// 待入库
-            stockWait.setBusinessType(StockWaitType.PURCHASE_ARRIVAL_IN.getDetailType());// 采购到货
+            stockWait.setBusinessType(JournalType.PURCHASE_IN.getDetailType());// 采购到货
             stockWaitService.save(stockWait);
 
             List<StockWaitDetails> stockWaitDetailsList = new ArrayList<>();

+ 24 - 20
hx-purchase/src/main/java/com/fjhx/purchase/service/invoice/impl/InvoiceServiceImpl.java

@@ -29,7 +29,6 @@ import org.springframework.stereotype.Service;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.stream.Collectors;
 
 
@@ -38,7 +37,7 @@ import java.util.stream.Collectors;
  * 发票管理 服务实现类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-04-12
  */
 //@DS(SourceConstant.PURCHASE)
@@ -53,6 +52,7 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
 
     /**
      * 分页
+     *
      * @param dto
      * @return
      */
@@ -65,13 +65,9 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
         if (StringUtils.isNotEmpty(dto.getKeyword())) {
             wrapper.keyword(dto.getKeyword(), new SqlField("t1.purchaseCodes"));
         }
-        //权限过滤:发票-子公司看自己的,总公司看全部
-        Long companyId = SecurityUtils.getCompanyId();
-        if (!Objects.equals(companyId, 100L)) {
-            wrapper.eq("t1", Invoice::getCompanyId, companyId);
-        } else {
-            wrapper.eq("t1", Invoice::getCompanyId, dto.getCompanyId());
-        }
+        //权限过滤:发票-子公司看自己的
+        wrapper.eq("t1", Invoice::getCompanyId, SecurityUtils.getCompanyId());
+
         wrapper.orderByDesc("t1", Invoice::getCreateTime);
         Page<InvoiceVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<InvoiceVo> list = page.getRecords();
@@ -91,6 +87,7 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
 
     /**
      * 详情
+     *
      * @param id
      * @return
      */
@@ -101,11 +98,11 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
         List<InvoiceDetailsVo> invoiceDetailsVos = invoiceDetailsService.getDetail(id);
         List<Long> ids = invoiceDetailsVos.stream().distinct().map(InvoiceDetailsVo::getPurchaseId).collect(Collectors.toList());
         List<InvoiceDetailsVo> invoiceDetailsList = invoiceDetailsService.getSumMoneyByPurchaseIds(ids);
-        Map<Long, BigDecimal> invoiceMap = invoiceDetailsList.stream().collect(Collectors.toMap(InvoiceDetailsVo::getPurchaseId,InvoiceDetailsVo::getSumMoney));
-        for(InvoiceDetailsVo p:invoiceDetailsVos){
-            if(MapUtils.isNotEmpty(invoiceMap)){
+        Map<Long, BigDecimal> invoiceMap = invoiceDetailsList.stream().collect(Collectors.toMap(InvoiceDetailsVo::getPurchaseId, InvoiceDetailsVo::getSumMoney));
+        for (InvoiceDetailsVo p : invoiceDetailsVos) {
+            if (MapUtils.isNotEmpty(invoiceMap)) {
                 p.setSumMoney(invoiceMap.getOrDefault(p.getPurchaseId(), BigDecimal.ZERO));
-            }else{
+            } else {
                 p.setSumMoney(BigDecimal.ZERO);
             }
         }
@@ -115,17 +112,22 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
 
     /**
      * 新增
+     *
      * @param invoice
      */
     @Override
     @DSTransactional
     public void add(Invoice invoice) {
+
+        Long companyId = SecurityUtils.getCompanyId();
+        invoice.setCompanyId(companyId);
         this.save(invoice);
         List<InvoiceDetails> invoiceDetailsList = invoice.getInvoiceDetailsList();
-        if(CollectionUtils.isNotEmpty(invoiceDetailsList)){
+        if (CollectionUtils.isNotEmpty(invoiceDetailsList)) {
 
             invoiceDetailsList = invoiceDetailsList.stream()
                     .peek(item -> item.setInvoiceId(invoice.getId()))
+                    .peek(item -> item.setCompanyId(companyId))
                     .filter(item -> item.getMoney() != null && item.getMoney().compareTo(BigDecimal.ZERO) > 0)
                     .collect(Collectors.toList());
 
@@ -135,38 +137,40 @@ public class InvoiceServiceImpl extends ServiceImpl<InvoiceMapper, Invoice> impl
 
         }
 
-        ObsFileUtil.saveFile(invoice.getFileList(),invoice.getId());
+        ObsFileUtil.saveFile(invoice.getFileList(), invoice.getId());
     }
 
     /**
      * 修改
+     *
      * @param invoice
      */
     @Override
     @DSTransactional
     public void edit(Invoice invoice) {
         this.updateById(invoice);
-        invoiceDetailsService.remove(Wrappers.<InvoiceDetails>query().lambda().eq(InvoiceDetails::getInvoiceId,invoice.getId()));
+        invoiceDetailsService.remove(Wrappers.<InvoiceDetails>query().lambda().eq(InvoiceDetails::getInvoiceId, invoice.getId()));
         List<InvoiceDetails> invoiceDetailsList = invoice.getInvoiceDetailsList();
-        if(CollectionUtils.isNotEmpty(invoiceDetailsList)){
-            for(InvoiceDetails d:invoiceDetailsList){
+        if (CollectionUtils.isNotEmpty(invoiceDetailsList)) {
+            for (InvoiceDetails d : invoiceDetailsList) {
                 d.setInvoiceId(invoice.getId());
             }
             invoiceDetailsService.saveBatch(invoiceDetailsList);
         }
         //修改
-        ObsFileUtil.editFile(invoice.getFileList(),invoice.getId());
+        ObsFileUtil.editFile(invoice.getFileList(), invoice.getId());
     }
 
     /**
      * 删除
+     *
      * @param id
      */
     @Override
     @DSTransactional
     public void delete(Long id) {
         this.removeById(id);
-        invoiceDetailsService.remove(Wrappers.<InvoiceDetails>query().lambda().eq(InvoiceDetails::getInvoiceId,id));
+        invoiceDetailsService.remove(Wrappers.<InvoiceDetails>query().lambda().eq(InvoiceDetails::getInvoiceId, id));
         ObsFileUtil.removeFile(id);
     }
 

+ 4 - 8
hx-purchase/src/main/java/com/fjhx/purchase/service/pay/impl/PayServiceImpl.java

@@ -106,13 +106,8 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements PaySe
             wrapper.keyword(dto.getKeyword(), new SqlField(Pay::getUserName), new SqlField(Pay::getRemark));
         }
 
-        //权限过滤:采购付款-子公司看自己的,总公司看全部
-        Long companyId = SecurityUtils.getCompanyId();
-        if (!Objects.equals(companyId, 100L)) {
-            wrapper.eq("p", Pay::getCompanyId, companyId);
-        } else {
-            wrapper.eq("p", Pay::getCompanyId, dto.getCompanyId());
-        }
+        //权限过滤:采购付款-子公司看自己的
+        wrapper.eq("p", Pay::getCompanyId, SecurityUtils.getCompanyId());
 
         wrapper.orderByDesc("p", Pay::getCreateTime);
         Page<PayVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
@@ -158,6 +153,7 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements PaySe
 
     /**
      * 详情
+     *
      * @param id
      * @return
      */
@@ -220,7 +216,7 @@ public class PayServiceImpl extends ServiceImpl<PayMapper, Pay> implements PaySe
         DynamicDataSourceContextHolder.push(SourceConstant.BASE);
         FlowExample flowExample = flowExampleService.getOne(Wrappers.<FlowExample>query().lambda().eq(FlowExample::getBusinessId, id));
         // 赋值流程id
-        if(ObjectUtil.isNotEmpty(flowExample)) {
+        if (ObjectUtil.isNotEmpty(flowExample)) {
             result.setFlowExampleId(flowExample.getId());
         }
 

+ 2 - 8
hx-sale/src/main/java/com/fjhx/sale/flow/EhsdPurchaseFlow.java

@@ -20,8 +20,6 @@ import com.fjhx.item.enums.ProductAvailableRecordType;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.purchase.entity.purchase.enums.PurchaseDataResourceEnum;
 import com.fjhx.purchase.entity.purchase.enums.PurchaseStatusEnum;
-import com.fjhx.purchase.mapper.subscribe.SubscribeDetailMapper;
-import com.fjhx.purchase.service.subscribe.SubscribeDetailService;
 import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.purchase.dto.EhsdPurchaseDto;
 import com.fjhx.sale.entity.purchase.po.EhsdPurchase;
@@ -35,7 +33,7 @@ import com.fjhx.sale.service.purchase.EhsdPurchaseProjectService;
 import com.fjhx.sale.service.purchase.EhsdPurchaseService;
 import com.fjhx.sale.service.sample.SampleProductService;
 import com.fjhx.sale.service.sample.SampleService;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
+import com.fjhx.wms.entity.stock.emums.JournalType;
 import com.fjhx.wms.entity.stock.po.StockWait;
 import com.fjhx.wms.entity.stock.po.StockWaitDetails;
 import com.fjhx.wms.service.stock.StockWaitDetailsService;
@@ -76,8 +74,6 @@ public class EhsdPurchaseFlow extends FlowDelegate {
     @Autowired
     private CodingRuleService codingRuleService;
     @Autowired
-    private SubscribeDetailService subscribeDetailService;
-    @Autowired
     private ContractService contractService;
     @Autowired
     private SampleService sampleService;
@@ -87,8 +83,6 @@ public class EhsdPurchaseFlow extends FlowDelegate {
     private StockWaitService stockWaitService;
     @Autowired
     private StockWaitDetailsService stockWaitDetailsService;
-    @Autowired
-    private SubscribeDetailMapper subscribeDetailMapper;
 
     @Override
     public String getFlowKey() {
@@ -250,7 +244,7 @@ public class EhsdPurchaseFlow extends FlowDelegate {
         //采购审批通过 生成待入库数据
         StockWait stockWait = new StockWait();
         stockWait.setType(1);
-        stockWait.setBusinessType(StockWaitType.PURCHASE_ARRIVAL_IN.getDetailType());
+        stockWait.setBusinessType(JournalType.PURCHASE_IN.getDetailType());
         stockWait.setBusinessId(purchase.getId());
         stockWait.setBusinessCode(purchase.getCode());
         stockWait.setStatus(0);

+ 8 - 3
hx-sale/src/main/java/com/fjhx/sale/flow/PayFlow.java

@@ -1,14 +1,12 @@
 package com.fjhx.sale.flow;
 
 import com.alibaba.fastjson.JSONObject;
-import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.fjhx.account.entity.account.enums.PaymentStatusEnum;
 import com.fjhx.account.entity.account.enums.PaymentTypeEnum;
 import com.fjhx.account.entity.account.po.AccountPayment;
 import com.fjhx.account.service.account.AccountPaymentService;
-import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.common.enums.FlowStatusEnum1;
 import com.fjhx.file.utils.ObsFileUtil;
 import com.fjhx.flow.core.FlowDelegate;
@@ -70,13 +68,20 @@ public class PayFlow extends FlowDelegate {
     public Long start(Long flowId, JSONObject submitData) {
         Pay pay = submitData.toJavaObject(Pay.class);
 
+        Long companyId = SecurityUtils.getCompanyId();
+
+        pay.setCompanyId(companyId);
+
         pay.setCurrency("CNY");
         pay.setStatus(PayStatusEnum1.UNDER_REVIEW.getKey());
         payService.saveOrUpdate(pay);
 
         List<PayDetail> payDetailList = pay.getPayDetailList();
         if (CollectionUtils.isNotEmpty(payDetailList)) {
-            payDetailList.forEach(item -> item.setPayId(pay.getId()));
+            payDetailList.forEach(item -> {
+                item.setPayId(pay.getId());
+                item.setCompanyId(companyId);
+            });
         }
         payDetailService.editLinked(payDetailList, PayDetail::getPayId, pay.getId());
 

+ 2 - 6
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -1342,17 +1342,13 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
 
         //作废审批中的采购合同
         ehsdPurchaseService.update(q -> q
-                .eq(EhsdPurchase::getId, businessId)
+                .eq(EhsdPurchase::getDataResourceId, businessId)
                 .eq(EhsdPurchase::getStatus, 10)
                 .set(EhsdPurchase::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
                 .set(BasePo::getUpdateTime, new Date())
                 .set(BasePo::getUpdateUser, SecurityUtils.getUserId())
         );
-        List<EhsdPurchase> purchaseList = ehsdPurchaseService.list(q -> q
-                .eq(EhsdPurchase::getDataResourceId, businessId)
-                .eq(EhsdPurchase::getStatus, 10)
-        );
-        List<Long> flowIds = purchaseList.stream().map(EhsdPurchase::getFlowId).collect(Collectors.toList());
+        List<Long> flowIds = ehsdPurchaseService.listObject(EhsdPurchase::getFlowId, q -> q.eq(EhsdPurchase::getDataResourceId, businessId));
         if (ObjectUtil.isNotEmpty(flowIds)) {
             //修改流程审批状态
             flowExampleService.update(q -> q

+ 4 - 0
hx-sale/src/main/java/com/fjhx/sale/service/purchase/impl/EhsdPurchaseServiceImpl.java

@@ -477,6 +477,10 @@ public class EhsdPurchaseServiceImpl extends ServiceImpl<EhsdPurchaseMapper, Ehs
             }
         }
         productInfoService.editAvailableQuantity(inOutBoList, InOutType.OUT, id, ProductAvailableRecordType.PURCHASE_CANCEL, purchase.getCompanyId());
+        //检查待入库是否存在,已入库或者部分入库的数据
+        if (stockWaitService.count(q -> q.eq(StockWait::getPurchaseId, purchase.getId()).ne(StockWait::getStatus, 0)) > 0) {
+            throw new ServiceException("该采购,已部分入库/已入库 禁止作废!");
+        }
         //同时删除待入库数据
         stockWaitService.remove(q -> q.eq(StockWait::getPurchaseId, purchase.getId()));
         //修改流程审批状态

+ 1 - 3
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -16,10 +16,8 @@
                            c.name                            customerName,
                            us.nick_name                      salesmanName,
                            us.user_id                        salesmanId,
-                           (SELECT IFNULL(SUM(IFNULL(cc.money_cny, IFNULL(cc.money, 0) * IFNULL(arw.rate, 1))), 0)
+                           (SELECT IFNULL(SUM(cc.contract_money), 0)
                             FROM claim_contract cc
-                                     left join claim c on cc.claim_id = c.id
-                                     LEFT JOIN account_running_water arw on c.business_id = arw.id
                             WHERE cc.contract_id = t1.id) AS sumClaimMoney
                     FROM contract t1
                              left join customer c on t1.buy_corporation_id = c.id

+ 0 - 8
hx-wms/src/main/java/com/fjhx/wms/controller/stock/StockJournalDetailsController.java

@@ -37,14 +37,6 @@ public class StockJournalDetailsController {
         return stockJournalDetailsService.getPage(dto);
     }
 
-//    /**
-//     * 出入库记录明细分页 维多利亚
-//     */
-//    @PostMapping("/pageByWdly")
-//    public Page<StockJournalDetailsVo> pageByWdly(@RequestBody StockJournalSelectDto dto) {
-//        return stockJournalDetailsService.getPageByWdly(dto);
-//    }
-
     /**
      * 出入库记录明细明细
      */

+ 50 - 1
hx-wms/src/main/java/com/fjhx/wms/entity/stock/dto/StockDto.java

@@ -4,6 +4,7 @@ import com.fjhx.wms.entity.stock.po.Stock;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -26,11 +27,59 @@ public class StockDto extends Stock {
      */
     private List<Stock> list;
 
-    /**业务类型*/
+    /**
+     * 业务类型
+     */
     private Integer type;
 
     /**
      * 业务id
      */
     private Long businessId;
+
+
+    //手动出入库类型ID赋值
+    /**
+     * 生产订单id
+     */
+    private Long prodOrderId;
+    /**
+     * 销售订单id
+     */
+    private Long saleOrderId;
+    /**
+     * 借用id
+     */
+    private Long borrowId;
+    /**
+     * 预计归还时间
+     */
+    private Date expectRestitutionTime;
+    /**
+     * 归还id
+     */
+    private Long restitutionId;
+    /**
+     * 归还时间
+     */
+    private Date restitutionTime;
+    /**
+     * 丢件id
+     */
+    private Long loseId;
+    /**
+     * 寻回id
+     */
+    private Long seekId;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 出入库人
+     */
+    private String exWarehousePerson;
+
 }

+ 10 - 0
hx-wms/src/main/java/com/fjhx/wms/entity/stock/dto/StockJournalSelectDto.java

@@ -44,4 +44,14 @@ public class StockJournalSelectDto extends BaseSelectDto {
      */
     private Long companyId;
 
+    /**
+     * 是否归还
+     */
+    private Integer isRestitution;
+
+    /**
+     * 是否寻回
+     */
+    private Integer isSeek;
+
 }

+ 43 - 28
hx-wms/src/main/java/com/fjhx/wms/entity/stock/emums/JournalType.java

@@ -1,41 +1,56 @@
 package com.fjhx.wms.entity.stock.emums;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.fjhx.common.enums.InOutType;
+import com.ruoyi.common.exception.ServiceException;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 
+import java.util.HashMap;
+import java.util.Map;
+
 @AllArgsConstructor
 @Getter
 public enum JournalType {
-    MANUAL_IN(InOutType.IN, 1, "手动入库", ""),
-    MANUAL_OUT(InOutType.OUT, 2, "手动出库", ""),
-    ADJUSTING_IN(InOutType.IN, 3, "调仓入库", ""),
-    COMBINATION_IN(InOutType.IN, 6, "组合入库", "group_record_details"),
-    COMBINATION_OUT(InOutType.OUT, 7, "组合出库", "group_record_details"),
-    SPLIT_IN(InOutType.IN, 8, "组合拆分入库", "group_record_details"),
-    SPLIT_OUT(InOutType.OUT, 9, "组合拆分出库", "group_record_details"),
-    JD_SALES_OUT(InOutType.OUT, 10, "京东销售出库", "sales_record"),
-    ADJUSTING_OUT(InOutType.OUT, 11, "调仓出库", ""),
-    SALES_OUT(InOutType.OUT, 12, "销售订单出库", ""),
-    BACK_OUT(InOutType.OUT, 13, "待出库 退货出库", ""),
-    ARRIVAL_IN(InOutType.IN, 14, "到货入库", ""),
-    JD_BACK_IN(InOutType.IN, 15, "京东退货入库", ""),
-
-
-    //待出入库类型
-    BORDER_OF_LINE_IN(InOutType.IN, 16, "待入库 线边回仓", ""),
-    COMPLETION_IN(InOutType.IN, 17, "待入库 完工入库", ""),
-    PURCHASE_ARRIVAL_IN(InOutType.IN, 18, "待入库 采购到货", ""),
-    ARRIVAL_QUALITY(InOutType.IN, 19, "到货质检", "quality_info"),
-    PRODUCTION_TASK_OUT(InOutType.OUT, 20, "生产任务待出库出库", "production_task"),
-
-    WORD_ORDER_OUT(InOutType.OUT, 21, "工单出库待出库出库", "work_order"),
-    STOCK_CHECK_IN(InOutType.IN, 22, "库存盘点修正入库", "stock_check"),
-    STOCK_CHECK_OUT(InOutType.OUT, 23, "库存盘点修正出库", "stock_check"),
-    CONTRACT_SALE_OUT(InOutType.OUT, 24, "合同销售出库", ""),
-    AFTER_SALES_MATERIAL_OUT(InOutType.OUT, 25, "售后物料出库", "after_sales_record"),
-    ;
 
+    //出库
+    PROD_PROOFING_OUT(InOutType.OUT, 0, "生产打样", ""),//手动出库
+    PROD_EXCEED_OUT(InOutType.OUT, 1, "生产超领", ""),//手动出库
+    SALE_OUT(InOutType.OUT, 2, "销售出库", ""),//手动出库
+    BORROW_OUT(InOutType.OUT, 3, "借用出库", ""),//手动出库
+    REPAIR_EXCEED_OUT(InOutType.OUT, 4, "补单超领", ""),//待出库-APP补单
+    LOSE_EXCEED_OUT(InOutType.OUT, 5, "丢件超领", ""),//待出库-APP丢单
+    PURCHASE_RETURN_OUT(InOutType.OUT, 6, "采购退货", ""),//待出库-采购退货
+    TRANSFER_OUT(InOutType.OUT, 7, "调拨出库", ""),//调仓
+    STOCK_CHECK_OUT(InOutType.OUT, 8, "盘亏出库", ""),//库存盘点
+    PROD_OUT(InOutType.OUT, 9, "生产出库", ""),//待出库-生产出库
+
+
+    //入库
+    RESTITUTION_IN(InOutType.IN, 100, "归还入库", ""),//手动入库
+    MATERIAL_RETURN_IN(InOutType.IN, 101, "退料入库", ""),//手动入库
+    DISCARD_MATERIAL_IN(InOutType.IN, 102, "废料入库", ""),//手动入库
+    LOSE_IN(InOutType.IN, 103, "丢件寻回", ""),//手动入库
+    PURCHASE_IN(InOutType.IN, 104, "采购入库", ""),//待入库-采购入库
+    TRANSFER_IN(InOutType.IN, 105, "调拨入库", ""),//调仓
+    STOCK_CHECK_IN(InOutType.IN, 106, "盘盈入库", ""),//库存盘点
+    COMPLETION_IN(InOutType.IN, 107, "完工入库", "");//待入库-完工入库
+
+    private final static Map<Integer, JournalType> map = new HashMap<>();
+
+    static {
+        for (JournalType value : JournalType.values()) {
+            map.put(value.detailType, value);
+        }
+    }
+
+    public static JournalType getByDetailType(Integer detailType) {
+        JournalType journalType = map.get(detailType);
+        if (ObjectUtil.isEmpty(journalType)) {
+            throw new ServiceException("未知流水类型");
+        }
+        return journalType;
+    }
 
     /**
      * 出入库类型

+ 64 - 61
hx-wms/src/main/java/com/fjhx/wms/entity/stock/emums/StockWaitType.java

@@ -1,61 +1,64 @@
-package com.fjhx.wms.entity.stock.emums;
-
-import com.fjhx.common.enums.InOutType;
-import com.ruoyi.common.exception.ServiceException;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@AllArgsConstructor
-@Getter
-public enum StockWaitType {
-
-    BORDER_OF_LINE_IN(InOutType.IN, JournalType.BORDER_OF_LINE_IN, 1, "线边回仓", ""),
-    COMPLETION_IN(InOutType.IN, JournalType.COMPLETION_IN, 2, "完工入库", ""),
-    PURCHASE_ARRIVAL_IN(InOutType.IN, JournalType.PURCHASE_ARRIVAL_IN, 3, "采购到货", ""),
-    BACK_OUT(InOutType.OUT, JournalType.BACK_OUT, 4, "退货出库", ""),
-    SALE_ORDER_OUT(InOutType.OUT, JournalType.SALES_OUT, 6, "销售订单出库", "order_info"),
-    PRODUCTION_TASK_OUT(InOutType.OUT, JournalType.PRODUCTION_TASK_OUT, 7, "生产任务待出库", "production_task");
-
-
-    private final static Map<Integer, StockWaitType> map = new HashMap<>();
-
-    static {
-        for (StockWaitType value : StockWaitType.values()) {
-            map.put(value.detailType, value);
-        }
-    }
-
-    /**
-     * 出入库类型
-     */
-    private final InOutType type;
-    /**
-     * 出入库流水类型
-     */
-    private final JournalType journalType;
-    /**
-     * 详细类型
-     */
-    private final Integer detailType;
-
-    /**
-     * 信息类型说明
-     */
-    private final String detailTypeRemark;
-
-    /**
-     * 关联业务表名
-     */
-    private final String linkBusinessTableName;
-
-
-    public static StockWaitType getEnum(Integer key) {
-        return map.computeIfAbsent(key, item -> {
-            throw new ServiceException("未知待出/入库类型");
-        });
-    }
-
-}
+//package com.fjhx.wms.entity.stock.emums;
+//
+//import com.fjhx.common.enums.InOutType;
+//import com.ruoyi.common.exception.ServiceException;
+//import lombok.AllArgsConstructor;
+//import lombok.Getter;
+//
+//import java.util.HashMap;
+//import java.util.Map;
+//
+//@AllArgsConstructor
+//@Getter
+//public enum StockWaitType {
+//
+//    //待出库
+//    REPAIR_EXCEED_OUT(InOutType.OUT, JournalType.REPAIR_EXCEED_OUT, 1, "补单超领", ""),//待出库-APP补单
+//    LOSE_EXCEED_OUT(InOutType.OUT, JournalType.LOSE_EXCEED_OUT, 2, "丢件超领", ""),//待出库-APP丢单
+//    PURCHASE_RETURN_OUT(InOutType.OUT, JournalType.PURCHASE_RETURN_OUT, 3, "采购退货", ""),//待出库-采购退货
+//    PROD_OUT(InOutType.OUT, JournalType.PROD_OUT, 4, "生产任务待出库", ""),
+//
+//    //待入库
+//    COMPLETION_IN(InOutType.IN, JournalType.COMPLETION_IN, 100, "完工入库", ""),
+//    PURCHASE_ARRIVAL_IN(InOutType.IN, JournalType.PURCHASE_IN, 101, "采购入库", "");
+//
+//
+//    private final static Map<Integer, StockWaitType> map = new HashMap<>();
+//
+//    static {
+//        for (StockWaitType value : StockWaitType.values()) {
+//            map.put(value.detailType, value);
+//        }
+//    }
+//
+//    /**
+//     * 出入库类型
+//     */
+//    private final InOutType type;
+//    /**
+//     * 出入库流水类型
+//     */
+//    private final JournalType journalType;
+//    /**
+//     * 详细类型
+//     */
+//    private final Integer detailType;
+//
+//    /**
+//     * 信息类型说明
+//     */
+//    private final String detailTypeRemark;
+//
+//    /**
+//     * 关联业务表名
+//     */
+//    private final String linkBusinessTableName;
+//
+//
+//    public static StockWaitType getEnum(Integer key) {
+//        return map.computeIfAbsent(key, item -> {
+//            throw new ServiceException("未知待出/入库类型");
+//        });
+//    }
+//
+//}

+ 0 - 10
hx-wms/src/main/java/com/fjhx/wms/entity/stock/po/Stock.java

@@ -35,16 +35,6 @@ public class Stock extends BasePo {
      */
     private BigDecimal quantity;
 
-//    /**
-//     * 维多利亚扩展
-//     */
-//    private String victoriatouristJson;
-//
-//    /**
-//     * 结存单价
-//     */
-//    private BigDecimal unitPrice;
-
     /**
      * 归属公司id
      */

+ 42 - 5
hx-wms/src/main/java/com/fjhx/wms/entity/stock/po/StockJournal.java

@@ -5,6 +5,8 @@ import com.ruoyi.common.core.domain.BasePo;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.util.Date;
+
 /**
  * <p>
  * 出入库记录
@@ -38,11 +40,6 @@ public class StockJournal extends BasePo {
      */
     private Long warehouseId;
 
-//    /**
-//     * 调仓目标仓库id
-//     */
-//    private Long toWarehouseId;
-
     /**
      * 业务id
      */
@@ -53,4 +50,44 @@ public class StockJournal extends BasePo {
      */
     private Long companyId;
 
+    //手动出入库类型ID赋值
+    /**
+     * 生产订单id
+     */
+    private Long prodOrderId;
+    /**
+     * 借用id
+     */
+    private Long borrowId;
+    /**
+     * 预计归还时间
+     */
+    private Date expectRestitutionTime;
+    /**
+     * 归还id
+     */
+    private Long restitutionId;
+    /**
+     * 归还时间
+     */
+    private Date restitutionTime;
+    /**
+     * 丢件id
+     */
+    private Long loseId;
+    /**
+     * 寻回id
+     */
+    private Long seekId;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 出入库人
+     */
+    private String exWarehousePerson;
+
 }

+ 0 - 5
hx-wms/src/main/java/com/fjhx/wms/service/stock/StockJournalDetailsService.java

@@ -23,11 +23,6 @@ public interface StockJournalDetailsService extends BaseService<StockJournalDeta
      */
     Page<StockJournalDetailsVo> getPage(StockJournalSelectDto dto);
 
-//    /**
-//     * 出入库记录明细分页 维多利亚
-//     */
-//    Page<StockJournalDetailsVo> getPageByWdly(StockJournalSelectDto dto);
-
     /**
      * 出入库记录明细明细
      */

+ 1 - 26
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockJournalDetailsServiceImpl.java

@@ -12,7 +12,6 @@ import com.fjhx.wms.entity.stock.po.StockJournalDetails;
 import com.fjhx.wms.entity.stock.vo.StockJournalDetailsVo;
 import com.fjhx.wms.mapper.stock.StockJournalDetailsMapper;
 import com.fjhx.wms.service.stock.StockJournalDetailsService;
-import com.fjhx.wms.service.stock.StockWaitService;
 import com.fjhx.wms.service.warehouse.WarehouseService;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
@@ -38,8 +37,6 @@ public class StockJournalDetailsServiceImpl extends ServiceImpl<StockJournalDeta
     private ProductInfoService productInfoService;
     @Autowired
     private WarehouseService warehouseService;
-    @Autowired
-    private StockWaitService stockWaitService;
 
     @Override
     public Page<StockJournalDetailsVo> getPage(StockJournalSelectDto dto) {
@@ -67,7 +64,7 @@ public class StockJournalDetailsServiceImpl extends ServiceImpl<StockJournalDeta
         }
         // 赋值产品属性
         productInfoService.attributeAssign(records, StockJournalDetailsVo::getProductId, (item, product) -> {
-            item.setProductCode(product.getCode());
+            item.setProductCode(product.getCustomCode());
             item.setProductUnit(product.getUnit());
             item.setProductType(product.getType());
             item.setProductName(product.getName());
@@ -83,28 +80,6 @@ public class StockJournalDetailsServiceImpl extends ServiceImpl<StockJournalDeta
         return page;
     }
 
-//    @Override
-//    public Page<StockJournalDetailsVo> getPageByWdly(StockJournalSelectDto dto) {
-//        Page<StockJournalDetailsVo> page = getPage(dto);
-//        List<StockJournalDetailsVo> records = page.getRecords();
-//        if (ObjectUtil.isEmpty(records)) {
-//            return page;
-//        }
-//        //给采购退货的数据赋值关联单号
-//        List<Long> swIds = records.stream().filter(x -> x.getType() == 13).map(StockJournalDetailsVo::getBusinessId).collect(Collectors.toList());
-//        if (ObjectUtil.isNotEmpty(swIds)) {
-//            Map<Long, StockWait> stockWaitMap = stockWaitService.mapKEntity(StockWait::getId, q -> q.in(StockWait::getId, swIds));
-//            for (StockJournalDetailsVo record : records) {
-//                StockWait stockWait = stockWaitMap.get(record.getBusinessId());
-//                if(ObjectUtil.isEmpty(stockWait)){
-//                    continue;
-//                }
-//                record.setLinkCode(stockWait.getBusinessCode());
-//            }
-//        }
-//        return page;
-//    }
-
     @Override
     public StockJournalDetailsVo detail(Long id) {
         StockJournalDetails StockJournalDetails = this.getById(id);

+ 28 - 6
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockJournalServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fjhx.wms.service.stock.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -77,21 +78,42 @@ public class StockJournalServiceImpl extends ServiceImpl<StockJournalMapper, Sto
     @Override
     public Page<StockJournalVo> getPage(StockJournalSelectDto dto) {
         IWrapper<StockJournal> wrapper = getWrapper();
-        wrapper.orderByDesc("sj", StockJournal::getCreateTime);
+
+        //根据类型过滤
         if (ObjectUtils.isNotEmpty(dto.getType())) {
             String[] split = dto.getType().split(",");
             wrapper.in("sj", StockJournal::getType, split);
         }
         wrapper.eq("sj", StockJournal::getOpType, dto.getOpType());
         wrapper.like("w", WarehouseVo::getName, dto.getKeyword());
+
+        //是否归还过滤
+        Integer isRestitution = dto.getIsRestitution();
+        if (ObjectUtil.isNotEmpty(isRestitution)) {
+            if (ObjectUtil.equals(isRestitution, 0)) {
+                wrapper.isNull("sj.restitution_id");
+            } else {
+                wrapper.isNotNull("sj.restitution_id");
+            }
+        }
+
+        //是否寻回过滤
+        Integer isSeek = dto.getIsSeek();
+        if (ObjectUtil.isNotEmpty(isSeek)) {
+            if (ObjectUtil.equals(isSeek, 0)) {
+                wrapper.isNull("sj.seek_id");
+            } else {
+                wrapper.isNotNull("sj.seek_id");
+            }
+        }
+
+        wrapper.orderByDesc("sj", StockJournal::getCreateTime);
         Page<StockJournalVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         List<StockJournalVo> records = page.getRecords();
         //根据id赋值操作人名称
         UserUtil.assignmentNickName(records, StockJournalVo::getCreateUser, StockJournalVo::setUserName);
-        //如果为调参类型记录赋值目标仓库名称
-//        warehouseService.attributeAssign(records, StockJournalVo::getToWarehouseId, (item, warehouse) -> {
-//            item.setToWarehouseName(warehouse.getName());
-//        });
+
+
         return page;
     }
 
@@ -118,7 +140,7 @@ public class StockJournalServiceImpl extends ServiceImpl<StockJournalMapper, Sto
         stockJournalVo.setList(stockJournalDetailsVos);
 
         //流水打印数据赋值
-        if (JournalType.PURCHASE_ARRIVAL_IN.getDetailType().equals(stockJournalVo.getType())) {
+        if (JournalType.PURCHASE_IN.getDetailType().equals(stockJournalVo.getType())) {
             StockWait stockWait = stockWaitService.getById(stockJournalVo.getBusinessId());
             Assert.notEmpty(stockWait, "查询不到待出入库信息");
             PurchasePo purchase = myPurchaseService.getPurchaseInfo(stockWait.getBusinessId());

+ 62 - 3
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockServiceImpl.java

@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fjhx.common.entity.InOutBo;
 import com.fjhx.common.enums.InOutType;
+import com.fjhx.common.utils.Assert;
 import com.fjhx.item.entity.product.po.ProductClassify;
 import com.fjhx.item.entity.product.po.ProductInfo;
 import com.fjhx.item.entity.product.po.ProductStockInfo;
@@ -148,7 +150,9 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
     @Override
     @DSTransactional
     public void add(StockDto stockDto) {
-        JournalType journalType = Objects.equals(stockDto.getType(), 1) ? JournalType.MANUAL_IN : JournalType.MANUAL_OUT;
+        //根据前端传的类型获取出入库流水类型
+        JournalType journalType = JournalType.getByDetailType(stockDto.getType());
+
         InOutType inOutType = journalType.getType();
 
         Long warehouseId = stockDto.getWarehouseId();
@@ -160,12 +164,17 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
 
         //创建出入库记录
         StockJournal stockJournal = new StockJournal();
-        stockJournal.setOpType(stockDto.getType());
+        stockJournal.setId(IdWorker.getId());
+        stockJournal.setOpType(inOutType == InOutType.IN ? 1 : 2);
         stockJournal.setType(journalType.getDetailType());
         stockJournal.setCode(stockDto.getType() == 1 ? CodeEnum.SIN_CODE.getCode() : CodeEnum.SOUT_CODE.getCode());
         stockJournal.setWarehouseId(warehouseId);
         stockJournal.setBusinessId(stockDto.getBusinessId());
         stockJournal.setCompanyId(companyId);
+        stockJournal.setRemarks(stockDto.getRemarks());
+        stockJournal.setExWarehousePerson(stockDto.getExWarehousePerson());
+        //赋值流水信息
+        editStockJournalInfo(stockDto, stockJournal);
         //保存出入库记录
         stockJournalService.save(stockJournal);
         List<Stock> list = stockDto.getList();
@@ -192,6 +201,55 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
         productInfoService.editAvailableQuantity(inOutBoList, inOutType, null, productAvailableRecordType, SecurityUtils.getCompanyId());
     }
 
+    /**
+     * 手动出入库参数校验赋值
+     */
+    private void editStockJournalInfo(StockDto stockDto, StockJournal stockJournal) {
+        JournalType byDetailType = JournalType.getByDetailType(stockDto.getType());
+        //赋值生产订单id以及销售订单id
+        boolean equals1 = JournalType.PROD_PROOFING_OUT.equals(byDetailType);//生产打样
+        boolean equals2 = JournalType.PROD_EXCEED_OUT.equals(byDetailType);//生产超领
+        boolean equals3 = JournalType.MATERIAL_RETURN_IN.equals(byDetailType);//退料入库
+        boolean equals4 = JournalType.DISCARD_MATERIAL_IN.equals(byDetailType);//废料入库
+        boolean equals5 = JournalType.SALE_OUT.equals(byDetailType);//销售出库
+        //生产打样,生产超领,退料入库,废料入库
+        if (equals1 || equals2 || equals3 || equals4 || equals5) {
+            Long prodOrderId = stockDto.getProdOrderId();
+            Assert.notEmpty(prodOrderId, "生产订单id不能为空");
+            stockJournal.setProdOrderId(prodOrderId);
+        }
+        //借用出库
+        if (JournalType.BORROW_OUT.equals(byDetailType)) {
+            Date expectRestitutionTime = stockDto.getExpectRestitutionTime();
+            Assert.notEmpty(expectRestitutionTime, "预计归还时间不能为空");
+            stockJournal.setExpectRestitutionTime(expectRestitutionTime);
+        }
+        //归还入库
+        if (JournalType.RESTITUTION_IN.equals(byDetailType)) {
+            Long borrowId = stockDto.getBorrowId();
+            Assert.notEmpty(borrowId, "借用id不能为空");
+            StockJournal borrowJournal = stockJournalService.getById(borrowId);
+            Assert.notEmpty(borrowJournal, "查询不到借用信息");
+            //赋值归还id
+            borrowJournal.setRestitutionId(stockJournal.getId());
+            borrowJournal.setRestitutionTime(new Date());
+            stockJournalService.updateById(borrowJournal);
+            //赋值借用id
+            stockJournal.setBorrowId(borrowId);
+        }
+        //丢件寻回
+        if (JournalType.LOSE_IN.equals(byDetailType)) {
+            Long loseId = stockDto.getLoseId();
+            Assert.notEmpty(loseId, "丢件id不能为空");
+            StockJournal loseIdJournal = stockJournalService.getById(loseId);
+            Assert.notEmpty(loseIdJournal, "查询不到丢件信息");
+            //赋值寻回Id
+            loseIdJournal.setSeekId(stockJournal.getId());
+            //赋值丢件id
+            stockJournal.setLoseId(loseId);
+        }
+    }
+
     @Override
     @DSTransactional
     public void edit(StockDto stockDto) {
@@ -267,7 +325,8 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
      * 计算结存单价(在操作库存之前计算)
      */
     @Override
-    public synchronized StockJournalDetails calculateUnitPrice(InOutType inOutType, Long productId, Long warehouseId, BigDecimal inOutQuantity, Integer purchaseArrival, BigDecimal price) {
+    public synchronized StockJournalDetails calculateUnitPrice(InOutType inOutType, Long productId, Long
+            warehouseId, BigDecimal inOutQuantity, Integer purchaseArrival, BigDecimal price) {
         Warehouse warehouse = warehouseService.getById(warehouseId);
         if (ObjectUtil.isEmpty(warehouse)) {
             throw new ServiceException("查询不到仓库信息");

+ 1 - 1
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitDetailsServiceImpl.java

@@ -68,7 +68,7 @@ public class StockWaitDetailsServiceImpl extends ServiceImpl<StockWaitDetailsMap
         }
         // 赋值产品属性
         productInfoService.attributeAssign(records, StockWaitDetailsVo::getProductId, (item, productInfo) -> {
-            item.setProductCode(productInfo.getCode());
+            item.setProductCode(productInfo.getCustomCode());
             item.setProductUnit(productInfo.getUnit());
             item.setProductType(productInfo.getType());
             item.setProductName(productInfo.getName());

+ 1 - 10
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java

@@ -14,15 +14,12 @@ import com.fjhx.wms.entity.stock.dto.StockWaitDetailsDto;
 import com.fjhx.wms.entity.stock.dto.StockWaitDto;
 import com.fjhx.wms.entity.stock.dto.StockWaitSelectDto;
 import com.fjhx.wms.entity.stock.emums.JournalType;
-import com.fjhx.wms.entity.stock.emums.StockWaitType;
 import com.fjhx.wms.entity.stock.po.*;
 import com.fjhx.wms.entity.stock.vo.StockWaitDetailsVo;
 import com.fjhx.wms.entity.stock.vo.StockWaitVo;
 import com.fjhx.wms.entity.warehouse.po.Warehouse;
 import com.fjhx.wms.mapper.stock.StockWaitMapper;
 import com.fjhx.wms.service.MyPurchaseService;
-import com.fjhx.wms.service.arrival.ArrivalStockRecordsDetailsService;
-import com.fjhx.wms.service.arrival.ArrivalStockRecordsService;
 import com.fjhx.wms.service.stock.*;
 import com.fjhx.wms.service.warehouse.WarehouseService;
 import com.fjhx.wms.utils.CodeEnum;
@@ -62,12 +59,6 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
     @Autowired
     private WarehouseService warehouseService;
     @Autowired
-    private ArrivalStockRecordsService arrivalStockRecordsService;
-    @Autowired
-    private ArrivalStockRecordsDetailsService arrivalStockRecordsDetailsService;
-    @Autowired
-    private StockFrozenService stockFrozenService;
-    @Autowired
     private MyPurchaseService myPurchaseService;
 
     @Override
@@ -200,7 +191,7 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
 
         //创建出入库记录
         Integer businessType = stockWait.getBusinessType();
-        JournalType journalType = StockWaitType.getEnum(businessType).getJournalType();
+        JournalType journalType = JournalType.getByDetailType(businessType);
         StockJournal stockJournal = new StockJournal();
         stockJournal.setOpType(stockWait.getType());//根据待入库类型赋值操作类型 1入库 2出库
         stockJournal.setType(journalType.getDetailType());