Browse Source

合并 20240919分支

hella_online_20240924
陈薪名 2 months ago
parent
commit
2d874e5eff
  1. 32
      sql/release_202405/wms_202405.sql
  2. 12
      win-module-qms/win-module-qms-api/src/main/java/com/win/module/qms/api/InspectionQ3/InspectionQ3Api.java
  3. 21
      win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/api/InspectionQ3/InspectionQ3ApiImpl.java
  4. 1
      win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/inspectionQ3/InspectionQ3MainService.java
  5. 12
      win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/inspectionQ3/InspectionQ3MainServiceImpl.java
  6. 5
      win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/q2/InspectionQ2ServiceImpl.java
  7. 3
      win-module-system/win-module-system-api/src/main/java/com/win/module/system/enums/ErrorCodeConstants.java
  8. 2
      win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/mail/MailSendServiceImpl.java
  9. 17
      win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/user/AdminUserServiceImpl.java
  10. 2
      win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/DictTypeConstants.java
  11. 9
      win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java
  12. 14
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/balance/BalanceController.java
  13. 9
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/countJob/CountJobMainController.java
  14. 32
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/customerreturnRecord/CustomerreturnRecordDetailController.java
  15. 71
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/location/LocationController.java
  16. 14
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/ProductionscrapRecordDetailController.java
  17. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/ProductionscrapRecordMainController.java
  18. 12
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordDetailBaseVO.java
  19. 25
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordDetailRespVO.java
  20. 14
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordMainBaseVO.java
  21. 32
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordMainExcelVO.java
  22. 13
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/ProductionscrapRequestDetailController.java
  23. 4
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/ProductionscrapRequestMainController.java
  24. 17
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestDetailBaseVO.java
  25. 26
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestDetailRespVO.java
  26. 30
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestImportVO.java
  27. 15
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestMainBaseVO.java
  28. 55
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestMainExcelVO.java
  29. 5
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestMainUpdateReqVO.java
  30. 104
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/purchasePlan/PurchasePlanDetailController.java
  31. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/purchasereturnRequest/vo/PurchasereturnRequestMainPrintVO.java
  32. 5
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/putawayJob/vo/PutawayJobMainBatchReqVO.java
  33. 17
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/rule/RuleController.java
  34. 22
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/rule/vo/RuleImportExcelVO.java
  35. 53
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/SaleShipmentDetailRecordController.java
  36. 52
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/SaleShipmentMainRecordController.java
  37. 11
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentDetailRecordRespVO.java
  38. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentMainRecordBaseVO.java
  39. 11
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentMainRecordCreateReqVO.java
  40. 23
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentMainRecordExcelVO.java
  41. 20
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRequest/SaleShipmentMainController.java
  42. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/supplierdeliverRequest/vo/SupplierdeliverRequestMainCreateReqVO.java
  43. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/supplierdeliverRequest/SupplierdeliverRequestDetailConvert.java
  44. 20
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRecord/ProductionscrapRecordDetailDO.java
  45. 24
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRecord/ProductionscrapRecordMainDO.java
  46. 30
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRequest/ProductionscrapRequestDetailDO.java
  47. 25
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRequest/ProductionscrapRequestMainDO.java
  48. 8
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/saleShipmentRecord/SaleShipmentMainRecordDO.java
  49. 18
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/saleShipmentRequest/SaleShipmentMainDO.java
  50. 5
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/productionscrapRecord/ProductionscrapRecordDetailMapper.java
  51. 12
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/purchasePlan/PurchasePlanDetailMapper.java
  52. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/supplierinvoiceinvoiced/SupplierinvoiceInvoicedMapper.java
  53. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countJob/CountJobMainService.java
  54. 48
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countJob/CountJobMainServiceImpl.java
  55. 115
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countRequest/CountRequestMainServiceImpl.java
  56. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countadjustRequest/CountadjustRequestMainServiceImpl.java
  57. 182
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customerreturnRequest/CustomerreturnRequestMainServiceImpl.java
  58. 22
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/inventorymoveRecord/InventorymoveRecordMainServiceImpl.java
  59. 173
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/inventorymoveRequest/InventorymoveRequestMainServiceImpl.java
  60. 195
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionreturnRequest/ProductionreturnRequestMainServiceImpl.java
  61. 376
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionscrapRequest/ProductionscrapRequestMainServiceImpl.java
  62. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productreceiptJob/ProductreceiptJobMainServiceImpl.java
  63. 535
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productreceiptRecord/BackflushRecordDetailbServiceImpl.java
  64. 11
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productreceiptRecord/ProductreceiptRecordMainServiceImpl.java
  65. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanDetailService.java
  66. 32
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanDetailServiceImpl.java
  67. 9
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainServiceImpl.java
  68. 7
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereturnRequest/PurchasereturnRequestMainServiceImpl.java
  69. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/putawayJob/PutawayJobMainServiceImpl.java
  70. 175
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/repleinshJob/RepleinshJobMainServiceImpl.java
  71. 129
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/repleinshRequest/RepleinshRequestMainServiceImpl.java
  72. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleService.java
  73. 255
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java
  74. 18
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRecord/SaleShipmentMainRecordService.java
  75. 248
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRecord/SaleShipmentMainRecordServiceImpl.java
  76. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRequest/SaleShipmentMainService.java
  77. 133
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRequest/SaleShipmentMainServiceImpl.java
  78. 82
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierdeliverRequest/SupplierdeliverRequestMainServiceImpl.java
  79. 3
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierinvoiceRecord/SupplierinvoiceRecordMainServiceImpl.java
  80. 13
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierinvoiceRequest/SupplierinvoiceRequestDetailServiceImpl.java
  81. 6
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierinvoiceRequest/SupplierinvoiceRequestMainServiceImpl.java
  82. 2
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/util/RecommendedUtils.java

32
sql/release_202405/wms_202405.sql

@ -2898,10 +2898,38 @@ ALTER TABLE system_users ADD COLUMN `frozen_end_time` datetime NULL COMMENT '冻
-- 以上同步2024-09-13 17:00
-- 增加M类型采购收货记录菜单
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('M类型采购收货记录', 'wms:purchasereceipt-record-main:query', 2, 3, 2523, 'purchasereceipt-record-main-m-type', 'ep:coin', 'wms/purchasereceiptManage/purchasereceipt/purchasereceiptRecordMTypeMain/index', 'PurchasereceiptRecordMainMType', 0, b'1', b'1', b'1', '1', '2024-09-13 16:59:09', '1', '2024-09-14 10:14:51', b'0');
INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('M类型采购收货记录', 'wms:purchasereceipt-record-main:query', 2, 6, 2523, 'purchasereceipt-record-main-m-type', 'ep:coin', 'wms/purchasereceiptManage/purchasereceipt/purchasereceiptRecordMTypeMain/index', 'PurchasereceiptRecordMainMType', 0, b'1', b'1', b'1', '1', '2024-09-13 16:59:09', '1', '2024-09-14 10:14:51', b'0');
-- 增加配置自动补料针对的库区
INSERT INTO `infra_config` (`id`, `category`, `type`, `name`, `config_key`, `value`, `visible`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `item_type`, `area_type`, `inventory_status`, `location_code`) VALUES (null, '业务取值', 2, '自动补料-库区类型配置(目前超市区)', 'autoRepleinshByArea', 'autoRepleinshByArea', b'1', '', '1', '2024-09-14 10:07:32', '1', '2024-09-14 10:07:32', b'0', NULL, 'SUPPER', NULL, NULL);
-- 结算出库记录表主
ALTER TABLE record_sale_shipment_main ADD COLUMN relate_record_number VARCHAR(64) DEFAULT NULL COMMENT '关联被撤销的单据号';
ALTER TABLE record_sale_shipment_main ADD COLUMN revoke_flag VARCHAR(10) DEFAULT 'FALSE' COMMENT '撤销标志,TRUE:已撤销,FALSE:未撤销';
--
alter table `request_productionscrap_main` add `line_scrap_reason` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '报废原因';
alter table `request_productionscrap_main` add `cost_center_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '成本中心代码';
alter table `request_productionscrap_main` add `cost_center_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '成本中心类型';
alter table `request_productionscrap_main` add `reason_code_requisition` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '原因代码';
alter table `request_productionscrap_main` add `qad_ttunrcis_acc` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'QAD传输账户';
alter table request_productionscrap_detail add `single_price` decimal(18,6) DEFAULT NULL COMMENT '单价';
alter table request_productionscrap_detail add `amount` decimal(18,6) DEFAULT NULL COMMENT '金额';
alter table request_productionscrap_detail add `qad_project_code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '项目代码';
alter table request_productionscrap_detail add `qad_project_description` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '项目描述';
alter table request_productionscrap_detail add `qad_ttunrcis_acc` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '物料差异账户/成本重估账户';
alter table request_productionscrap_detail add `qad_pl_cost_center` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '账户成本中心(物料差异/废品账户/成本重估/盘点差异)';
alter table `record_productionscrap_main` add `line_scrap_reason` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '报废原因';
alter table `record_productionscrap_main` add `cost_center_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '成本中心代码';
alter table `record_productionscrap_main` add `cost_center_type` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '成本中心类型';
alter table `record_productionscrap_main` add `reason_code_requisition` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '原因代码';
alter table `record_productionscrap_main` add `qad_ttunrcis_acc` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT 'QAD传输账户';
alter table record_productionscrap_detail add `qad_project_code` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '项目代码';
alter table record_productionscrap_detail add `qad_project_description` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '项目描述';
alter table record_productionscrap_detail add `qad_ttunrcis_acc` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '物料差异账户/成本重估账户';
alter table record_productionscrap_detail add `qad_pl_cost_center` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '账户成本中心(物料差异/废品账户/成本重估/盘点差异)';
-- 以上同步2024-09-19 17:00
-- 增加业务类型配置:隔离转线边

12
win-module-qms/win-module-qms-api/src/main/java/com/win/module/qms/api/InspectionQ3/InspectionQ3Api.java

@ -0,0 +1,12 @@
package com.win.module.qms.api.InspectionQ3;
public interface InspectionQ3Api {
/**
* 校验Q3Number是否存在
* @param q3Number
* @return
*/
boolean checkInspectionQ3(String q3Number);
}

21
win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/api/InspectionQ3/InspectionQ3ApiImpl.java

@ -0,0 +1,21 @@
package com.win.module.qms.api.InspectionQ3;
import com.win.module.qms.api.InspectionQ2.InspectionQ2Api;
import com.win.module.qms.service.inspectionQ3.InspectionQ3MainService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class InspectionQ3ApiImpl implements InspectionQ3Api {
@Resource
private InspectionQ3MainService inspectionQ3MainService;
@Override
public boolean checkInspectionQ3(String q3Number) {
return inspectionQ3MainService.checkInspectionQ3(q3Number);
}
}

1
win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/inspectionQ3/InspectionQ3MainService.java

@ -71,4 +71,5 @@ public interface InspectionQ3MainService {
int finish(Long id);
boolean checkInspectionQ3(String q3Number);
}

12
win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/inspectionQ3/InspectionQ3MainServiceImpl.java

@ -3,6 +3,7 @@ package com.win.module.qms.service.inspectionQ3;
import cn.hutool.json.JSONUtil;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.qms.controller.inspectionQ3.vo.*;
@ -132,4 +133,15 @@ public class InspectionQ3MainServiceImpl implements InspectionQ3MainService {
trendsApi.createTrends(id, "inspection_q3_main", "完成了q3通知单", TrendsTypeEnum.FINISH, String.valueOf(getLoginUserId()));
return inspectionQ3MainMapper.updateById(inspectionQ3DO);
}
@Override
public boolean checkInspectionQ3(String q3Number) {
LambdaQueryWrapperX<InspectionQ3MainDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
lambdaQueryWrapperX.eq(InspectionQ3MainDO::getNumber,q3Number);
InspectionQ3MainDO inspectionQ3MainDO = inspectionQ3MainMapper.selectOne(lambdaQueryWrapperX, false);
if(inspectionQ3MainDO == null){
return true;
}
return false;
}
}

5
win-module-qms/win-module-qms-biz/src/main/java/com/win/module/qms/service/q2/InspectionQ2ServiceImpl.java

@ -97,9 +97,6 @@ public class InspectionQ2ServiceImpl implements InspectionQ2Service {
if(!fileDOList.isEmpty()){
fileName = fileDOList.get(0).getName();
}
if(pattern.matcher(fileName).find()){
fileName = System.currentTimeMillis() + fileName.substring(fileName .lastIndexOf('.'));
}
File file = new File(fileName);
FileOutputStream fos = new FileOutputStream(file);
fos.write(content);
@ -114,7 +111,7 @@ public class InspectionQ2ServiceImpl implements InspectionQ2Service {
Map<String, Object> params = new HashMap<>();
params.put("supplierName", q2.getSupplierName());
params.put("number", q2.getNumber());
params.put("claimAmount", q2.getClaimAmount().toString());
params.put("claimAmount", q2.getSummaryAmount().toString());
mailSendSingleToUserReqDTO.setTemplateParams(params);
mailSendSingleToUserReqDTO.setFiles(fileList.toArray(new File[fileList.size()]));
mailSendApi.sendSingleMailToAdmin(mailSendSingleToUserReqDTO);

3
win-module-system/win-module-system-api/src/main/java/com/win/module/system/enums/ErrorCodeConstants.java

@ -22,6 +22,8 @@ public interface ErrorCodeConstants {
ErrorCode AUTH_UUID_EMPTY_ERROR = new ErrorCode(1_002_000_011, "uuid不能为空");
ErrorCode PASSWORD_UPDATE_REMIND_ERROR = new ErrorCode(1_002_000_012, "更新预警期必须小于更新周期");
ErrorCode PASSWORD_FROZEN_ERROR = new ErrorCode(1_002_000_013, "当日密码输入错误次数过多,账号已冻结,请联系管理员解冻");
ErrorCode OLD_PASSWORD_ERROR = new ErrorCode(1_002_000_014, "旧密码错误");
ErrorCode OLD_NEW_PASSWORD_ERROR = new ErrorCode(1_002_000_015, "旧密码与新密码不能一样");
// ========== 菜单模块 1-002-001-000 ==========
ErrorCode MENU_NAME_DUPLICATE = new ErrorCode(1_002_001_000, "已经存在该名字的菜单");
@ -47,7 +49,6 @@ public interface ErrorCodeConstants {
ErrorCode USER_NOT_EXISTS = new ErrorCode(1_002_003_003, "用户不存在");
ErrorCode USER_EMAIL_NOT_EXISTS = new ErrorCode(1_002_003_009, "用户名与邮箱不匹配");
ErrorCode USER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_002_003_004, "导入用户数据不能为空!");
ErrorCode USER_PASSWORD_FAILED = new ErrorCode(1_002_003_005, "原密码错误");
ErrorCode USER_IS_DISABLE = new ErrorCode(1_002_003_006, "名字为【{}】的用户已被禁用");
ErrorCode USER_COUNT_MAX = new ErrorCode(1_002_003_008, "创建用户失败,原因:超过租户最大租户配额({})!");

2
win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/mail/MailSendServiceImpl.java

@ -125,6 +125,8 @@ public class MailSendServiceImpl implements MailSendService {
// 1. 创建发送账号
MailAccountDO account = validateMailAccount(message.getAccountId());
MailAccount mailAccount = MailAccountConvert.INSTANCE.convert(account, message.getNickname());
mailAccount.setSplitlongparameters(false);
mailAccount.setAuth(false);
// 2. 发送邮件
try {
String messageId = MailUtil.send(mailAccount, message.getMail(),

17
win-module-system/win-module-system-biz/src/main/java/com/win/module/system/service/user/AdminUserServiceImpl.java

@ -178,7 +178,7 @@ public class AdminUserServiceImpl implements AdminUserService {
public void updateUserPassword(Long id, UserProfileUpdatePasswordReqVO reqVO) {
passWordService.validateRegex(reqVO.getNewPassword());
// 校验旧密码密码
validateOldPassword(id, reqVO.getOldPassword());
validateOldPassword(id, reqVO);
// 执行更新
AdminUserDO updateObj = new AdminUserDO().setId(id);
updateObj.setPassword(encodePassword(reqVO.getNewPassword())); // 加密密码
@ -494,14 +494,16 @@ public class AdminUserServiceImpl implements AdminUserService {
* @param oldPassword
* 旧密码
*/
@VisibleForTesting
void validateOldPassword(Long id, String oldPassword) {
void validateOldPassword(Long id, UserProfileUpdatePasswordReqVO userProfileUpdatePasswordReqVO) {
AdminUserDO user = userMapper.selectById(id);
if (user == null) {
throw exception(USER_NOT_EXISTS);
}
if (!isPasswordMatch(oldPassword, user.getPassword())) {
throw exception(USER_PASSWORD_FAILED);
if (!isPasswordMatch(userProfileUpdatePasswordReqVO.getOldPassword(), user.getPassword())) {
throw exception(OLD_PASSWORD_ERROR);
}
if (Objects.equals(userProfileUpdatePasswordReqVO.getNewPassword(),userProfileUpdatePasswordReqVO.getOldPassword())) {
throw exception(OLD_NEW_PASSWORD_ERROR);
}
}
@ -608,7 +610,10 @@ public class AdminUserServiceImpl implements AdminUserService {
queryWrapper.eqIfPresent(AdminUserDO::getUsername,reqVO.getUserName());
AdminUserDO adminUserDO = userMapper.selectOne(queryWrapper);
if (!isPasswordMatch(reqVO.getOldPassword(), adminUserDO.getPassword())) {
throw exception(AUTH_LOGIN_BAD_CREDENTIALS);
throw exception(OLD_PASSWORD_ERROR);
}
if (Objects.equals(reqVO.getPassword(),reqVO.getOldPassword())) {
throw exception(OLD_NEW_PASSWORD_ERROR);
}
adminUserDO.setPassword(encodePassword(reqVO.getPassword()));
adminUserDO.setPasswordUpdateTime(LocalDateTime.now());

2
win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/DictTypeConstants.java

@ -131,7 +131,7 @@ public interface DictTypeConstants {
String SCRAPPING_REASON="scrapping_reason"; // 制品子件报废原因
String SHIFT = "shift";// 班次
String COMMON_STATUS = "common_status";// 班次
String REASON_OR_SCRAPPING_OF_PRODUCTION_LINE="Reason_or_scrapping_of_production_line"; // 线边报废原因(现场史力维护的字典)

9
win-module-wms/win-module-wms-api/src/main/java/com/win/module/wms/enums/ErrorCodeConstants.java

@ -1123,6 +1123,7 @@ public interface ErrorCodeConstants {
ErrorCode INVENTORYMOVE_RECORD_AGV_BALACNE_NOT_EXISTS = new ErrorCode(1_000_133_004, "AGV请求参数查询库存余额数据不存在");
ErrorCode INVENTORYMOVE_RECORD_AGV_POINT_NOT_EXISTS = new ErrorCode(1_000_133_004, "AGV请求参数到库位对应点位未作配置,库位地址:{}");
ErrorCode INVENTORYMOVE_RECORD_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_133_005, "导入库存移动记录不能为空");
ErrorCode INVENTORYMOVE_RECORD_IMPORT_MODE_NOT_SUPPORT = new ErrorCode(1_000_133_005, "导入库存移动记录暂不支持从批次到包装");
ErrorCode INVENTORYMOVE_RECORD_DETAIL_TOLOCATION_NOT_PACK_EXISTS = new ErrorCode(1_000_133_006, "到库位:【{}】 必须要有包装号");
ErrorCode INVENTORYMOVE_RECORD_DETAIL_TOPACK_BALANCE_EXISTS = new ErrorCode(1_000_133_007, "到包装号:【{}】 库存已存在 请换其他包装号");
@ -1608,6 +1609,7 @@ public interface ErrorCodeConstants {
ErrorCode SALE_SHIPMENT_MAIN_REQUEST_CANNOT_SUBMIT = new ErrorCode(1_000 - 326_004, "结算出库状态不支持提交");
ErrorCode SALE_SHIPMENT_MAIN_REQUEST_CANNOT_AGREE = new ErrorCode(1_000 - 326_005, "结算出库状态不支持审批同意");
ErrorCode SALE_SHIPMENT_MAIN_REQUEST_CANNOT_HANDLE = new ErrorCode(1_000 - 326_006, "结算出库状态不支持处理");
ErrorCode SALE_SHIPMENT_MAIN_REQUEST_AGREE_LOCK = new ErrorCode(1_000 - 326_006, "结算出库审批正在处理中");
ErrorCode SALE_SHIPMENT_MAIN_REQUEST_CANNOT_REFUSED = new ErrorCode(1_000 - 326_007, "结算出库状态不支持审批拒绝");
ErrorCode SALE_SHIPMENT_MAIN_REQUEST_CANNOT_RE_ADD = new ErrorCode(1_000 - 326_007, "结算出库状态不支持重新添加");
ErrorCode SALE_SHIPMENT_MAIN_REQUEST_CANNOT_ABORT = new ErrorCode(1_000 - 326_010, "结算出库状态不支持终止");
@ -1617,7 +1619,10 @@ public interface ErrorCodeConstants {
ErrorCode INVOICINGCALENDAR_NOT_EXISTS = new ErrorCode(1_000_328_001, "开票日历不存在");
ErrorCode INVOICINGCALENDAR_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_000_328_001, "开票日历导入列表不存在");
// 结算出库记录主
ErrorCode SALE_SHIPMENT_MAIN_RECORD_LOCK = new ErrorCode(1_000_328_000, "结算出库记录正在执行撤销操作");
ErrorCode SALE_SHIPMENT_MAIN_RECORD_NOT_EXISTS = new ErrorCode(1_000_328_000, "结算出库记录主不存在");
ErrorCode SALE_SHIPMENT_MAIN_RECORD_CANNOT_ABORT = new ErrorCode(1_000 - 326_010, "结算出库记录状态不支持撤销");
// 结算出库记录子
ErrorCode SALE_SHIPMENT_DETAIL_RECORD_NOT_EXISTS = new ErrorCode(1_000_329_000, "结算出库记录子不存在");
// 器具管理申请主
@ -1771,4 +1776,8 @@ public interface ErrorCodeConstants {
ErrorCode PLEASE_DO_NOT_RESUBMIT_SECONDS = new ErrorCode(1_000_349_000, "【{}】秒内,请勿重复提交");
ErrorCode PURCHASE_PLAN_DELIVERYDATE_NOT_NULL = new ErrorCode(1_000_069_000, "所选要货计划送达日期不能为空");
ErrorCode PURCHASE_PLAN_DELIVERYDATE_NOT_MIN = new ErrorCode(1_000_368_004, "【{}】不是送达日期最小的要货计划,请重新选择要货计划号:【{}】,送达日期:【{}】的要货计划");
}

14
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/balance/BalanceController.java

@ -454,6 +454,13 @@ public class BalanceController {
// 后端创建个字段作为前端展示的虚拟字段
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
if(vo.getItemCode() != null){
ItembasicDO itembasicDO = itembasicMapper.selectByCode(vo.getItemCode());
vo.setItemDesc1(itembasicDO.getDesc1());
vo.setItemDesc2(itembasicDO.getDesc2());
vo.setItemName(itembasicDO.getName());
vo.setItemType(itembasicDO.getType());
}
}
return success(balanceRespVOPageResult);
}
@ -466,6 +473,13 @@ public class BalanceController {
for (BalanceRespVO vo : result.getList()) {
// 后端创建个字段作为前端展示的虚拟字段
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
if(vo.getItemCode() != null){
ItembasicDO itembasicDO = itembasicMapper.selectByCode(vo.getItemCode());
vo.setItemDesc1(itembasicDO.getDesc1());
vo.setItemDesc2(itembasicDO.getDesc2());
vo.setItemName(itembasicDO.getName());
vo.setItemType(itembasicDO.getType());
}
}
return success(result);
}

9
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/countJob/CountJobMainController.java

@ -281,7 +281,14 @@ public class CountJobMainController {
String result = countJobMainService.validateAndExecuteCountJobMain(updateReqVO);
return success(result);
}
@PutMapping("/validateItem")
@Operation(summary = "物料校验")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('wms:count-job-main:execute')")
public CommonResult validateItem(@Valid @RequestBody CountJobMainUpdateReqVO updateReqVO) {
countJobMainService.validateItem(updateReqVO);
return success(null);
}
@PutMapping(value = "/finish")
@Operation(summary = "完成任务")
@PreAuthorize("@ss.hasPermission('wms:count-job-main:close')")

32
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/customerreturnRecord/CustomerreturnRecordDetailController.java

@ -115,13 +115,15 @@ public class CustomerreturnRecordDetailController {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
CustomerreturnRecordMainDO customerreturnRecordMainDO = mainMap.get(vo.getMasterId());
customerreturnRecordMainDO.setId(null);
customerreturnRecordMainDO.setCreator(null);
customerreturnRecordMainDO.setCreateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setRemark(null);
BeanUtil.copyProperties(customerreturnRecordMainDO,vo,options);
if(customerreturnRecordMainDO != null){
customerreturnRecordMainDO.setId(null);
customerreturnRecordMainDO.setCreator(null);
customerreturnRecordMainDO.setCreateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setRemark(null);
BeanUtil.copyProperties(customerreturnRecordMainDO,vo,options);
}
ItemareaDO itemareaDO = jobUtils.getItemareaDOByLocationCodeToIssue(vo.getItemCode(),vo.getToLocationCode());
if(itemareaDO != null){
vo.setPackUnit(itemareaDO.getInPackUnit());
@ -151,13 +153,15 @@ public class CustomerreturnRecordDetailController {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
CustomerreturnRecordMainDO customerreturnRecordMainDO = mainMap.get(vo.getMasterId());
customerreturnRecordMainDO.setId(null);
customerreturnRecordMainDO.setCreator(null);
customerreturnRecordMainDO.setCreateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setRemark(null);
BeanUtil.copyProperties(customerreturnRecordMainDO,vo,options);
if(customerreturnRecordMainDO != null){
customerreturnRecordMainDO.setId(null);
customerreturnRecordMainDO.setCreator(null);
customerreturnRecordMainDO.setCreateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setUpdateTime(null);
customerreturnRecordMainDO.setRemark(null);
BeanUtil.copyProperties(customerreturnRecordMainDO,vo,options);
}
ItemareaDO itemareaDO = jobUtils.getItemareaDOByLocationCodeToIssue(vo.getItemCode(),vo.getToLocationCode());
if(itemareaDO != null){
vo.setPackUnit(itemareaDO.getInPackUnit());

71
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/location/LocationController.java

@ -1,39 +1,14 @@
package com.win.module.wms.controller.location;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static com.win.module.wms.enums.ErrorCodeConstants.*;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.module.wms.dal.dataobject.balance.BalanceDO;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import com.win.module.wms.dal.mysql.expectin.ExpectinMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.dict.core.util.DictFrameworkUtils;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.system.api.user.dto.AdminUserRespDTO;
@ -42,21 +17,43 @@ import com.win.module.wms.controller.location.vo.*;
import com.win.module.wms.controller.rule.vo.RuleRespVO;
import com.win.module.wms.convert.location.LocationConvert;
import com.win.module.wms.dal.dataobject.areabasic.AreabasicDO;
import com.win.module.wms.dal.dataobject.balance.BalanceDO;
import com.win.module.wms.dal.dataobject.expectin.ExpectinDO;
import com.win.module.wms.dal.dataobject.location.LocationDO;
import com.win.module.wms.dal.mysql.areabasic.AreabasicMapper;
import com.win.module.wms.dal.mysql.balance.BalanceMapper;
import com.win.module.wms.dal.mysql.expectin.ExpectinMapper;
import com.win.module.wms.dal.mysql.expectout.ExpectoutMapper;
import com.win.module.wms.dal.mysql.location.LocationMapper;
import com.win.module.wms.enums.DictTypeConstants;
import com.win.module.wms.service.location.LocationService;
import com.win.module.wms.service.rule.RuleService;
import com.win.module.wms.util.JobUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static com.win.module.wms.enums.ErrorCodeConstants.*;
@Slf4j
@Tag(name = "管理后台 - 库位")
@ -513,7 +510,16 @@ public class LocationController {
@PostMapping("/pageBusinessTypeToLocationSenior")
@Operation(summary = "高级搜索获得业务类型筛选出的库位分页")
public CommonResult<PageResult<LocationRespVO>> selectBusinessTypeToLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<LocationDO> pageResult = locationService.selectBusinessTypeLocationSenior(conditions, Boolean.TRUE);
List<CustomConditions.Condition> conditionList = conditions.getFilters();
Boolean flag = false;
for (CustomConditions.Condition loop : conditionList){
if(loop.getColumn().equals("isIn")){
if("in".equals(loop.getValue())){
flag = true;
}
}
}
PageResult<LocationDO> pageResult = locationService.selectBusinessTypeLocationSenior(conditions, flag);
PageResult<LocationRespVO> result = LocationConvert.INSTANCE.convertPage(pageResult);
for (LocationRespVO vo : result.getList()) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));
@ -540,7 +546,14 @@ public class LocationController {
@PostMapping("/pageBusinessTypeOutLocationSenior")
@Operation(summary = "高级搜索获得业务类型筛选出的库位分页")
public CommonResult<PageResult<LocationRespVO>> selectBusinessTypeOutLocationSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<LocationDO> pageResult = locationService.selectBusinessTypeLocationSenior(conditions, Boolean.FALSE);
Boolean flag = false;
for (CustomConditions.Condition condition : conditions.getFilters()) {
String column = condition.getColumn();
if("isIn".equals(column)){
flag = "in".equals(condition.getValue());
}
}
PageResult<LocationDO> pageResult = locationService.selectBusinessTypeLocationSenior(conditions,flag);
PageResult<LocationRespVO> result = LocationConvert.INSTANCE.convertPage(pageResult);
for (LocationRespVO vo : result.getList()) {
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator()));

14
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/ProductionscrapRecordDetailController.java

@ -19,7 +19,6 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -28,6 +27,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
@ -104,6 +104,12 @@ public class ProductionscrapRecordDetailController {
productionscrapRecordMainDO.setRemark(null);
BeanUtil.copyProperties(productionscrapRecordMainDO,vo,options);
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
}
}
return success(result);
@ -134,6 +140,12 @@ public class ProductionscrapRecordDetailController {
productionscrapRecordMainDO.setRemark(null);
BeanUtil.copyProperties(productionscrapRecordMainDO,vo,options);
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
}
}
return success(result);

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/ProductionscrapRecordMainController.java

@ -30,6 +30,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
@ -140,6 +141,12 @@ public class ProductionscrapRecordMainController {
ProductionscrapRecordMainDO mainDO = mainMap.get(detailDO.getMasterId());
ProductionscrapRecordMainExcelVO convert = ProductionreturnRecordMainConvert.INSTANCE.convertExport(mainDO, detailDO);
convert.setCreator(userApi.getUserNickname(convert.getCreator(),true));
if(convert.getSinglePrice() != null){
convert.setSinglePrice(convert.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(convert.getAmount() != null){
convert.setAmount(convert.getAmount().setScale(2, RoundingMode.HALF_UP));
}
datas.add(convert);
}
}

12
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordDetailBaseVO.java

@ -110,4 +110,16 @@ public class ProductionscrapRecordDetailBaseVO {
@Schema(description = "金额")
private BigDecimal amount;
@Schema(description = "项目代码")
private String qadProjectCode;
@Schema(description = "项目描述")
private String qadProjectDescription;
@Schema(description = "物料差异账户/成本重估账户")
private String qadTtunrcisAcc;
@Schema(description = "账户成本中心(物料差异/废品账户/成本重估/盘点差异)")
private String qadPlCostCenter;
}

25
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordDetailRespVO.java

@ -144,4 +144,29 @@ public class ProductionscrapRecordDetailRespVO extends ProductionscrapRecordDeta
* 金额
*/
private BigDecimal amount;
/**
* 报废原因
*/
private String lineScrapReason;
/**
* 成本中心代码
*/
private String costCenterCode;
/**
* 成本中心类型
*/
private String costCenterType;
/**
* 原因代码
*/
private String reasonCodeRequisition;
/**
* QAD传输账户
*/
private String qadTtunrcisAcc;
}

14
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordMainBaseVO.java

@ -100,4 +100,18 @@ public class ProductionscrapRecordMainBaseVO {
@Schema(description = "到库区代码范围")
private String toAreaCodes;
@Schema(description = "报废原因")
private String lineScrapReason;
@Schema(description = "成本中心代码")
private String costCenterCode;
@Schema(description = "成本中心类型")
private String costCenterType;
@Schema(description = "原因代码")
private String reasonCodeRequisition;
@Schema(description = "QAD传输账户")
private String qadTtunrcisAcc;
}

32
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRecord/vo/ProductionscrapRecordMainExcelVO.java

@ -9,6 +9,7 @@ import com.win.module.wms.enums.DictTypeConstants;
import lombok.Data;
import org.apache.poi.ss.usermodel.IndexedColors;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
@ -23,16 +24,34 @@ public class ProductionscrapRecordMainExcelVO {
@Colour(IndexedColors.LIGHT_YELLOW)
private String number;
@ExcelProperty("申请单号")
@ColumnWidth(value = 16)
@Colour(IndexedColors.LIGHT_YELLOW)
private String requestNumber;
@ExcelProperty("Q3通知单编号")
@Colour(IndexedColors.LIGHT_YELLOW)
private String q3Number;
@ExcelProperty(value = "报废原因",converter = DictConvert.class)
@Colour(IndexedColors.LIGHT_YELLOW)
@DictFormat(DictTypeConstants.REASON_OR_SCRAPPING_OF_PRODUCTION_LINE)
private String lineScrapReason;
@ExcelProperty("成本中心代码")
@Colour(IndexedColors.LIGHT_YELLOW)
private String costCenterCode;
@ExcelProperty("原因代码")
@Colour(IndexedColors.LIGHT_YELLOW)
private String reasonCodeRequisition;
@ExcelProperty("车间代码")
@Colour(IndexedColors.LIGHT_YELLOW)
private String workshopCode;
@ExcelProperty("生产线代码")
@Colour(IndexedColors.LIGHT_YELLOW)
private String productionLineCode;
@ExcelProperty("工位代码")
@ -58,11 +77,14 @@ public class ProductionscrapRecordMainExcelVO {
@ExcelProperty("从库位代码")
private String fromLocationCode;
@ExcelProperty("到库位代码")
private String toLocationCode;
@ExcelProperty("单价")
private BigDecimal singlePrice;
@ExcelProperty("Q3通知单编号")
private String q3Number;
@ExcelProperty("金额")
private BigDecimal amount;
@ExcelProperty("项目代码")
private String projectCode;
@ExcelProperty("创建人")
private String creator;

13
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/ProductionscrapRequestDetailController.java

@ -27,6 +27,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
@ -103,6 +104,12 @@ public class ProductionscrapRequestDetailController {
productionscrapRequestMainDO.setUpdater(null);
BeanUtil.copyProperties(productionscrapRequestMainDO,vo,options);
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
}
}
return success(result);
@ -133,6 +140,12 @@ public class ProductionscrapRequestDetailController {
productionscrapRequestMainDO.setUpdater(null);
BeanUtil.copyProperties(productionscrapRequestMainDO,vo,options);
}
if(vo.getSinglePrice() != null){
vo.setSinglePrice(vo.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(vo.getAmount() != null){
vo.setAmount(vo.getAmount().setScale(2, RoundingMode.HALF_UP));
}
}
}
return success(result);

4
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/ProductionscrapRequestMainController.java

@ -12,6 +12,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.win.framework.dict.core.util.DictFrameworkUtils;
import com.win.module.wms.enums.DictTypeConstants;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.CollectionUtils;
@ -143,6 +145,8 @@ public class ProductionscrapRequestMainController {
public void importTemplate(HttpServletResponse response) throws IOException {
List<ProductionscrapRequestImportVO> list = Arrays.asList();
Map<Integer, String[]> mapDropDown = new HashMap<>();
String[] reason_or_scrapping_of_production_line = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.REASON_OR_SCRAPPING_OF_PRODUCTION_LINE);
mapDropDown.put(2,reason_or_scrapping_of_production_line);
// 输出
ExcelUtils.write(response, "线边原料报废主基本信息导入模板.xls", "线边原料报废主基本信息列表", ProductionscrapRequestImportVO.class, list, mapDropDown);
}

17
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestDetailBaseVO.java

@ -82,4 +82,21 @@ public class ProductionscrapRequestDetailBaseVO {
@Schema(description = "并发乐观锁", requiredMode = Schema.RequiredMode.REQUIRED)
private Integer concurrencyStamp;
@Schema(description = "单价")
private BigDecimal singlePrice;
@Schema(description = "金额")
private BigDecimal amount;
@Schema(description = "项目代码")
private String qadProjectCode;
@Schema(description = "项目描述")
private String qadProjectDescription;
@Schema(description = "物料差异账户/成本重估账户")
private String qadTtunrcisAcc;
@Schema(description = "账户成本中心(物料差异/废品账户/成本重估/盘点差异)")
private String qadPlCostCenter;
}

26
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestDetailRespVO.java

@ -137,4 +137,30 @@ public class ProductionscrapRequestDetailRespVO extends ProductionscrapRequestDe
* 子表ID
*/
private Long detailId;
/**
* 报废原因
*/
private String lineScrapReason;
/**
* 成本中心代码
*/
private String costCenterCode;
/**
* 成本中心类型
*/
private String costCenterType;
/**
* 原因代码
*/
private String reasonCodeRequisition;
/**
* QAD传输账户
*/
private String qadTtunrcisAcc;
}

30
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestImportVO.java

@ -2,7 +2,10 @@ package com.win.module.wms.controller.productionscrapRequest.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.win.framework.excel.core.annotations.Colour;
import com.win.framework.excel.core.annotations.DictFormat;
import com.win.framework.excel.core.annotations.ExcelValid;
import com.win.framework.excel.core.convert.DictConvert;
import com.win.module.wms.enums.DictTypeConstants;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -29,16 +32,32 @@ public class ProductionscrapRequestImportVO {
@Colour(IndexedColors.LIGHT_YELLOW)
private String q3Number;
@ExcelProperty(value = "报废原因",converter = DictConvert.class)
@ExcelValid(message = "必填")
@DictFormat(DictTypeConstants.REASON_OR_SCRAPPING_OF_PRODUCTION_LINE)
@Colour(IndexedColors.LIGHT_YELLOW)
private String lineScrapReason;
@ExcelProperty("成本中心代码")
@ExcelValid(message = "必填")
@Colour(IndexedColors.LIGHT_YELLOW)
private String costCenterCode;
@ExcelProperty("原因代码")
@ExcelValid(message = "必填")
@Colour(IndexedColors.LIGHT_YELLOW)
private String reasonCodeRequisition;
@ExcelProperty("车间代码")
@ExcelValid(message = "必填")
@Colour(IndexedColors.LIGHT_YELLOW)
private String workshopCode;
//子表
@ExcelProperty("生产线代码")
@ExcelValid(message = "必填")
@Colour(IndexedColors.LIGHT_YELLOW)
private String productionLineCode;
//子表
@ExcelProperty("工位代码")
@ExcelValid(message = "必填")
private String workStationCode;
@ -51,12 +70,11 @@ public class ProductionscrapRequestImportVO {
@ExcelValid(message = "必填")
private String qty;
// @ExcelProperty("包装规格")
// @ExcelValid(message = "必填")
// private String packUnit;
@ExcelProperty("批次")
@ExcelValid(message = "必填 库存余额中无批次的可输入000000")
private String batch;
@ExcelProperty("项目代码")
private String project;
}

15
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestMainBaseVO.java

@ -101,4 +101,19 @@ public class ProductionscrapRequestMainBaseVO {
@Schema(description = "出库库存状态范围")
private String outInventoryStatuses;
@Schema(description = "报废原因")
private String lineScrapReason;
@Schema(description = "成本中心代码")
private String costCenterCode;
@Schema(description = "成本中心类型")
private String costCenterType;
@Schema(description = "原因代码")
private String reasonCodeRequisition;
@Schema(description = "QAD传输账户")
private String qadTtunrcisAcc;
}

55
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestMainExcelVO.java

@ -2,6 +2,9 @@ package com.win.module.wms.controller.productionscrapRequest.vo;
import java.time.LocalDateTime;
import com.win.framework.excel.core.annotations.DictFormat;
import com.win.framework.excel.core.convert.DictConvert;
import com.win.module.wms.enums.DictTypeConstants;
import org.apache.poi.ss.usermodel.IndexedColors;
import com.alibaba.excel.annotation.ExcelProperty;
@ -24,16 +27,34 @@ public class ProductionscrapRequestMainExcelVO {
@Colour(IndexedColors.LIGHT_YELLOW)
private String number;
@ExcelProperty("Q3通知单编号")
@Colour(IndexedColors.LIGHT_YELLOW)
private String q3Number;
@ExcelProperty(value = "报废原因",converter = DictConvert.class)
@DictFormat(DictTypeConstants.REASON_OR_SCRAPPING_OF_PRODUCTION_LINE)
@Colour(IndexedColors.LIGHT_YELLOW)
private String lineScrapReason;
@ExcelProperty("成本中心代码")
@Colour(IndexedColors.LIGHT_YELLOW)
private String costCenterCode;
@ExcelProperty("原因代码")
@Colour(IndexedColors.LIGHT_YELLOW)
private String reasonCodeRequisition;
@ExcelProperty("车间代码")
@ExcelValid(message = "必填")
@Colour(IndexedColors.LIGHT_YELLOW)
private String workshopCode;
// 子表
@ExcelProperty("生产线代码")
@ExcelValid(message = "必填")
@Colour(IndexedColors.LIGHT_YELLOW)
private String productionLineCode;
// 子表
@ExcelProperty("工位代码")
@ExcelValid(message = "必填")
private String workStationCode;
@ -42,27 +63,37 @@ public class ProductionscrapRequestMainExcelVO {
@ExcelValid(message = "必填")
private String itemCode;
@ExcelProperty("数量")
@ExcelProperty("物料名称")
@ExcelValid(message = "必填")
private String qty;
@ExcelProperty("包装规格")
@ExcelValid(message = "必填")
private String packUnit;
private String itemName;
@ExcelProperty("批次")
@ExcelValid(message = "必填 库存余额中无批次的可输入000000")
private String batch;
@ExcelProperty("Q3通知单编号")
private String q3Number;
@ExcelProperty("数量")
private String qty;
@ExcelProperty("创建时间")
@ColumnWidth(value = 16)
private LocalDateTime createTime;
@ExcelProperty(value = "计量单位", converter = DictConvert.class)
@DictFormat(DictTypeConstants.UOM)
private String uom;
@ExcelProperty(value = "库存状态",converter = DictConvert.class)
@DictFormat(DictTypeConstants.INVENTORY_STATUS)
private String inventoryStatus;
@ExcelProperty("来源库位")
private String fromLocationCode;
@ExcelProperty("项目代码")
private String projectCode;
@ExcelProperty("创建者名称")
@ColumnWidth(value = 16)
private String creator;
@ExcelProperty("创建时间")
@ColumnWidth(value = 16)
private LocalDateTime createTime;
}

5
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/productionscrapRequest/vo/ProductionscrapRequestMainUpdateReqVO.java

@ -15,4 +15,9 @@ public class ProductionscrapRequestMainUpdateReqVO extends ProductionscrapReques
@NotNull(message = "id不能为空")
private Long id;
/**
* 生产线代码
*/
private String productionLineCode;
}

104
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/purchasePlan/PurchasePlanDetailController.java

@ -130,14 +130,6 @@ public class PurchasePlanDetailController {
vo.setAllowOverShipment("TRUE");
}
}
if("1".equals(pageVO.getIsAll())){//0只查询当前要货计划明细1查询当前计划+采购订单多出的超发物料
list = purchaseDetailDOS.stream().filter(//newList 将包含 subDOList 中那些在 historySubDOList 中没有匹配的元素。
item1 -> result.getList().stream().noneMatch(item2 ->
Objects.equals(item1.getItemCode(), item2.getItemCode())
&& Objects.equals(item1.getNumber(), item2.getPoNumber()))).collect(Collectors.toList()
);
}
}
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
@ -148,6 +140,7 @@ public class PurchasePlanDetailController {
purchasePlanMainDO.setUpdater(null);
purchasePlanMainDO.setUpdateTime(null);
purchasePlanMainDO.setRemark(null);
purchasePlanMainDO.setAvailable(null);
BeanUtil.copyProperties(purchasePlanMainDO,vo,options);
BigDecimal receivedQty = vo.getReceivedQty()==null?BigDecimal.ZERO:vo.getReceivedQty();//已收货数量
BigDecimal shippedQty = vo.getShippedQty()==null?BigDecimal.ZERO:vo.getShippedQty();//已发货数量
@ -160,44 +153,6 @@ public class PurchasePlanDetailController {
LocalDateTime minProduceDate = supplierdeliverRequestDetailService.getMaxProduceDate(purchasePlanMainDO.getSupplierCode(), vo.getItemCode());
vo.setMinProduceDate(minProduceDate);
}
if(!list.isEmpty()){//日程单添加要货计划没有且采购与订单有的超发物料
long conunt =1L;
for(PurchaseDetailDO li:list){
conunt++;
PurchasePlanDetailRespVO purchasePlanDetailRespVO = new PurchasePlanDetailRespVO();
purchasePlanDetailRespVO.setId(conunt);
purchasePlanDetailRespVO.setAllowOverShipment("TRUE");
purchasePlanDetailRespVO.setPoLine(li.getLineNumber());
purchasePlanDetailRespVO.setPoNumber(li.getNumber());
purchasePlanDetailRespVO.setMasterId(chaofa.getMasterId());
purchasePlanDetailRespVO.setNumber(chaofa.getNumber());
purchasePlanDetailRespVO.setItemCode(li.getItemCode());
purchasePlanDetailRespVO.setPlanQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setUom(li.getUom());
purchasePlanDetailRespVO.setAvailable("TRUE");
purchasePlanDetailRespVO.setOrderQty(li.getOrderQty());
purchasePlanDetailRespVO.setShippedQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setReceivedQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setNotReceiveQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setDepartmentCode(chaofa.getDepartmentCode());
purchasePlanDetailRespVO.setCreator(chaofa.getCreator());
purchasePlanDetailRespVO.setSupplierCode(chaofa.getSupplierCode());
purchasePlanDetailRespVO.setWarehouseCode(chaofa.getWarehouseCode());
purchasePlanDetailRespVO.setDockCode(chaofa.getDockCode());
purchasePlanDetailRespVO.setBusinessType(chaofa.getBusinessType());
purchasePlanDetailRespVO.setBeginTime(chaofa.getBeginTime());
purchasePlanDetailRespVO.setEndTime(chaofa.getEndTime());
purchasePlanDetailRespVO.setStatus(chaofa.getStatus());
purchasePlanDetailRespVO.setAutoAccept(chaofa.getAutoAccept());
purchasePlanDetailRespVO.setAutoPublish(chaofa.getAutoPublish());
purchasePlanDetailRespVO.setDeliveryDate(chaofa.getDeliveryDate());
purchasePlanDetailRespVO.setContacts(chaofa.getContacts());
purchasePlanDetailRespVO.setPhone(chaofa.getPhone());
purchasePlanDetailRespVO.setType(chaofa.getType());
result.getList().add(purchasePlanDetailRespVO);
}
result.setTotal((long) result.getList().size());
}
Collections.sort(result.getList(), Comparator.comparing(PurchasePlanDetailRespVO::getDeliveryDateSort, Comparator.nullsLast(Comparator.naturalOrder()))
.thenComparing(Comparator.comparing(PurchasePlanDetailRespVO::getSupplierCode, Comparator.nullsLast(Comparator.naturalOrder()))
.thenComparing( Comparator.comparing(PurchasePlanDetailRespVO::getItemCode, Comparator.nullsLast(Comparator.naturalOrder())))));
@ -243,8 +198,6 @@ public class PurchasePlanDetailController {
for(CustomConditions.Condition li:conditionList){
if(li.getColumn().equals("flag") && li.getValue().equals("1")){//发货申请筛选
flag = true;
li.setColumn("available");
li.setValue("TRUE");
}
if(li.getColumn().equals("isAll")){//0只查询当前要货计划明细1查询当前计划+采购订单多出的超发物料
isAll = li.getValue();
@ -280,13 +233,6 @@ public class PurchasePlanDetailController {
vo.setAllowOverShipment("TRUE");
}
}
if("1".equals(isAll)){//0只查询当前要货计划明细1查询当前计划+采购订单多出的超发物料
list = purchaseDetailDOS.stream().filter(//newList 将包含 subDOList 中那些在 historySubDOList 中没有匹配的元素。
item1 -> result.getList().stream().noneMatch(item2 ->
Objects.equals(item1.getItemCode(), item2.getItemCode())
&& Objects.equals(item1.getNumber(), item2.getPoNumber()))).collect(Collectors.toList()
);
}
}
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
@ -309,44 +255,6 @@ public class PurchasePlanDetailController {
LocalDateTime minProduceDate = supplierdeliverRequestDetailService.getMaxProduceDate(purchasePlanMainDO.getSupplierCode(), vo.getItemCode());
vo.setMinProduceDate(minProduceDate);
}
if(!list.isEmpty()){//日程单添加要货计划没有且采购与订单有的超发物料
long conunt =1L;
for(PurchaseDetailDO li:list){
conunt++;
PurchasePlanDetailRespVO purchasePlanDetailRespVO = new PurchasePlanDetailRespVO();
purchasePlanDetailRespVO.setId(conunt);
purchasePlanDetailRespVO.setAllowOverShipment("TRUE");
purchasePlanDetailRespVO.setPoLine(li.getLineNumber());
purchasePlanDetailRespVO.setPoNumber(li.getNumber());
purchasePlanDetailRespVO.setMasterId(chaofa.getMasterId());
purchasePlanDetailRespVO.setNumber(chaofa.getNumber());
purchasePlanDetailRespVO.setItemCode(li.getItemCode());
purchasePlanDetailRespVO.setPlanQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setUom(li.getUom());
purchasePlanDetailRespVO.setAvailable("TRUE");
purchasePlanDetailRespVO.setOrderQty(li.getOrderQty());
purchasePlanDetailRespVO.setShippedQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setReceivedQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setNotReceiveQty(BigDecimal.ZERO);
purchasePlanDetailRespVO.setDepartmentCode(chaofa.getDepartmentCode());
purchasePlanDetailRespVO.setCreator(chaofa.getCreator());
purchasePlanDetailRespVO.setSupplierCode(chaofa.getSupplierCode());
purchasePlanDetailRespVO.setWarehouseCode(chaofa.getWarehouseCode());
purchasePlanDetailRespVO.setDockCode(chaofa.getDockCode());
purchasePlanDetailRespVO.setBusinessType(chaofa.getBusinessType());
purchasePlanDetailRespVO.setBeginTime(chaofa.getBeginTime());
purchasePlanDetailRespVO.setEndTime(chaofa.getEndTime());
purchasePlanDetailRespVO.setStatus(chaofa.getStatus());
purchasePlanDetailRespVO.setAutoAccept(chaofa.getAutoAccept());
purchasePlanDetailRespVO.setAutoPublish(chaofa.getAutoPublish());
purchasePlanDetailRespVO.setDeliveryDate(chaofa.getDeliveryDate());
purchasePlanDetailRespVO.setContacts(chaofa.getContacts());
purchasePlanDetailRespVO.setPhone(chaofa.getPhone());
purchasePlanDetailRespVO.setType(chaofa.getType());
result.getList().add(purchasePlanDetailRespVO);
}
result.setTotal((long) result.getList().size());
}
Collections.sort(result.getList(), Comparator.comparing(PurchasePlanDetailRespVO::getDeliveryDateSort, Comparator.nullsLast(Comparator.naturalOrder()))
.thenComparing(Comparator.comparing(PurchasePlanDetailRespVO::getSupplierCode, Comparator.nullsLast(Comparator.naturalOrder()))
.thenComparing( Comparator.comparing(PurchasePlanDetailRespVO::getItemCode, Comparator.nullsLast(Comparator.naturalOrder())))));
@ -499,7 +407,7 @@ public class PurchasePlanDetailController {
if("SCHEDULE".equals(purchaseMainDO.getType())){//日程说明是添加发货申请时查询的要货计划子明细,日程订单需要提供要货计划没有且采购订单有的超发物料展示
QueryWrapper<PurchaseDetailDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("number",poNumber);
queryWrapper.inSql("item_code","select d.item_code from basic_supplieritem d where d.deleted = 0 and d.supplier_code = '"+purchaseMainDO.getSupplierCode()+"' and d.allow_over_shipment = 'TRUE'");
queryWrapper.inSql("item_code","select d.item_code from basic_supplieritem d where d.deleted = 0 and d.supplier_code = '"+purchaseMainDO.getSupplierCode()+"' and d.allow_over_shipment = 'TRUE' and item_code not in (select item_code from plan_purchase_detail where available = 'FALSE' and number = '"+pageVO.getNumber()+"' )");
purchaseDetailDOS = purchaseDetailMapper.selectList(queryWrapper);
}
for(PurchasePlanDetailRespVO vo : result.getList()) {
@ -597,6 +505,7 @@ public class PurchasePlanDetailController {
@Operation(summary = "供应商发货申请点击明细高级搜索获得要货计划子+超发的信息分页")
public CommonResult<PageResult<PurchasePlanDetailRespVO>> clickDetailsSenior(@Valid @RequestBody CustomConditions conditions) {
Boolean flag = false;
String number = "";//要货计划单号
Boolean shaixuan = false;
String poLine = "";//订单行
String itemCode = "";//物料代码
@ -634,8 +543,6 @@ public class PurchasePlanDetailController {
for(CustomConditions.Condition li:conditionList){
if(li.getColumn().equals("flag") && li.getValue().equals("1")){//发货申请筛选
flag = true;
li.setColumn("available");
li.setValue("TRUE");
}
if(li.getColumn().equals("isAll")){//0只查询当前要货计划明细1查询当前计划+采购订单多出的超发物料
isAll = li.getValue();
@ -680,6 +587,9 @@ public class PurchasePlanDetailController {
if(li.getColumn().equals("uom")){//单位
orderQty = li.getValue();
}
if(li.getColumn().equals("number")){//要货计划单号
number = li.getValue();
}
}
CustomConditions conditions1 = new CustomConditions();
BeanUtils.copyProperties(conditions, conditions1);
@ -736,7 +646,7 @@ public class PurchasePlanDetailController {
if(!"".equals(uom)){
queryWrapper1.eq("uom",uom);
}
queryWrapper1.inSql("item_code","select d.item_code from basic_supplieritem d where d.deleted = 0 and d.supplier_code = '"+purchaseMainDO.getSupplierCode()+"' and d.allow_over_shipment = 'TRUE'");
queryWrapper1.inSql("item_code","select d.item_code from basic_supplieritem d where d.deleted = 0 and d.supplier_code = '"+purchaseMainDO.getSupplierCode()+"' and d.allow_over_shipment = 'TRUE' and item_code not in (select item_code from plan_purchase_detail where available = 'FALSE' and number = '"+number+"' )");
purchaseDetailDOS = purchaseDetailMapper.selectList(queryWrapper1);
}
for(PurchasePlanDetailRespVO vo : result.getList()) {

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/purchasereturnRequest/vo/PurchasereturnRequestMainPrintVO.java

@ -70,6 +70,12 @@ public class PurchasereturnRequestMainPrintVO extends PurchasereturnRequestMainB
private String email;
//申请单号
private String RequestNumber;
private String nameZW;
private String nameYW;
/**
* 租户编号
*/
private String tenantId;
}

5
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/putawayJob/vo/PutawayJobMainBatchReqVO.java

@ -12,4 +12,9 @@ public class PutawayJobMainBatchReqVO {
*/
private List<String> jobNumberList;
/**
* 到库位代码
*/
private String toLocationCode;
}

17
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/rule/RuleController.java

@ -7,10 +7,12 @@ import com.win.framework.dict.core.util.DictFrameworkUtils;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.wms.controller.location.vo.LocationRespVO;
import com.win.module.wms.controller.rule.vo.*;
import com.win.module.wms.convert.rule.RuleConvert;
import com.win.module.wms.dal.dataobject.rule.RuleDO;
import com.win.module.wms.enums.DictTypeConstants;
import com.win.module.wms.service.location.LocationService;
import com.win.module.wms.service.rule.RuleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -27,10 +29,8 @@ import javax.validation.Valid;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -47,6 +47,9 @@ public class RuleController {
@Resource
private AdminUserApi userApi;
@Resource
private LocationService locationService;
@PostMapping("/create")
@Operation(summary = "创建规则")
@PreAuthorize("@ss.hasPermission('wms:rule:create')")
@ -154,8 +157,12 @@ public class RuleController {
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true")})
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response, @RequestParam("file") MultipartFile file, @RequestParam(value = "mode") Integer mode,
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception {
Set<String> codeSet = locationService.queryLocationByOverflowAreaTypeByConfig()
.stream()
.map(LocationRespVO::getCode) // 提取每个 LocationRespVO 的 code
.collect(Collectors.toSet()); // 收集为 Set
List<RuleImportExcelVO> list = ExcelUtils.read(file, RuleImportExcelVO.class);
List<RuleImportErrorVO> errorList = ruleService.importRuleList(list, mode, updatePart);
List<RuleImportErrorVO> errorList = ruleService.importRuleList(list, mode, updatePart,codeSet);
Map<String, Object> returnMap = new HashMap<>();
returnMap.put("errorCount", errorList.size());
if (!errorList.isEmpty()) {

22
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/rule/vo/RuleImportExcelVO.java

@ -85,10 +85,10 @@ public class RuleImportExcelVO {
private String storageValue;
@ExcelProperty("库存事务条件")
@ExcelProperty("业务类型条件")
private String transactionType;
@ExcelProperty("库存事务值")
@ExcelProperty("业务类型值")
private String transactionValue;
@ -105,44 +105,44 @@ public class RuleImportExcelVO {
private String overflowLocationCode;
@ExcelProperty(value = "优先空库位", converter = DictConvert.class)
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
@DictFormat(DictTypeConstants.TRUE_FALSE)
private String emptyLocationFirst;
@ExcelProperty(value = "优先非空库位", converter = DictConvert.class)
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
@DictFormat(DictTypeConstants.TRUE_FALSE)
private String notEmptyLocationFirst;
@ExcelProperty(value = "可以混物料", converter = DictConvert.class)
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
@DictFormat(DictTypeConstants.TRUE_FALSE)
private String enableMixItem;
@ExcelProperty(value = "可以混批次", converter = DictConvert.class)
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
@DictFormat(DictTypeConstants.TRUE_FALSE)
private String enableMixLot;
@ExcelProperty(value = "可以混状态", converter = DictConvert.class)
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
@DictFormat(DictTypeConstants.TRUE_FALSE)
private String enableMixStatus;
@ExcelProperty(value = "巷道排序方向")
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
private String aisleOrder;
@ExcelProperty(value = "货架排序方向")
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
private String shelfOrder;
@ExcelProperty(value = "行排序方向")
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
private String rowOrder;
@ExcelProperty(value = "列排序方向")
// @ExcelValid(message = "必填")
@ExcelValid(message = "必填")
private String columOrder;

53
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/SaleShipmentDetailRecordController.java

@ -5,19 +5,15 @@ import cn.hutool.core.bean.copier.CopyOptions;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.util.collection.CollectionUtils;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.wms.controller.saleShipmentRecord.vo.*;
import com.win.module.wms.controller.saleShipmentRequest.vo.SaleShipmentDetailRespVO;
import com.win.module.wms.convert.saleShipmentRecord.SaleShipmentDetailRecordConvert;
import com.win.module.wms.convert.saleShipmentRequest.SaleShipmentDetailConvert;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentDetailRecordDO;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentMainRecordDO;
import com.win.module.wms.dal.dataobject.saleShipmentRequest.SaleShipmentDetailDO;
import com.win.module.wms.dal.dataobject.saleShipmentRequest.SaleShipmentMainDO;
import com.win.module.wms.dal.mysql.saleShipmentRecord.SaleShipmentMainRecordMapper;
import com.win.module.wms.dal.mysql.saleShipmentRequest.SaleShipmentMainMapper;
import com.win.module.wms.service.saleShipmentRecord.SaleShipmentDetailRecordService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@ -31,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@ -84,17 +81,24 @@ public class SaleShipmentDetailRecordController {
@Operation(summary = "获得结算出库记录子分页")
public CommonResult<PageResult<SaleShipmentDetailRecordRespVO>> getSaleShipmentDetailRecordPage(@Valid SaleShipmentDetailRecordPageReqVO pageVO) {
PageResult<SaleShipmentDetailRecordDO> pageResult = saleShipmentDetailRecordService.getSaleShipmentDetailRecordPage(pageVO);
PageResult<SaleShipmentDetailRecordRespVO> result = getSaleShipmentDetailRecordRespVOPageResult(pageResult);
return success(result);
}
private PageResult<SaleShipmentDetailRecordRespVO> getSaleShipmentDetailRecordRespVOPageResult(PageResult<SaleShipmentDetailRecordDO> pageResult) {
PageResult<SaleShipmentDetailRecordRespVO> result = SaleShipmentDetailRecordConvert.INSTANCE.convertPage(pageResult);
if (pageResult.getList().size() > 0) {
Set<Long> masterIdSet = new HashSet<>();
for (SaleShipmentDetailRecordDO saleShipmentDetailRecordDO : pageResult.getList()) {
masterIdSet.add(saleShipmentDetailRecordDO.getMasterId());
}
if (!CollectionUtils.isAnyEmpty(pageResult.getList())) {
Set<Long> masterIdSet = pageResult.getList().stream().map(SaleShipmentDetailRecordDO::getMasterId).collect(Collectors.toSet());
Map<Long, SaleShipmentMainRecordDO> mainMap = saleShipmentMainRecordMapper.queryMainListToMap(masterIdSet);
//
Set<String> userIdSet = pageResult.getList().stream().map(SaleShipmentDetailRecordDO::getCreator).collect(Collectors.toSet());
userIdSet.addAll(pageResult.getList().stream().map(SaleShipmentDetailRecordDO::getUpdater).collect(Collectors.toSet()));
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
//
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for (SaleShipmentDetailRecordRespVO vo : result.getList()) {
vo.setCreator(userApi.getUserNickname(vo.getCreator()));
vo.setUpdater(userApi.getUserNickname(vo.getUpdater()));
result.getList().iterator().forEachRemaining(vo -> {
vo.setCreator(Optional.ofNullable(userNicknameMap.get(vo.getCreator())).orElse(""));
vo.setUpdater(Optional.ofNullable(userNicknameMap.get(vo.getUpdater())).orElse(""));
SaleShipmentMainRecordDO saleShipmentMainRecordDO = mainMap.get(vo.getMasterId());
saleShipmentMainRecordDO.setId(null);
saleShipmentMainRecordDO.setCreator(null);
@ -102,33 +106,16 @@ public class SaleShipmentDetailRecordController {
saleShipmentMainRecordDO.setUpdateTime(null);
saleShipmentMainRecordDO.setUpdateTime(null);
BeanUtil.copyProperties(saleShipmentMainRecordDO, vo, options);
}
});
}
return success(result);
return result;
}
@PostMapping("/senior")
@Operation(summary = "高级搜索获得检验任务主分页")
public CommonResult<PageResult<SaleShipmentDetailRecordRespVO>> getSaleShipmentDetailRecordSenior(@Valid @RequestBody CustomConditions conditions) {
PageResult<SaleShipmentDetailRecordDO> pageResult = saleShipmentDetailRecordService.getSaleShipmentDetailRecordSenior(conditions);
PageResult<SaleShipmentDetailRecordRespVO> result = SaleShipmentDetailRecordConvert.INSTANCE.convertPage(pageResult);
if (pageResult.getList().size() > 0) {
Set<Long> masterIdSet = new HashSet<>();
for (SaleShipmentDetailRecordDO saleShipmentDetailRecordDO : pageResult.getList()) {
masterIdSet.add(saleShipmentDetailRecordDO.getMasterId());
}
Map<Long, SaleShipmentMainRecordDO> mainMap = saleShipmentMainRecordMapper.queryMainListToMap(masterIdSet);
CopyOptions options = CopyOptions.create().setIgnoreNullValue(true);
for (SaleShipmentDetailRecordRespVO vo : result.getList()) {
SaleShipmentMainRecordDO saleShipmentMainRecordDO = mainMap.get(vo.getMasterId());
saleShipmentMainRecordDO.setId(null);
saleShipmentMainRecordDO.setCreator(null);
saleShipmentMainRecordDO.setCreateTime(null);
saleShipmentMainRecordDO.setUpdateTime(null);
saleShipmentMainRecordDO.setUpdateTime(null);
BeanUtil.copyProperties(saleShipmentMainRecordDO, vo, options);
}
}
PageResult<SaleShipmentDetailRecordRespVO> result = getSaleShipmentDetailRecordRespVOPageResult(pageResult);
return success(result);
}

52
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/SaleShipmentMainRecordController.java

@ -3,23 +3,15 @@ package com.win.module.wms.controller.saleShipmentRecord;
import com.win.framework.common.pojo.CommonResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.dict.core.util.DictFrameworkUtils;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.framework.redis.util.RedisCache;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.wms.controller.processproductionRequest.vo.ProcessproductionRequestMainExcelVO;
import com.win.module.wms.controller.saleShipmentRecord.vo.*;
import com.win.module.wms.controller.saleShipmentRequest.vo.SaleShipmentMainExcelVO;
import com.win.module.wms.convert.processproductionRequest.ProcessproductionRequestMainConvert;
import com.win.module.wms.convert.saleShipmentRecord.SaleShipmentMainRecordConvert;
import com.win.module.wms.convert.saleShipmentRequest.SaleShipmentMainConvert;
import com.win.module.wms.dal.dataobject.processproductionRequest.ProcessproductionRequestDetailDO;
import com.win.module.wms.dal.dataobject.processproductionRequest.ProcessproductionRequestMainDO;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentDetailRecordDO;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentMainRecordDO;
import com.win.module.wms.dal.dataobject.saleShipmentRequest.SaleShipmentDetailDO;
import com.win.module.wms.dal.mysql.saleShipmentRecord.SaleShipmentMainRecordMapper;
import com.win.module.wms.enums.DictTypeConstants;
import com.win.module.wms.service.saleShipmentRecord.SaleShipmentDetailRecordService;
import com.win.module.wms.service.saleShipmentRecord.SaleShipmentMainRecordService;
import io.swagger.v3.oas.annotations.Operation;
@ -35,9 +27,12 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static com.win.module.wms.enums.ErrorCodeConstants.SALE_SHIPMENT_MAIN_RECORD_LOCK;
@Tag(name = "管理后台 - 结算出库记录主")
@RestController
@ -47,8 +42,9 @@ public class SaleShipmentMainRecordController {
@Resource
private AdminUserApi userApi;
@Resource
private RedisCache redisCache;
@Resource
private SaleShipmentMainRecordService saleShipmentMainRecordService;
@Resource
private SaleShipmentDetailRecordService saleShipmentDetailRecordService;
@Resource
@ -111,7 +107,7 @@ public class SaleShipmentMainRecordController {
List<SaleShipmentDetailRecordDO> list = saleShipmentDetailRecordService.getSaleShipmentDetailRecordPage(pageVO).getList();
Map<Integer, String[]> mapDropDown = new HashMap<>();
List<SaleShipmentMainRecordExcelVO> datas = getExcelVo(list, mapDropDown);
ExcelUtils.write(response, "结算出库记录主.xls", "数据", SaleShipmentMainRecordExcelVO.class, datas,mapDropDown);
ExcelUtils.write(response, "结算出库记录主.xls", "数据", SaleShipmentMainRecordExcelVO.class, datas, mapDropDown);
}
@PostMapping("/export-excel-senior")
@ -125,24 +121,40 @@ public class SaleShipmentMainRecordController {
List<SaleShipmentDetailRecordDO> list = saleShipmentDetailRecordService.getSaleShipmentDetailRecordSenior(conditions).getList();
Map<Integer, String[]> mapDropDown = new HashMap<>();
List<SaleShipmentMainRecordExcelVO> excelVo = getExcelVo(list, mapDropDown);
ExcelUtils.write(response, "结算出库记录主.xls", "数据", SaleShipmentMainRecordExcelVO.class, excelVo,mapDropDown);
ExcelUtils.write(response, "结算出库记录主.xls", "数据", SaleShipmentMainRecordExcelVO.class, excelVo, mapDropDown);
}
public List<SaleShipmentMainRecordExcelVO> getExcelVo(List<SaleShipmentDetailRecordDO> list, Map<Integer, String[]> mapDropDown){
public List<SaleShipmentMainRecordExcelVO> getExcelVo(List<SaleShipmentDetailRecordDO> list, Map<Integer, String[]> mapDropDown) {
List<SaleShipmentMainRecordExcelVO> datas = new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
Set<Long> masterIdSet = new HashSet<>();
for (SaleShipmentDetailRecordDO detailDO : list) {
masterIdSet.add(detailDO.getMasterId());
}
//主表字段
Set<Long> masterIdSet = list.stream().map(SaleShipmentDetailRecordDO::getMasterId).collect(Collectors.toSet());
Map<Long, SaleShipmentMainRecordDO> mainMap = saleShipmentMainRecordMapper.queryMainListToMap(masterIdSet);
for (SaleShipmentDetailRecordDO detailDO : list) {
//
Set<String> userIdSet = list.stream().map(SaleShipmentDetailRecordDO::getCreator).collect(Collectors.toSet());
Map<String, String> userNicknameMap = userApi.getUserNicknameToString(userIdSet);
list.stream().iterator().forEachRemaining(detailDO -> {
SaleShipmentMainRecordDO mainDO = mainMap.get(detailDO.getMasterId());
SaleShipmentMainRecordExcelVO convert = SaleShipmentMainRecordConvert.INSTANCE.convert(mainDO, detailDO);
convert.setCreator(userApi.getUserNickname(convert.getCreator(),true));
convert.setCreator(Optional.ofNullable(userNicknameMap.get(convert.getCreator())).orElse(""));
datas.add(convert);
}
});
}
return datas;
}
@PutMapping("/abort")
@Operation(summary = "终止结算出库申请任务主")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('wms:sale-shipment-main-record:abort')")
public CommonResult<Boolean> abort(@RequestParam("id") Long id) {
String[] lockStr = new String[]{"record_sale_shipment_main", "abort", String.valueOf(id)};
if (!redisCache.lock(30L, lockStr)) {
throw exception(SALE_SHIPMENT_MAIN_RECORD_LOCK);
}
Integer count = saleShipmentMainRecordService.saleShipmentMainRecordDOAbort(id);
redisCache.deleteLock(lockStr);
return success(count > 0);
}
}

11
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentDetailRecordRespVO.java

@ -1,7 +1,9 @@
package com.win.module.wms.controller.saleShipmentRecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@ -60,4 +62,11 @@ public class SaleShipmentDetailRecordRespVO extends SaleShipmentDetailRecordBase
@Schema(description = "地点ID", example = "1788")
private String siteId;
@Schema(description = "撤销标志")
private String revokeFlag;
@Schema(description = "关联被撤销的单据号")
private String relateRecordNumber;
}

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentMainRecordBaseVO.java

@ -48,4 +48,10 @@ public class SaleShipmentMainRecordBaseVO {
@Schema(description = "地点ID", example = "1788")
private String siteId;
@Schema(description = "撤销标志")
private String revokeFlag;
@Schema(description = "关联被撤销的单据号")
private String relateRecordNumber;
}

11
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentMainRecordCreateReqVO.java

@ -1,7 +1,11 @@
package com.win.module.wms.controller.saleShipmentRecord.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 结算出库记录主创建 Request VO")
@Data
@ -9,4 +13,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
@ToString(callSuper = true)
public class SaleShipmentMainRecordCreateReqVO extends SaleShipmentMainRecordBaseVO {
/**
* 账期日期
*/
private LocalDateTime activeDate;
}

23
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRecord/vo/SaleShipmentMainRecordExcelVO.java

@ -1,18 +1,15 @@
package com.win.module.wms.controller.saleShipmentRecord.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.win.framework.excel.core.annotations.Colour;
import com.win.framework.excel.core.annotations.DictFormat;
import com.win.framework.excel.core.convert.DictConvert;
import com.win.module.wms.enums.DictTypeConstants;
import lombok.*;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
import org.apache.poi.ss.usermodel.IndexedColors;
/**
* 结算出库记录主 Excel VO
*
@ -61,12 +58,12 @@ public class SaleShipmentMainRecordExcelVO {
@DictFormat(DictTypeConstants.UOM)
private String uom;
@ExcelProperty(value = "是否撤销", converter = DictConvert.class)
@DictFormat(DictTypeConstants.TRUE_FALSE)
private String revokeFlag;
@ExcelProperty("关联被撤销的单据号")
private String relateRecordNumber;
// @ExcelProperty("是否可用")
@ -81,14 +78,14 @@ public class SaleShipmentMainRecordExcelVO {
// @ExcelProperty("业务类型")
// private String businessType;
//
//
// @ExcelProperty("扩展属性")
// private String extraProperties;
//
// @ExcelProperty("地点ID")
// private String siteId;
@ExcelProperty("创建人")
private String creator;
@ExcelProperty("创建人")
private String creator;
@ExcelProperty("创建时间")
@ColumnWidth(value = 16)

20
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/saleShipmentRequest/SaleShipmentMainController.java

@ -7,6 +7,7 @@ import com.win.framework.dict.core.util.DictFrameworkUtils;
import com.win.framework.excel.core.util.ConvertUtil;
import com.win.framework.excel.core.util.ExcelUtils;
import com.win.framework.operatelog.core.annotations.OperateLog;
import com.win.framework.redis.util.RedisCache;
import com.win.module.wms.controller.saleShipmentRequest.vo.*;
import com.win.module.wms.convert.saleShipmentRequest.SaleShipmentMainConvert;
import com.win.module.wms.dal.dataobject.saleShipmentRequest.SaleShipmentDetailDO;
@ -33,15 +34,18 @@ import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.*;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.common.pojo.CommonResult.success;
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static com.win.module.wms.enums.ErrorCodeConstants.SALE_SHIPMENT_MAIN_REQUEST_AGREE_LOCK;
@Tag(name = "管理后台 - 结算出库申请主")
@RestController
@RequestMapping("/wms/sale-shipment-main-request")
@Validated
public class SaleShipmentMainController {
@Resource
private RedisCache redisCache;
@Resource
private SaleShipmentMainService saleShipmentMainService;
@Resource
@ -207,7 +211,12 @@ public class SaleShipmentMainController {
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('wms:sale-shipment-main-request:agree')")
public CommonResult<Boolean> agreeSaleShipmentMainRequest(@RequestParam("id") Long id) {
String[] lockStr = new String[]{"request_sale_shipment_main", "agree", String.valueOf(id)};
if (!redisCache.lock(10L, lockStr)) {
throw exception(SALE_SHIPMENT_MAIN_REQUEST_AGREE_LOCK);
}
Integer count = saleShipmentMainService.agreeSaleShipmentMainRequest(id);
redisCache.deleteLock(lockStr);
return success(count > 0);
}
@ -228,13 +237,4 @@ public class SaleShipmentMainController {
Integer count = saleShipmentMainService.abortSaleShipmentMainRequest(id);
return success(count > 0);
}
@PutMapping("/abort")
@Operation(summary = "终止结算出库申请申请主")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('wms:sale-shipment-main-request:abort')")
public CommonResult<Boolean> abortSaleShipmentMainAbort(@RequestParam("id") Long id) {
Integer count = saleShipmentMainService.abortSaleShipmentMainAbort(id);
return success(count > 0);
}
}

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/supplierdeliverRequest/vo/SupplierdeliverRequestMainCreateReqVO.java

@ -22,6 +22,8 @@ public class SupplierdeliverRequestMainCreateReqVO extends SupplierdeliverReques
* 规则的在途库位
*/
private String onTheWayLocationCode;
@Schema(description = "订单号")
private String poNumber;
}

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/supplierdeliverRequest/SupplierdeliverRequestDetailConvert.java

@ -51,7 +51,8 @@ public interface SupplierdeliverRequestDetailConvert {
// SupplierdeliverRequestDetailExcelVO convert(SupplierdeliverRequestMainDO mainDO, SupplierdeliverRequestDetailDO detailDO);
@Mappings({
@Mapping(source = "mainVo.number", target = "number"),
@Mapping(source = "mainVo.remark", target = "remark")
@Mapping(source = "mainVo.remark", target = "remark"),
@Mapping(source = "detailDo.poNumber", target = "poNumber")
})
SupplierdeliverRequestMainImportErrorVO convert(SupplierdeliverRequestMainCreateReqVO mainVo, SupplierdeliverRequestDetailDO detailDo);

20
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRecord/ProductionscrapRecordDetailDO.java

@ -161,4 +161,24 @@ public class ProductionscrapRecordDetailDO extends BaseDO {
*/
private BigDecimal amount;
/**
* 项目代码
*/
private String qadProjectCode;
/**
* 项目描述
*/
private String qadProjectDescription;
/**
* 物料差异账户/成本重估账户
*/
private String qadTtunrcisAcc;
/**
* 账户成本中心(物料差异/废品账户/成本重估/盘点差异)
*/
private String qadPlCostCenter;
}

24
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRecord/ProductionscrapRecordMainDO.java

@ -135,4 +135,28 @@ public class ProductionscrapRecordMainDO extends BaseDO {
*/
private String toAreaCodes;
/**
* 报废原因
*/
private String lineScrapReason;
/**
* 成本中心代码
*/
private String costCenterCode;
/**
* 成本中心类型
*/
private String costCenterType;
/**
* 原因代码
*/
private String reasonCodeRequisition;
/**
* QAD传输账户
*/
private String qadTtunrcisAcc;
}

30
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRequest/ProductionscrapRequestDetailDO.java

@ -121,4 +121,34 @@ public class ProductionscrapRequestDetailDO extends BaseDO {
@Version
private Integer concurrencyStamp;
/**
* 单价
*/
private BigDecimal singlePrice;
/**
* 金额
*/
private BigDecimal amount;
/**
* 项目代码
*/
private String qadProjectCode;
/**
* 项目描述
*/
private String qadProjectDescription;
/**
* 物料差异账户/成本重估账户
*/
private String qadTtunrcisAcc;
/**
* 账户成本中心(物料差异/废品账户/成本重估/盘点差异)
*/
private String qadPlCostCenter;
}

25
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/productionscrapRequest/ProductionscrapRequestMainDO.java

@ -137,4 +137,29 @@ public class ProductionscrapRequestMainDO extends BaseDO {
*/
private String outInventoryStatuses;
/**
* 报废原因
*/
private String lineScrapReason;
/**
* 成本中心代码
*/
private String costCenterCode;
/**
* 成本中心类型
*/
private String costCenterType;
/**
* 原因代码
*/
private String reasonCodeRequisition;
/**
* QAD传输账户
*/
private String qadTtunrcisAcc;
}

8
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/saleShipmentRecord/SaleShipmentMainRecordDO.java

@ -67,6 +67,14 @@ public class SaleShipmentMainRecordDO extends BaseDO {
* 地点ID
*/
private String siteId;
/**
* 撤销标志
*/
private String revokeFlag;
/**
* 关联被撤销的单据号
*/
private String relateRecordNumber;
/**
* 账期日期

18
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/dataobject/saleShipmentRequest/SaleShipmentMainDO.java

@ -1,14 +1,12 @@
package com.win.module.wms.dal.dataobject.saleShipmentRequest;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.win.framework.mybatis.core.dataobject.BaseDO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.win.framework.mybatis.core.dataobject.BaseDO;
/**
* 结算出库申请主 DO
@ -102,4 +100,10 @@ public class SaleShipmentMainDO extends BaseDO {
*/
private String serialNumber;
/**
* 生效日期
*/
@TableField(exist = false)
private LocalDateTime activeDate;
}

5
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/productionscrapRecord/ProductionscrapRecordDetailMapper.java

@ -139,4 +139,9 @@ public interface ProductionscrapRecordDetailMapper extends BaseMapperX<Productio
.orderByDesc(ProductionscrapRecordDetailDO::getId));
}
default List<ProductionscrapRecordDetailDO> selectListByMasterId(Long id){
LambdaQueryWrapperX<ProductionscrapRecordDetailDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
lambdaQueryWrapperX.eq(ProductionscrapRecordDetailDO::getMasterId,id);
return this.selectList(lambdaQueryWrapperX);
}
}

12
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/purchasePlan/PurchasePlanDetailMapper.java

@ -49,6 +49,9 @@ public interface PurchasePlanDetailMapper extends BaseMapperX<PurchasePlanDetail
if("1".equals(reqVO.getIsZero())){//计划数量大于零
lambdaQueryWrapperX.gtIfPresent(PurchasePlanDetailDO::getPlanQty, BigDecimal.ZERO);
}
if("1".equals(reqVO.getFlag())){//发货申请查询要货计划 需要展示明细未关闭Available = TRUE
lambdaQueryWrapperX.eqIfPresent(PurchasePlanDetailDO::getAvailable, "TRUE");
}
boolean queryMainFlag = false;
StringBuffer mainSbf = new StringBuffer();
mainSbf.append("select id from plan_purchase_main where 1=1 ");
@ -105,8 +108,10 @@ public interface PurchasePlanDetailMapper extends BaseMapperX<PurchasePlanDetail
}
default PageResult<PurchasePlanDetailDO> selectSenior(CustomConditions conditions) {
Boolean flag = false;
List<String> excludeConditions = new ArrayList<>();
excludeConditions.add("status");
excludeConditions.add("flag");
excludeConditions.add("number");
excludeConditions.add("supplier_code");
excludeConditions.add("supplierCode");
@ -117,9 +122,16 @@ public interface PurchasePlanDetailMapper extends BaseMapperX<PurchasePlanDetail
en.setAction(">");
en.setValue("0");
}
if(en.getColumn().equals("flag") && en.getValue().equals("1")){//发货申请筛选
flag = true;
}
}
excludeConditions.add("isZero");
QueryWrapper queryWrapper = QueryWrapperUtils.structureFilter(conditions,excludeConditions);
if(flag){//发货申请查询要货计划需要明细为未关闭的
queryWrapper.eq("available", "TRUE");
}
queryWrapper.orderByAsc("delivery_date_sort");
if(conditions.getFilters() != null){
boolean queryMainFlag = false;

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/dal/mysql/supplierinvoiceinvoiced/SupplierinvoiceInvoicedMapper.java

@ -1,5 +1,6 @@
package com.win.module.wms.dal.mysql.supplierinvoiceinvoiced;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
@ -55,8 +56,10 @@ public interface SupplierinvoiceInvoicedMapper extends BaseMapperX<Supplierinvoi
}
default PageResult<SupplierinvoiceInvoicedDO> selectSenior(CustomConditions conditions){
QueryWrapperUtils.structure(conditions).apply("STR_TO_DATE(prh_rcp_date, '%Y-%m-%d') < DATE_FORMAT(CURDATE(), '%Y-%m-01')");
return selectPage(conditions, QueryWrapperUtils.structure(conditions));
QueryWrapper<SupplierinvoiceInvoicedDO> structure = QueryWrapperUtils.structure(conditions);
structure.apply("STR_TO_DATE(prh_rcp_date, '%Y-%m-%d') < DATE_FORMAT(CURDATE(), '%Y-%m-01')");
structure.orderByDesc("id");
return selectPage(conditions, structure);
}
default List<SupplierinvoiceInvoicedDO> selectList(SupplierinvoiceInvoicedExportReqVO reqVO) {

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countJob/CountJobMainService.java

@ -2,8 +2,10 @@ package com.win.module.wms.service.countJob;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.module.system.api.user.dto.AdminUserRespDTO;
import com.win.module.wms.controller.countJob.vo.*;
import com.win.module.wms.dal.dataobject.countJob.CountJobMainDO;
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO;
import org.springframework.lang.Nullable;
import java.util.Collection;
@ -101,6 +103,8 @@ public interface CountJobMainService {
*/
void finishJobMain(Long id);
void validateCountJobList(CountJobMainDO countJobMainDO, Map<String, ItembasicDO> itembasicDOMap, List<CountJobDetailUpdateReqVO> countJobDetailUpdateReqVOList, List<CountJobMainExportSingleRespErrorVO> errorList, String userId);
/**
* 校验数据并执行盘点任务
* @param countJobMainUpdateReqVO
@ -108,6 +112,9 @@ public interface CountJobMainService {
*/
String validateAndExecuteCountJobMain(CountJobMainUpdateReqVO countJobMainUpdateReqVO);
void validateItem(CountJobMainUpdateReqVO countJobMainUpdateReqVO);
/**
* pda未处理的任务数
* @return pda未处理的任务数

48
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countJob/CountJobMainServiceImpl.java

@ -1,7 +1,6 @@
package com.win.module.wms.service.countJob;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.exception.ServiceException;
import com.win.framework.common.pojo.CustomConditions;
@ -220,8 +219,8 @@ public class CountJobMainServiceImpl implements CountJobMainService {
// 生成盘点记录
countRecordMainService.generateCountRecord(countJobMainUpdateReqVO);
}
private void validateCountJobList(CountJobMainDO countJobMainDO, Map<String, ItembasicDO> itembasicDOMap, List<CountJobDetailUpdateReqVO> countJobDetailUpdateReqVOList, List<CountJobMainExportSingleRespErrorVO> errorList, String userId) {
@Override
public void validateCountJobList(CountJobMainDO countJobMainDO, Map<String, ItembasicDO> itembasicDOMap, List<CountJobDetailUpdateReqVO> countJobDetailUpdateReqVOList, List<CountJobMainExportSingleRespErrorVO> errorList, String userId) {
JobStatusState jobStatusState = new JobStatusState(countJobMainDO.getStatus());
boolean flag = jobStatusState.execute();
if (!flag) {
@ -231,8 +230,8 @@ public class CountJobMainServiceImpl implements CountJobMainService {
Map<String, List<String>> countRange = countPlanDetailService.getCountRange(countJobMainDO.getPlanNumber());
// 获取忽略(校验用)
CountPlanMainDO planMainDO = countPlanMainService.getCountPlanMainByNumber(countJobMainDO.getPlanNumber());
List ignoreItemList = Arrays.asList(planMainDO.getIgnoreListOfItem().split(","));
List ignoreLocationList = Arrays.asList(planMainDO.getIgnoreListOfLocation().split(","));
List<String> ignoreItemList = Arrays.asList(planMainDO.getIgnoreListOfItem().split(","));
List<String> ignoreLocationList = Arrays.asList(planMainDO.getIgnoreListOfLocation().split(","));
//库位(校验)
List<LocationDO> locationDOList;
if("TRUE".equals(planMainDO.getIsOpenCount())){
@ -250,20 +249,19 @@ public class CountJobMainServiceImpl implements CountJobMainService {
for (CountJobDetailUpdateReqVO countJobDetailUpdateReqVO : countJobDetailUpdateReqVOList) {
try{
//todo 对维度怎么校验?如果选择了维度,盘点范围就被扩大了,盘点范围以外的维度扩充数据都会校验不通过
Boolean rangeSame = true;
Iterator<Map.Entry<String,List<String>>> it = countRange.entrySet().iterator();
while(it.hasNext()){
Map.Entry<String,List<String>> entry = it.next();
String type = entry.getKey();
List<String> value = entry.getValue();
if (!value.contains(new JSONObject(countJobDetailUpdateReqVO).get(StringUtils.toCamelCase(type)))) {
rangeSame = false;
}
}
if (!rangeSame) {
throw exception(COUNT_RANGE_ERROR,countJobDetailUpdateReqVO.getItemCode());
}
if (ignoreItemList != null && ignoreItemList.contains(countJobDetailUpdateReqVO.getItemCode())) {
// HL-6050聂喜婷 不在计划内的物料算盘盈
// boolean rangeSame = true;
// for (Map.Entry<String, List<String>> entry : countRange.entrySet()) {
// String type = entry.getKey();
// List<String> value = entry.getValue();
// if (!value.contains(new JSONObject(countJobDetailUpdateReqVO).get(StringUtils.toCamelCase(type)))) {
// rangeSame = false;
// }
// }
// if (!rangeSame) {
// throw exception(COUNT_RANGE_ERROR,countJobDetailUpdateReqVO.getItemCode());
// }
if (ignoreItemList.contains(countJobDetailUpdateReqVO.getItemCode())) {
throw exception(COUNT_IGNORE_ITEM_ERROR, countJobDetailUpdateReqVO.getItemCode());
}
if (countJobDetailUpdateReqVO.getCountQty() == null) {
@ -276,6 +274,7 @@ public class CountJobMainServiceImpl implements CountJobMainService {
throw exception(TRANSFERISSUE_REQUEST_DETAIL_ITEM_NOT_EXISTS, countJobDetailUpdateReqVO.getItemCode());
}
LocationDO locationDO = locationDOList.stream().filter(item -> Objects.equals(item.getCode(), countJobDetailUpdateReqVO.getLocationCode())).findFirst().orElse(null);
assert locationDO != null;
if (!Util.isNullOrEmpty(countJobDetailUpdateReqVO.getWarehouseCode()) && !Objects.equals(locationDO.getWarehouseCode(), countJobDetailUpdateReqVO.getWarehouseCode())) {
throw exception(COUNT_CODE_ERROR, "仓库",countJobDetailUpdateReqVO.getItemCode());
}
@ -311,7 +310,14 @@ public class CountJobMainServiceImpl implements CountJobMainService {
public String validateAndExecuteCountJobMain(CountJobMainUpdateReqVO countJobMainUpdateReqVO){
Long userId = getLoginUserId();
AdminUserRespDTO userRespDTO = userApi.getUser(userId);
CountJobMainDO countJobMainDO = this.validateCountJobMainExists(countJobMainUpdateReqVO.getId());
validateItem(countJobMainUpdateReqVO);
return executeCountJobMain(countJobMainUpdateReqVO,countJobMainDO,userRespDTO);
}
@Override
public void validateItem(CountJobMainUpdateReqVO countJobMainUpdateReqVO){
Long userId = getLoginUserId();
AdminUserRespDTO userRespDTO = userApi.getUser(userId); //todo 形参引用,不可以删,返回给调用方
// 查询主表数据
CountJobMainDO countJobMainDO = this.validateCountJobMainExists(countJobMainUpdateReqVO.getId());
//物料基本信息(校验)
@ -319,9 +325,7 @@ public class CountJobMainServiceImpl implements CountJobMainService {
//补全物料信息
countJobMainUpdateReqVO = buildJobMainUpdateReqVO(countJobMainDO,itembasicDOMap,userId.toString(),countJobMainUpdateReqVO.getSubList());
validateCountJobList(countJobMainDO,itembasicDOMap,countJobMainUpdateReqVO.getSubList(),null,userId.toString());
return executeCountJobMain(countJobMainUpdateReqVO,countJobMainDO,userRespDTO);
}
private String executeCountJobMain(CountJobMainUpdateReqVO countJobMainUpdateReqVO, CountJobMainDO countJobMainDO, AdminUserRespDTO userRespDTO) {
if (Objects.equals(countJobMainUpdateReqVO.getIsOpenCount(), "TRUE")) {
// 更新完成信息

115
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countRequest/CountRequestMainServiceImpl.java

@ -73,6 +73,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.BinaryOperator;
import java.util.stream.Collectors;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -411,6 +412,7 @@ public class CountRequestMainServiceImpl implements CountRequestMainService {
@Transactional
public Integer createReCountJob(CountRequestMainUpdateReqVO updateReqVO) {
CountRequestMainDO mainDO = CountRequestMainConvert.INSTANCE.convert(updateReqVO);
// CountRequestMainDO mainDO = validateCountRequestMainExists(updateReqVO.getId());
mainDO.setStage("RECOUNT");// 重盘
mainDO.setJobStatus2("1");
mainDO.setCountAdjustStatus("1");
@ -431,6 +433,7 @@ public class CountRequestMainServiceImpl implements CountRequestMainService {
@Transactional
public Integer createSuperviseCountJob(CountRequestMainUpdateReqVO updateReqVO) {
CountRequestMainDO mainDO = CountRequestMainConvert.INSTANCE.convert(updateReqVO);
// CountRequestMainDO mainDO = validateCountRequestMainExists(updateReqVO.getId());
mainDO.setStage("AUDIT_COUNT");// 监盘
mainDO.setJobStatus2("1");
mainDO.setCountAdjustStatus("1");
@ -472,6 +475,32 @@ public class CountRequestMainServiceImpl implements CountRequestMainService {
countJobMainMapper.insert(countJobMainDO);
return countJobMainDO;
}
private CountJobMainDO buildJobMain(String number,CountRequestMainDO mainDO,String splitCode,JobsettingDO jobsettingDO,BusinesstypeDO businesstypeDO,Long loginUserId,String departId){
CountJobMainDO countJobMainDO = CountJobMainConvert.INSTANCE.convert(mainDO);
countJobMainDO.setCountSplitCode(splitCode!=null?splitCode:mainDO.getId().toString());
countJobMainDO.setRequestDueTime(mainDO.getDueTime());
countJobMainDO.setRequestNumber(mainDO.getNumber());
countJobMainDO.setAutoComplete(jobsettingDO.getAutoComplete());
countJobMainDO.setAllowModifyLocation(jobsettingDO.getAllowModifyLocation());
countJobMainDO.setAllowModifyQty(jobsettingDO.getAllowModifyQty());
countJobMainDO.setAllowBiggerQty(jobsettingDO.getAllowBiggerQty());
countJobMainDO.setAllowSmallerQty(jobsettingDO.getAllowSmallerQty());
countJobMainDO.setAllowContinuousScanning(jobsettingDO.getAllowContinuousScanning());
countJobMainDO.setAllowPartialComplete(jobsettingDO.getAllowPartialComplete());
countJobMainDO.setAllowModifyPackingNumber(jobsettingDO.getAllowModifyPackingNumber());
countJobMainDO.setAllowModifyBatch(jobsettingDO.getAllowModifyBach());
// 增加业务类型
countJobMainDO.setBusinessType(businesstypeDO.getCode());
countJobMainDO.setInInventoryStatuses(businesstypeDO.getInInventoryStatuses());
countJobMainDO.setOutInventoryStatuses(businesstypeDO.getOutInventoryStatuses());
countJobMainDO.setStatus(JobStatusEnum.PENDING.getCode());
countJobMainDO.setId(null).setCreator(loginUserId.toString()).setCreateTime(LocalDateTime.now()).setUpdater(null).setUpdateTime(null);
countJobMainDO.setCreator(mainDO.getCreator());
countJobMainDO.setConcurrencyStamp(1);
countJobMainDO.setNumber(number);
countJobMainDO.setDepartmentCode(departId);
return countJobMainDO;
}
/**
* 生成盘点任务
*
@ -491,43 +520,61 @@ public class CountRequestMainServiceImpl implements CountRequestMainService {
Long finalLoginUserId = loginUserId;
Set<String> addKeys = new HashSet<>();
Set<String> delKeys = new HashSet<>();
if(Objects.equals(mainDO.getIsOpenCount(),"TRUE") && detailDOList!=null && !detailDOList.isEmpty()){
List<CountJobDetailDO> countJobDetailDOList = new ArrayList<>();
log.debug("====================命盘创建任务子=========================="+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
Map<String, List<CountRequestDetailDO>> listMap = detailDOList.stream().collect(Collectors.groupingBy(item -> new JSONObject(item).getStr(mainDO.getCountSplitType())));
listMap.forEach((mapKey, countRequestDetailDOList) -> {
CountJobMainDO countJobMainDO = generateJobMain(mainDO,mapKey,jobsettingDO,businesstypeDO,finalLoginUserId);
for (CountRequestDetailDO countRequestDetailDO : countRequestDetailDOList) {
CountJobDetailDO countJobDetailDO = CountJobDetailConvert.INSTANCE.convert(countRequestDetailDO);
if (!Util.isNullOrEmpty(countRequestDetailDO.getItemCode())) {
countJobDetailDO.setNumber(countJobMainDO.getNumber());
countJobDetailDO.setMasterId(countJobMainDO.getId());
countJobDetailDO.setId(null).setCreator(finalLoginUserId.toString()).setCreateTime(LocalDateTime.now()).setUpdater(null).setUpdateTime(null);
countJobDetailDO.setCreator(countJobMainDO.getCreator());
countJobDetailDOList.add(countJobDetailDO);
String departId = userApi.getUser(loginUserId).getDeptId().toString();
if(Objects.equals(mainDO.getIsOpenCount(),"TRUE")){
if(detailDOList!=null && !detailDOList.isEmpty()){
List<CountJobDetailDO> countJobDetailDOList = new ArrayList<>();
log.debug("====================命盘创建任务子=========================="+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
Map<String, List<CountRequestDetailDO>> listMap = detailDOList.stream().collect(Collectors.groupingBy(item -> new JSONObject(item).getStr(mainDO.getCountSplitType())));
List<CountJobMainDO> countJobMainDOList = new ArrayList<>();
listMap.forEach((mapKey, countRequestDetailDOList) -> {
String number = serialNumberApi.generateCode(RuleCodeEnum.COUNT_JOB.getCode());
// CountJobMainDO countJobMainDO = generateJobMain(mainDO,mapKey,jobsettingDO,businesstypeDO,finalLoginUserId);
countJobMainDOList.add(buildJobMain(number,mainDO,mapKey,jobsettingDO,businesstypeDO,finalLoginUserId,departId));
for (CountRequestDetailDO countRequestDetailDO : countRequestDetailDOList) {
CountJobDetailDO countJobDetailDO = CountJobDetailConvert.INSTANCE.convert(countRequestDetailDO);
if (!Util.isNullOrEmpty(countRequestDetailDO.getItemCode())) {
countJobDetailDO.setNumber(number);
// countJobDetailDO.setMasterId(countJobMainDO.getId());
countJobDetailDO.setId(null).setCreator(finalLoginUserId.toString()).setCreateTime(LocalDateTime.now()).setUpdater(null).setUpdateTime(null);
countJobDetailDO.setCreator(mainDO.getCreator());
countJobDetailDOList.add(countJobDetailDO);
}
//todo 张斌2024-07-16 标记物料冻结状态,防止并行任务解冻
delKeys.addAll(redisCache.keys(StrUtils.format(RedisKeyConstants.BALANCE_ITEM_PLAN,
countJobDetailDO.getItemCode(),
countJobDetailDO.getBatch(),
countJobDetailDO.getPackingNumber(),
countJobDetailDO.getLocationCode(),
number)));
addKeys.add(StrUtils.format(RedisKeyConstants.BALANCE_ITEM_PLAN_REQUEST_JOB,
countJobDetailDO.getItemCode(),
countJobDetailDO.getBatch(),
countJobDetailDO.getPackingNumber(),
countJobDetailDO.getLocationCode(),
mainDO.getPlanNumber(),
mainDO.getNumber(),
number));
}
//todo 张斌2024-07-16 标记物料冻结状态,防止并行任务解冻
delKeys.addAll(redisCache.keys(StrUtils.format(RedisKeyConstants.BALANCE_ITEM_PLAN,
countJobDetailDO.getItemCode(),
countJobDetailDO.getBatch(),
countJobDetailDO.getPackingNumber(),
countJobDetailDO.getLocationCode(),
countJobMainDO.getNumber())));
addKeys.add(StrUtils.format(RedisKeyConstants.BALANCE_ITEM_PLAN_REQUEST_JOB,
countJobDetailDO.getItemCode(),
countJobDetailDO.getBatch(),
countJobDetailDO.getPackingNumber(),
countJobDetailDO.getLocationCode(),
countJobMainDO.getPlanNumber(),
countJobMainDO.getRequestNumber(),
countJobMainDO.getNumber()));
// trendsApi.createTrends(countJobMainDO.getId(), "job_count_main", null, "盘点申请生成盘点任务", JSONUtil.toJsonStr(countJobMainDO) ,TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
});
log.debug("====================插入盘点任务主=========================="+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
countJobMainMapper.insertBatch(countJobMainDOList);
List<String> jobNumberList = countJobMainDOList.stream().map(CountJobMainDO::getNumber).collect(Collectors.toList());
List<CountJobMainDO> tempList = countJobMainMapper.selectList(new LambdaQueryWrapperX<CountJobMainDO>().in(CountJobMainDO::getNumber,jobNumberList).orderByDesc(CountJobMainDO::getId));
Map<String,CountJobMainDO> countJobMainIdMap = tempList.stream().collect(Collectors.toMap(CountJobMainDO::getNumber,e->e, BinaryOperator.maxBy(Comparator.comparing(CountJobMainDO::getId))));
for (CountJobDetailDO countJobDetailDO : countJobDetailDOList) {
countJobDetailDO.setMasterId(countJobMainIdMap.get(countJobDetailDO.getNumber()).getId());;
}
trendsApi.createTrends(countJobMainDO.getId(), "job_count_main", null, "盘点申请生成盘点任务", JSONUtil.toJsonStr(countJobMainDO) ,TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
});
if (!countJobDetailDOList.isEmpty()) {
countJobDetailMapper.insertBatch(countJobDetailDOList);
log.debug("====================插入盘点任务子=========================="+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
if (!countJobDetailDOList.isEmpty()) {
countJobDetailMapper.insertBatch(countJobDetailDOList);
}
log.debug("====================写入日志=========================="+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
String loginUserIdStr = loginUserId.toString();
countJobMainIdMap.forEach((number,countJobMainDO)-> trendsApi.createTrends(countJobMainDO.getId(), "job_count_main", null, "盘点申请生成盘点任务", JSONUtil.toJsonStr(countJobMainDO) ,TrendsTypeEnum.CREATE, loginUserIdStr));
}
}else{
}else if(Objects.equals(mainDO.getIsOpenCount(),"FALSE")){
log.debug("====================盲盘生成任务主=========================="+LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
generateJobMain(mainDO,null,jobsettingDO,businesstypeDO,finalLoginUserId);
}

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/countadjustRequest/CountadjustRequestMainServiceImpl.java

@ -274,6 +274,10 @@ public class CountadjustRequestMainServiceImpl implements CountadjustRequestMain
if (countadjustRecordDetailDOList == null || countadjustRecordDetailDOList.isEmpty()) {
return;
}
SwitchDO switchDO = switchMapper.selectByCode("countInterfaceDataSwitch");
if (switchDO == null || "FALSE".equals(switchDO.getEffectiveSetValue())) {
return;
}
Map<String, MstrDO> codeMstrMap = new HashMap<>();
LambdaQueryWrapperX<MstrDO> mstrDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
mstrDOLambdaQueryWrapperX.in(MstrDO::getPlProdLine, itembasicDOList.stream().map(ItembasicDO::getProdCla).collect(Collectors.toSet()));
@ -421,7 +425,7 @@ public class CountadjustRequestMainServiceImpl implements CountadjustRequestMain
countadjustRecordDetailDO.getPackingNumber());
}
}
// todo 物料库区中不到包装时根据开关决定抛异常或取默认包装
// todo 物料库区中不到包装时根据开关决定抛异常或取默认包装
ItemareaDO itemareaDO = itemareaDOList.stream().filter(item ->
Objects.equals(item.getItemCode(), countadjustRecordDetailDO.getItemCode()) &&
Objects.equals(item.getAreaCode(), countadjustRecordDetailDO.getAreaCode())

182
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/customerreturnRequest/CustomerreturnRequestMainServiceImpl.java

@ -21,6 +21,7 @@ import com.win.module.wms.controller.customerreturnRecord.vo.CustomerreturnRecor
import com.win.module.wms.controller.customerreturnRecord.vo.CustomerreturnRecordMainCreateReqVO;
import com.win.module.wms.controller.customerreturnRequest.vo.*;
import com.win.module.wms.controller.expectin.vo.ExpectinCreateReqVO;
import com.win.module.wms.controller.transaction.vo.TransactionCreateReqVO;
import com.win.module.wms.convert.customerreturnJob.CustomerreturnJobDetailConvert;
import com.win.module.wms.convert.customerreturnJob.CustomerreturnJobMainConvert;
import com.win.module.wms.convert.customerreturnRecord.CustomerreturnRecordDetailConvert;
@ -44,6 +45,7 @@ import com.win.module.wms.dal.dataobject.jobsetting.JobsettingDO;
import com.win.module.wms.dal.dataobject.location.LocationDO;
import com.win.module.wms.dal.dataobject.packageMassage.PackageDO;
import com.win.module.wms.dal.dataobject.requestsetting.RequestsettingDO;
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO;
import com.win.module.wms.dal.mysql.customerreturnJob.CustomerreturnJobDetailMapper;
import com.win.module.wms.dal.mysql.customerreturnJob.CustomerreturnJobMainMapper;
import com.win.module.wms.dal.mysql.customerreturnRecord.CustomerreturnRecordDetailMapper;
@ -51,6 +53,7 @@ import com.win.module.wms.dal.mysql.customerreturnRecord.CustomerreturnRecordMai
import com.win.module.wms.dal.mysql.customerreturnRequest.CustomerreturnRequestDetailMapper;
import com.win.module.wms.dal.mysql.customerreturnRequest.CustomerreturnRequestMainMapper;
import com.win.module.wms.dal.mysql.packageMassage.PackageMapper;
import com.win.module.wms.enums.common.HoldReceiveTypeEnum;
import com.win.module.wms.enums.job.JobStatusEnum;
import com.win.module.wms.enums.plan.PlanStatusEnum;
import com.win.module.wms.enums.request.RequestStatusEnum;
@ -60,6 +63,7 @@ import com.win.module.wms.service.businesstype.BusinesstypeService;
import com.win.module.wms.service.customerdock.CustomerdockService;
import com.win.module.wms.service.customerreturnJob.CustomerreturnJobMainService;
import com.win.module.wms.service.deliverRecord.DeliverRecordMainService;
import com.win.module.wms.service.documentSwitch.SwitchService;
import com.win.module.wms.service.expectin.ExpectinService;
import com.win.module.wms.service.itembasic.ItembasicService;
import com.win.module.wms.service.jobsetting.JobsettingService;
@ -67,6 +71,7 @@ import com.win.module.wms.service.location.LocationService;
import com.win.module.wms.service.packageMassage.PackageService;
import com.win.module.wms.service.recordsetting.RecordsettingService;
import com.win.module.wms.service.requestsetting.RequestsettingService;
import com.win.module.wms.service.transaction.TransactionService;
import com.win.module.wms.util.JobUtils;
import groovy.lang.Lazy;
import lombok.extern.slf4j.Slf4j;
@ -167,6 +172,12 @@ public class CustomerreturnRequestMainServiceImpl implements CustomerreturnReque
private AreabasicService areabasicService;
@Resource
private CustomerreturnJobMainService customerreturnJobMainService;
@Lazy
@Resource
private SwitchService switchService;
@Lazy
@Resource
private TransactionService transactionService;
@Override
public String createCustomerreturnRequestMain(CustomerreturnRequestMainCreateReqVO createReqVO) {
@ -321,37 +332,152 @@ public class CustomerreturnRequestMainServiceImpl implements CustomerreturnReque
// 如果直接生成记录 修改申请状态为已完成
mainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
customerreturnRequestMainMapper.updateById(mainDO);
CustomerreturnRecordMainCreateReqVO customerreturnRecordMainCreateReqVO = new CustomerreturnRecordMainCreateReqVO();
BeanUtils.copyProperties(mainDO, customerreturnRecordMainCreateReqVO);
// 记录主表数据 同名属性同名赋值
customerreturnRecordMainCreateReqVO.setRequestNumber(mainDO.getNumber());
customerreturnRecordMainCreateReqVO.setId(null);
customerreturnRecordMainCreateReqVO.setCreator(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
customerreturnRecordMainCreateReqVO.setCreateTime(null);
customerreturnRecordMainCreateReqVO.setActiveDate(LocalDateTime.now());
customerreturnRecordMainCreateReqVO.setExecuteTime(LocalDateTime.now());
String number = serialNumberApi.generateCode(RuleCodeEnum.CUSTOMER_REJECT_RECORD.getCode());
customerreturnRecordMainCreateReqVO.setNumber(number);
// 增加业务类型
BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("CustomerRejectRecord", "客户退货记录");
customerreturnRecordMainCreateReqVO.setBusinessType(businesstypeDO.getCode());
CustomerreturnRecordMainDO recordMainDO = CustomerreturnRecordMainConvert.INSTANCE.convert(customerreturnRecordMainCreateReqVO);
recordMainDO.setDepartmentCode(userApi.getUser(getLoginUserId()).getDeptId().toString());
customerreturnRecordMainMapper.insert(recordMainDO);
String userIdStr = userApi.getUser(getLoginUserId()).getId().toString();
String userDepIdStr = userApi.getUser(getLoginUserId()).getDeptId().toString();
boolean customerreturnConfirmationSwitchFlag = false;
String inventorymoveConfirmationSwitch = switchService.selectSwitchExist("customerreturnConfirmationSwitch").getEffectiveSetValue();
if("TRUE".equals(inventorymoveConfirmationSwitch)){
log.debug("客户退货开启确认接收功能,申请单号:{}",mainDO.getNumber());
customerreturnConfirmationSwitchFlag = true;
}
List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>();
// 根据申请生成任务,任务生成记录的逻辑重新修改 -->申请直接到记录的功能
for (CustomerreturnRequestDetailDO customerreturnRequestDetailDO : detailDOList) {
// 记录子表数据 同名属性同名赋值
CustomerreturnRecordDetailCreateReqVO customerreturnRecordDetailCreateReqVO = new CustomerreturnRecordDetailCreateReqVO();
CustomerreturnRecordDetailDO recordDetailDO = CustomerreturnRecordDetailConvert.INSTANCE.convert(customerreturnRecordDetailCreateReqVO);
BeanUtils.copyProperties(customerreturnRequestDetailDO, recordDetailDO);
recordDetailDO.setFromBatch(customerreturnRequestDetailDO.getBatch());
recordDetailDO.setMasterId(customerreturnRequestDetailDO.getId());
recordDetailDO.setId(null);
recordDetailDO.setCreator(userApi.getUser(getLoginUserId()).getId().toString());
recordDetailDO.setCreateTime(null);
recordDetailDO.setInventoryStatus(businesstypeDO.getInInventoryStatuses());
customerreturnRecordDetailMapper.insert(recordDetailDO);
// 根据 申请的包装条数 来创建任务
List<PackageDO> packageDOList = packageService.getPackageListByRequestNumber(mainDO.getNumber());
if (packageDOList == null || packageDOList.size() == 0) {
throw exception(PRODUCTRECEIPT_JOB_MAIN_PACKING_ERROR);
}
for (PackageDO packageDO : packageDOList) {
if (packageDO.getItemCode().equals(customerreturnRequestDetailDO.getItemCode()) && packageDO.getDetailId().equals(customerreturnRequestDetailDO.getId())) {
// 创建客户收货记录主表
CustomerreturnRecordMainDO customerreturnRecordMainDO = new CustomerreturnRecordMainDO();
BeanUtils.copyProperties(mainDO, customerreturnRecordMainDO);
String number = serialNumberApi.generateCode(RuleCodeEnum.CUSTOMER_REJECT_RECORD.getCode());
customerreturnRecordMainDO.setNumber(number);
customerreturnRecordMainDO.setRequestNumber(mainDO.getNumber());
customerreturnRecordMainDO.setJobNumber(null);
customerreturnRecordMainDO.setId(null);
customerreturnRecordMainDO.setBusinessType(businesstypeDO.getCode());
customerreturnRecordMainDO.setDepartmentCode(userDepIdStr);
customerreturnRecordMainMapper.insert(customerreturnRecordMainDO);
CustomerreturnRecordDetailDO recordDetailDO = new CustomerreturnRecordDetailDO();
BeanUtils.copyProperties(customerreturnRequestDetailDO, recordDetailDO);
recordDetailDO.setMasterId(customerreturnRecordMainDO.getId());
recordDetailDO.setId(null);
recordDetailDO.setCreator(userIdStr);
recordDetailDO.setCreateTime(LocalDateTime.now());
recordDetailDO.setFromOwnerCode(customerreturnRequestDetailDO.getFromOwnerCode());
recordDetailDO.setToOwnerCode(customerreturnRequestDetailDO.getFromOwnerCode());
recordDetailDO.setFromBatch(customerreturnRequestDetailDO.getBatch());
recordDetailDO.setToBatch(customerreturnRequestDetailDO.getBatch());
recordDetailDO.setFromPackingNumber(customerreturnRequestDetailDO.getPackingNumber());
recordDetailDO.setToPackingNumber(packageDO.getNumber());
recordDetailDO.setFromLocationCode(customerreturnRequestDetailDO.getFromLocationCode());
if(StringUtils.isNotEmpty(recordDetailDO.getFromLocationCode())){
LocationDO locationDOFrom = locationService.selectLocation(recordDetailDO.getFromLocationCode());
if (locationDOFrom != null) {
recordDetailDO.setFromAreaCode(locationDOFrom.getAreaCode());
recordDetailDO.setFromLocationGroupCode(locationDOFrom.getLocationGroupCode());
}
}
recordDetailDO.setToLocationCode(customerreturnRequestDetailDO.getToLocationCode());
if(StringUtils.isNotEmpty(recordDetailDO.getToLocationCode())){
LocationDO locationDOTo = locationService.selectLocation(recordDetailDO.getToLocationCode());
if (locationDOTo != null) {
recordDetailDO.setToAreaCode(locationDOTo.getAreaCode());
recordDetailDO.setToLocationGroupCode(locationDOTo.getLocationGroupCode());
}
}
if(customerreturnConfirmationSwitchFlag){
recordDetailDO.setReceiveStatus(HoldReceiveTypeEnum.TO_BE_CONFIRMED.getCode());//待确认
}else{
recordDetailDO.setReceiveStatus(HoldReceiveTypeEnum.RECEIVED.getCode());//已接收
}
recordDetailDO.setInventoryStatus(customerreturnRequestDetailDO.getInventoryStatus());
recordDetailDO.setFromContainerNumber(customerreturnRequestDetailDO.getContainerNumber());
recordDetailDO.setToContainerNumber(customerreturnRequestDetailDO.getContainerNumber());
recordDetailDO.setQty(packageDO.getQty());
recordDetailDO.setUom(packageDO.getUom());
customerreturnRecordDetailMapper.insert(recordDetailDO);
if(!customerreturnConfirmationSwitchFlag){
// 添加库存事务list
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVO);
// 入库存事务
transactionCreateReqVO.setBusinessType(businesstypeDO.getCode());
String inTransactionType = businesstypeDO.getInTransactionType();
if (inTransactionType != null && !"".equals(inTransactionType)) {
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(inTransactionType);
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
transactionCreateReqVO.setBusinessType(customerreturnRecordMainDO.getBusinessType());
transactionCreateReqVO.setLocationCode(recordDetailDO.getToLocationCode());
transactionCreateReqVO.setOwnerCode(recordDetailDO.getToOwnerCode());
transactionCreateReqVO.setRecordNumber(number);
transactionCreateReqVO.setBatch(recordDetailDO.getToBatch());
transactionCreateReqVO.setPackingNumber(recordDetailDO.getToPackingNumber());
transactionCreateReqVO.setInventoryStatus(recordDetailDO.getInventoryStatus());
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVO.setId(null);
transactionCreateReqVO.setQty(recordDetailDO.getQty());
transactionCreateReqVO.setAmount(BigDecimal.ZERO);
transactionCreateReqVO.setSiteId(recordDetailDO.getSiteId());
transactionCreateReqVO.setArriveDate(LocalDateTime.now());
transactionCreateReqVO.setProduceDate(LocalDateTime.now());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDO = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
transactionCreateReqVO.setAreaType(areabasicDO.getType());
transactionCreateReqVO.setAreaCode(areabasicDO.getCode());
transactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(recordDetailDO.getItemCode(), areabasicDO.getCode()).getInPackUnit());
transactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(recordDetailDO.getItemCode(), transactionCreateReqVO.getPackUnit()).getPackQty());
transactionCreateReqVOList.add(transactionCreateReqVO);
}
TransactionCreateReqVO outTransactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, outTransactionCreateReqVO);
// 出库存事务
outTransactionCreateReqVO.setBusinessType(businesstypeDO.getCode());
String outTransactionType = businesstypeDO.getOutTransactionType();
if (outTransactionType != null && !"".equals(outTransactionType)) {
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(outTransactionType);
outTransactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
outTransactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
outTransactionCreateReqVO.setBusinessType(customerreturnRecordMainDO.getBusinessType());
outTransactionCreateReqVO.setLocationCode(recordDetailDO.getFromLocationCode());
outTransactionCreateReqVO.setOwnerCode(recordDetailDO.getFromOwnerCode());
outTransactionCreateReqVO.setRecordNumber(number);
outTransactionCreateReqVO.setInventoryStatus(customerreturnRequestDetailDO.getInventoryStatus());
outTransactionCreateReqVO.setBatch(recordDetailDO.getFromBatch());
outTransactionCreateReqVO.setPackingNumber(recordDetailDO.getFromPackingNumber());
outTransactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
outTransactionCreateReqVO.setId(null);
outTransactionCreateReqVO.setQty(recordDetailDO.getQty());
outTransactionCreateReqVO.setAmount(BigDecimal.ZERO);
outTransactionCreateReqVO.setSiteId(recordDetailDO.getSiteId());
outTransactionCreateReqVO.setArriveDate(LocalDateTime.now());
outTransactionCreateReqVO.setProduceDate(LocalDateTime.now());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(outTransactionCreateReqVO.getLocationCode());
outTransactionCreateReqVO.setAreaType(areabasicDOOut.getType());
outTransactionCreateReqVO.setAreaCode(areabasicDOOut.getCode());
outTransactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(recordDetailDO.getItemCode(), areabasicDOOut.getCode()).getOutPackUnit());
outTransactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(recordDetailDO.getItemCode(), outTransactionCreateReqVO.getPackUnit()).getPackQty());
transactionCreateReqVOList.add(outTransactionCreateReqVO);
}
}
}
}
}
if(!customerreturnConfirmationSwitchFlag){
// 增加库存事务
transactionService.createTransaction(transactionCreateReqVOList);
}
trendsApi.createTrends(recordMainDO.getId(), "record_customerreturn_main", null, "客户退货申请生成客户退货记录", JSONUtil.toJsonStr(recordMainDO),TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
trendsApi.createTrends(mainDO.getId(), "record_customerreturn_main", null, "客户退货申请生成客户退货记录", JSONUtil.toJsonStr(mainDO),TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
return;
}

22
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/inventorymoveRecord/InventorymoveRecordMainServiceImpl.java

@ -841,20 +841,22 @@ public class InventorymoveRecordMainServiceImpl implements InventorymoveRecordMa
//从批次 ——> 到包装
else if("BY_BATCH".equals(fromManageMode) && "BY_PACKAGING".equals(toManageMode)){
//1.校验从库位库存余额
ArrayList<String> inventoryStatus = new ArrayList<>();
inventoryStatus.add(detailDo.getFromInventoryStatus());
List<BalanceDO> fromBalanceList = balanceService.selectByBatch(detailDo.getItemCode(), detailDo.getFromBatch(), inventoryStatus, detailDo.getFromLocationCode());
if(CollectionUtil.isEmpty(fromBalanceList)){
throw exception(BALANCE_EXCEPTION,
"未找到批次:" + detailDo.getFromBatch() +
"下,库位为" + detailDo.getFromLocationCode() +
"库存状态为" + detailDo.getFromInventoryStatus() +
"物料代码为" +detailDo.getItemCode()+"的物料");
}
// ArrayList<String> inventoryStatus = new ArrayList<>();
// inventoryStatus.add(detailDo.getFromInventoryStatus());
// List<BalanceDO> fromBalanceList = balanceService.selectByBatch(detailDo.getItemCode(), detailDo.getFromBatch(), inventoryStatus, detailDo.getFromLocationCode());
// if(CollectionUtil.isEmpty(fromBalanceList)){
// throw exception(BALANCE_EXCEPTION,
// "未找到批次:" + detailDo.getFromBatch() +
// "下,库位为" + detailDo.getFromLocationCode() +
// "库存状态为" + detailDo.getFromInventoryStatus() +
// "物料代码为" +detailDo.getItemCode()+"的物料");
// }
// //2.校验到库位的包装规格是否存在,不存在则提示,存在则根据包装规格生成包装号入库
// if(StringUtils.isEmpty(detailDo.getPackUnit())){
// throw exception(PACKAGEUNIT_NOT_EXISTS);
// }
throw exception(INVENTORYMOVE_RECORD_IMPORT_MODE_NOT_SUPPORT);
}
//从包装 ——> 到批次
else if("BY_PACKAGING".equals(fromManageMode) && "BY_BATCH".equals(toManageMode)){

173
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/inventorymoveRequest/InventorymoveRequestMainServiceImpl.java

@ -54,6 +54,7 @@ import com.win.module.wms.dal.mysql.inventorymoveRecord.InventorymoveRecordMainM
import com.win.module.wms.dal.mysql.inventorymoveRequest.InventorymoveRequestDetailMapper;
import com.win.module.wms.dal.mysql.inventorymoveRequest.InventorymoveRequestMainMapper;
import com.win.module.wms.dal.mysql.warehouse.WarehouseMapper;
import com.win.module.wms.enums.common.HoldReceiveTypeEnum;
import com.win.module.wms.enums.common.InventoryStatusEnum;
import com.win.module.wms.enums.job.JobStatusEnum;
import com.win.module.wms.enums.request.RequestStatusEnum;
@ -61,6 +62,7 @@ import com.win.module.wms.enums.request.RequestStatusState;
import com.win.module.wms.service.areabasic.AreabasicService;
import com.win.module.wms.service.balance.BalanceService;
import com.win.module.wms.service.businesstype.BusinesstypeService;
import com.win.module.wms.service.documentSwitch.SwitchService;
import com.win.module.wms.service.expectin.ExpectinService;
import com.win.module.wms.service.expectout.ExpectoutService;
import com.win.module.wms.service.inventorymoveJob.InventorymoveJobMainService;
@ -163,7 +165,9 @@ public class InventorymoveRequestMainServiceImpl implements InventorymoveRequest
@Lazy
@Resource
private BalanceService balanceService;
@Lazy
@Resource
private SwitchService switchService;
@Override
@Transactional
@ -801,6 +805,7 @@ public class InventorymoveRequestMainServiceImpl implements InventorymoveRequest
inventorymoveRecordMainCreateReqVO.setCreator(null);
inventorymoveRecordMainCreateReqVO.setCreateTime(null);
inventorymoveRecordMainCreateReqVO.setRequestNumber(mainDO.getNumber());
boolean inventorymoveConfirmationSwitchFlag = false;
if ("HoldToOk".equals(mainDO.getBusinessType())) {
number = serialNumberApi.generateCode(RuleCodeEnum.HOLD_TO_OK_RECORD.getCode());
recordsettingDO = recordsettingService.selectRecordsettingExist("HoldToOkRecord");
@ -813,6 +818,11 @@ public class InventorymoveRequestMainServiceImpl implements InventorymoveRequest
number = serialNumberApi.generateCode(RuleCodeEnum.OK_TO_HOLD_RECORD.getCode());
recordsettingDO = recordsettingService.selectRecordsettingExist("OkToHoldRecord");
businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("OkToHoldRecord", "合格转隔离记录");
String inventorymoveConfirmationSwitch = switchService.selectSwitchExist("inventorymoveConfirmationSwitch").getEffectiveSetValue();
if("TRUE".equals(inventorymoveConfirmationSwitch)){
log.debug("物料隔离开启确认接收功能,请求单号:{}",mainDO.getNumber());
inventorymoveConfirmationSwitchFlag = true;
}
} else if ("HoldToScrap".equals(mainDO.getBusinessType())) {
number = serialNumberApi.generateCode(RuleCodeEnum.HOLD_TO_SCRAP_RECORD.getCode());
recordsettingDO = recordsettingService.selectRecordsettingExist("HoldToScrapRecord");
@ -877,6 +887,11 @@ public class InventorymoveRequestMainServiceImpl implements InventorymoveRequest
recordDetailDO.setToPackingNumber(inventorymoveRequestDetailDO.getToPackingNumber());
recordDetailDO.setToContainerNumber(inventorymoveRequestDetailDO.getToContainerNumber());
recordDetailDO.setToBatch(inventorymoveRequestDetailDO.getToBatch());
if(inventorymoveConfirmationSwitchFlag){
recordDetailDO.setReceiveStatus(HoldReceiveTypeEnum.TO_BE_CONFIRMED.getCode());// 待确认
}else {
recordDetailDO.setReceiveStatus(HoldReceiveTypeEnum.RECEIVED.getCode());//已接收
}
if("HoldToOk".equals(mainDO.getBusinessType())){
RuleRespVO ruleRespVO =
ruleService.grounding("", null, inventorymoveRequestDetailDO.getItemCode(), InventoryStatusEnum.OK.getCode(), null, null, null, null, null);
@ -909,89 +924,93 @@ public class InventorymoveRequestMainServiceImpl implements InventorymoveRequest
inventorymoveRecordDetailDOList.add(recordDetailDO);
//inventorymoveRecordDetailMapper.insert(recordDetailDO);
// 添加库存事务list
//查询库存余额
List<String> inventoryStatusList = new ArrayList<>();
inventoryStatusList.add(inventorymoveRequestDetailDO.getFromInventoryStatus());
BalanceDO balanceDO = balanceService.getBalanceListByStatusList(inventorymoveRequestDetailDO.getFromPackingNumber(), inventorymoveRequestDetailDO.getItemCode(), inventorymoveRequestDetailDO.getFromBatch(), inventoryStatusList, inventorymoveRequestDetailDO.getFromLocationCode());
// 入动作
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVO);
String outTransactionType = businesstypeDO.getOutTransactionType();
String inTransactionType = businesstypeDO.getInTransactionType();
if (inTransactionType != null && !"".equals(inTransactionType)) {
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(inTransactionType);
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
transactionCreateReqVO.setBusinessType(recordMainDO.getBusinessType());
transactionCreateReqVO.setOwnerCode(recordDetailDO.getToOwnerCode());
transactionCreateReqVO.setRecordNumber(recordMainDO.getNumber());
transactionCreateReqVO.setId(null);
transactionCreateReqVO.setPackingNumber(inventorymoveRequestDetailDO.getToPackingNumber());
transactionCreateReqVO.setBatch(inventorymoveRequestDetailDO.getToBatch());
if(balanceDO != null){
transactionCreateReqVO.setAltBatch(balanceDO.getAltBatch());
if(!inventorymoveConfirmationSwitchFlag){
//查询库存余额
List<String> inventoryStatusList = new ArrayList<>();
inventoryStatusList.add(inventorymoveRequestDetailDO.getFromInventoryStatus());
BalanceDO balanceDO = balanceService.getBalanceListByStatusList(inventorymoveRequestDetailDO.getFromPackingNumber(), inventorymoveRequestDetailDO.getItemCode(), inventorymoveRequestDetailDO.getFromBatch(), inventoryStatusList, inventorymoveRequestDetailDO.getFromLocationCode());
// 入动作
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVO);
String outTransactionType = businesstypeDO.getOutTransactionType();
String inTransactionType = businesstypeDO.getInTransactionType();
if (inTransactionType != null && !"".equals(inTransactionType)) {
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(inTransactionType);
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
transactionCreateReqVO.setBusinessType(recordMainDO.getBusinessType());
transactionCreateReqVO.setOwnerCode(recordDetailDO.getToOwnerCode());
transactionCreateReqVO.setRecordNumber(recordMainDO.getNumber());
transactionCreateReqVO.setId(null);
transactionCreateReqVO.setPackingNumber(inventorymoveRequestDetailDO.getToPackingNumber());
transactionCreateReqVO.setBatch(inventorymoveRequestDetailDO.getToBatch());
if(balanceDO != null){
transactionCreateReqVO.setAltBatch(balanceDO.getAltBatch());
}
transactionCreateReqVO.setContainerNumber(inventorymoveRequestDetailDO.getToContainerNumber());
transactionCreateReqVO.setInventoryStatus(inventorymoveRequestDetailDO.getToInventoryStatus());
transactionCreateReqVO.setLocationCode(recordDetailDO.getToLocationCode());
transactionCreateReqVO.setAmount(BigDecimal.ZERO);
transactionCreateReqVO.setSiteId(recordMainDO.getSiteId());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDO = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
transactionCreateReqVO.setAreaType(areabasicDO.getType());
transactionCreateReqVO.setAreaCode(areabasicDO.getCode());
transactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVO.getItemCode(), areabasicDO.getCode()).getInPackUnit());
transactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVO.getItemCode(), transactionCreateReqVO.getPackUnit()).getPackQty());
transactionCreateReqVO.setWarehouseCode(areabasicDO.getWarehouseCode());
transactionCreateReqVO.setLocationGroupCode(recordDetailDO.getToLocationGroupCode());
transactionCreateReqVOList.add(transactionCreateReqVO);
}
transactionCreateReqVO.setContainerNumber(inventorymoveRequestDetailDO.getToContainerNumber());
transactionCreateReqVO.setInventoryStatus(inventorymoveRequestDetailDO.getToInventoryStatus());
transactionCreateReqVO.setLocationCode(recordDetailDO.getToLocationCode());
transactionCreateReqVO.setAmount(BigDecimal.ZERO);
transactionCreateReqVO.setSiteId(recordMainDO.getSiteId());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDO = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
transactionCreateReqVO.setAreaType(areabasicDO.getType());
transactionCreateReqVO.setAreaCode(areabasicDO.getCode());
transactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVO.getItemCode(), areabasicDO.getCode()).getInPackUnit());
transactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVO.getItemCode(), transactionCreateReqVO.getPackUnit()).getPackQty());
transactionCreateReqVO.setWarehouseCode(areabasicDO.getWarehouseCode());
transactionCreateReqVO.setLocationGroupCode(recordDetailDO.getToLocationGroupCode());
transactionCreateReqVOList.add(transactionCreateReqVO);
}
// 出动作
TransactionCreateReqVO transactionCreateReqVOOut = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVOOut);
if (outTransactionType != null && !"".equals(outTransactionType)) {
TransactiontypeDO transactiontypeDOOut = jobUtils.selectDocumentFromTransactionType(outTransactionType);
transactionCreateReqVOOut.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVOOut.setInventoryAction(transactiontypeDOOut.getInventoryAction());
transactionCreateReqVOOut.setTransactionType(transactiontypeDOOut.getCode());
transactionCreateReqVOOut.setBusinessType(recordMainDO.getBusinessType());
transactionCreateReqVOOut.setOwnerCode(recordDetailDO.getFromOwnerCode());
transactionCreateReqVOOut.setRecordNumber(recordMainDO.getNumber());
transactionCreateReqVOOut.setId(null);
transactionCreateReqVOOut.setPackingNumber(inventorymoveRequestDetailDO.getFromPackingNumber());
transactionCreateReqVOOut.setBatch(inventorymoveRequestDetailDO.getFromBatch());
if(balanceDO != null){
transactionCreateReqVOOut.setAltBatch(balanceDO.getAltBatch());
// 出动作
TransactionCreateReqVO transactionCreateReqVOOut = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVOOut);
if (outTransactionType != null && !"".equals(outTransactionType)) {
TransactiontypeDO transactiontypeDOOut = jobUtils.selectDocumentFromTransactionType(outTransactionType);
transactionCreateReqVOOut.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVOOut.setInventoryAction(transactiontypeDOOut.getInventoryAction());
transactionCreateReqVOOut.setTransactionType(transactiontypeDOOut.getCode());
transactionCreateReqVOOut.setBusinessType(recordMainDO.getBusinessType());
transactionCreateReqVOOut.setOwnerCode(recordDetailDO.getFromOwnerCode());
transactionCreateReqVOOut.setRecordNumber(recordMainDO.getNumber());
transactionCreateReqVOOut.setId(null);
transactionCreateReqVOOut.setPackingNumber(inventorymoveRequestDetailDO.getFromPackingNumber());
transactionCreateReqVOOut.setBatch(inventorymoveRequestDetailDO.getFromBatch());
if(balanceDO != null){
transactionCreateReqVOOut.setAltBatch(balanceDO.getAltBatch());
}
transactionCreateReqVOOut.setContainerNumber(inventorymoveRequestDetailDO.getFromContainerNumber());
transactionCreateReqVOOut.setInventoryStatus(inventorymoveRequestDetailDO.getFromInventoryStatus());
transactionCreateReqVOOut.setLocationCode(inventorymoveRequestDetailDO.getFromLocationCode());
transactionCreateReqVOOut.setAmount(BigDecimal.ZERO);
transactionCreateReqVOOut.setSiteId(recordMainDO.getSiteId());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVOOut.getLocationCode());
transactionCreateReqVOOut.setAreaType(areabasicDOOut.getType());
transactionCreateReqVOOut.setAreaCode(areabasicDOOut.getCode());
transactionCreateReqVOOut.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVOOut.getItemCode(), areabasicDOOut.getCode()).getOutPackUnit());
transactionCreateReqVOOut.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVOOut.getItemCode(), transactionCreateReqVOOut.getPackUnit()).getPackQty());
transactionCreateReqVOOut.setWarehouseCode(areabasicDOOut.getWarehouseCode());
transactionCreateReqVOOut.setLocationGroupCode(recordDetailDO.getFromLocationGroupCode());
transactionCreateReqVOList.add(transactionCreateReqVOOut);
}
transactionCreateReqVOOut.setContainerNumber(inventorymoveRequestDetailDO.getFromContainerNumber());
transactionCreateReqVOOut.setInventoryStatus(inventorymoveRequestDetailDO.getFromInventoryStatus());
transactionCreateReqVOOut.setLocationCode(inventorymoveRequestDetailDO.getFromLocationCode());
transactionCreateReqVOOut.setAmount(BigDecimal.ZERO);
transactionCreateReqVOOut.setSiteId(recordMainDO.getSiteId());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVOOut.getLocationCode());
transactionCreateReqVOOut.setAreaType(areabasicDOOut.getType());
transactionCreateReqVOOut.setAreaCode(areabasicDOOut.getCode());
transactionCreateReqVOOut.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVOOut.getItemCode(), areabasicDOOut.getCode()).getOutPackUnit());
transactionCreateReqVOOut.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVOOut.getItemCode(), transactionCreateReqVOOut.getPackUnit()).getPackQty());
transactionCreateReqVOOut.setWarehouseCode(areabasicDOOut.getWarehouseCode());
transactionCreateReqVOOut.setLocationGroupCode(recordDetailDO.getFromLocationGroupCode());
transactionCreateReqVOList.add(transactionCreateReqVOOut);
}
}
//默认日期
for (TransactionCreateReqVO loop : transactionCreateReqVOList) {
loop.setArriveDate(LocalDateTime.now());
loop.setProduceDate(LocalDateTime.now());
loop.setActiveTime(LocalDateTime.now());
loop.setExpireDate(LocalDateTimeUtils.max());
}
// 增加库存事务
transactionService.createTransaction(transactionCreateReqVOList);
if (!inventorymoveRecordDetailDOList.isEmpty()) {
inventorymoveRecordDetailMapper.insertBatch(inventorymoveRecordDetailDOList);
}
if(!inventorymoveConfirmationSwitchFlag){
//默认日期
for (TransactionCreateReqVO loop : transactionCreateReqVOList) {
loop.setArriveDate(LocalDateTime.now());
loop.setProduceDate(LocalDateTime.now());
loop.setActiveTime(LocalDateTime.now());
loop.setExpireDate(LocalDateTimeUtils.max());
}
// 增加库存事务
transactionService.createTransaction(transactionCreateReqVOList);
}
trendsApi.createTrends(recordMainDO.getId(), "record_inventorymove_main", null, "库存转移申请生成库存转移记录", JSONUtil.toJsonStr(recordMainDO),TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
return;
}

195
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionreturnRequest/ProductionreturnRequestMainServiceImpl.java

@ -52,11 +52,13 @@ import com.win.module.wms.dal.mysql.productionreturnRecord.ProductionreturnRecor
import com.win.module.wms.dal.mysql.productionreturnRecord.ProductionreturnRecordMainMapper;
import com.win.module.wms.dal.mysql.productionreturnRequest.ProductionreturnRequestDetailMapper;
import com.win.module.wms.dal.mysql.productionreturnRequest.ProductionreturnRequestMainMapper;
import com.win.module.wms.enums.common.HoldReceiveTypeEnum;
import com.win.module.wms.enums.common.InventoryStatusEnum;
import com.win.module.wms.enums.job.JobStatusEnum;
import com.win.module.wms.enums.request.RequestStatusEnum;
import com.win.module.wms.enums.request.RequestStatusState;
import com.win.module.wms.service.businesstype.BusinesstypeService;
import com.win.module.wms.service.documentSwitch.SwitchService;
import com.win.module.wms.service.expectin.ExpectinService;
import com.win.module.wms.service.itembasic.ItembasicService;
import com.win.module.wms.service.itempackage.ItempackageService;
@ -73,6 +75,7 @@ import com.win.module.wms.service.transaction.TransactionService;
import com.win.module.wms.service.workshop.WorkshopService;
import com.win.module.wms.service.workstation.WorkstationService;
import com.win.module.wms.util.JobUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
@ -97,6 +100,7 @@ import static com.win.module.wms.enums.ErrorCodeConstants.*;
*
* @author 超级管理员
*/
@Slf4j
@Service
@Validated
public class ProductionreturnRequestMainServiceImpl implements ProductionreturnRequestMainService {
@ -163,6 +167,9 @@ public class ProductionreturnRequestMainServiceImpl implements ProductionreturnR
private AreabasicMapper areabasicMapper;
@Resource
private LocationMapper locationMapper;
@Lazy
@Resource
private SwitchService switchService;
@Override
@Transactional
@ -814,6 +821,21 @@ public class ProductionreturnRequestMainServiceImpl implements ProductionreturnR
List<PackageDO> packageDOList = packageService.getPackageListByRequestNumber(mainDO.getNumber());
// 增加业务类型
BusinesstypeDO businesstypeDO = null;
String inventoryStatus;
boolean productionreturnConfirmationSwitchFlag = false;
if (mainDO.getBusinessType().equals("ReturnToStore")) {
businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("ReturnToStoreRecord", "生产退料记录");
inventoryStatus = "OK";
} else { // 隔离
businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("ReturnToHoldRecord", "隔离退料记录");
inventoryStatus = "HOLD";
String inventorymoveConfirmationSwitch = switchService.selectSwitchExist("productionreturnConfirmationSwitch").getEffectiveSetValue();
if("TRUE".equals(inventorymoveConfirmationSwitch)){
log.debug("隔离退料开启确认接收功能,申请单号:{}",mainDO.getNumber());
productionreturnConfirmationSwitchFlag = true;
}
}
// 库存事务
List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>();
for (ProductionreturnRequestDetailDO productionreturnRequestDetailDO : detailDOList) {
@ -843,17 +865,6 @@ public class ProductionreturnRequestMainServiceImpl implements ProductionreturnR
productionreturnRecordDetailDO.setFromContainerNumber(productionreturnRequestDetailDO.getContainerNumber());
productionreturnRecordDetailDO.setToContainerNumber(productionreturnRequestDetailDO.getContainerNumber());
productionreturnRecordDetailDO.setQty(productionreturnRequestDetailDO.getQty());
String inventoryStatus;
// 判断是合格还是隔离
// 合格
if (mainDO.getBusinessType().equals("ReturnToStore")) {
businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("ReturnToStoreRecord", "生产退料记录");
inventoryStatus = "OK";
} else { // 隔离
businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("ReturnToHoldRecord", "退料上架记录");
inventoryStatus = "HOLD";
}
// 20240802 cxm 不走推荐 走目标库位
String locationCode = productionreturnRequestDetailDO.getToLocationCode();
productionreturnRecordDetailDO.setToLocationCode(locationCode);
@ -871,6 +882,7 @@ public class ProductionreturnRequestMainServiceImpl implements ProductionreturnR
list.add(productionreturnRecordDetailDO);
listMap.put(productionreturnRecordDetailDO.getToLocationCode(), list);
}
for (String mapKey : listMap.keySet()) {
// 记录主表信息
ProductionreturnRecordMainDO productionreturnRecordMainDO = new ProductionreturnRecordMainDO();
@ -898,6 +910,7 @@ public class ProductionreturnRequestMainServiceImpl implements ProductionreturnR
productionreturnRecordMainDO.setUpdater(null);
productionreturnRecordMainDO.setDepartmentCode(userApi.getUser(getLoginUserId()).getDeptId().toString());
productionreturnRecordMainMapper.insert(productionreturnRecordMainDO);
// 根据申请子表数据进行分析
List<ProductionreturnRecordDetailDO> productionreturnRecordDetailDOListRs = new ArrayList<>();
for (ProductionreturnRecordDetailDO productionreturnRecordDetailDO : listMap.get(mapKey)) {
@ -910,85 +923,95 @@ public class ProductionreturnRequestMainServiceImpl implements ProductionreturnR
LocationDO locationDOTo = locationService.selectLocation(productionreturnRecordDetailDO.getToLocationCode());
productionreturnRecordDetailDO.setToLocationGroupCode(locationDOTo.getLocationGroupCode());
productionreturnRecordDetailDO.setToAreaCode(locationDOTo.getAreaCode());
// 添加库存事务list
// 入动作
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(productionreturnRecordDetailDO, transactionCreateReqVO);
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getInTransactionType());
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
transactionCreateReqVO.setBusinessType(productionreturnRecordMainDO.getBusinessType());
transactionCreateReqVO.setOwnerCode(productionreturnRecordDetailDO.getFromOwnerCode());
transactionCreateReqVO.setRecordNumber(number);
transactionCreateReqVO.setId(null);
transactionCreateReqVO.setPackingNumber(productionreturnRecordDetailDO.getToPackingNumber());
transactionCreateReqVO.setBatch(productionreturnRecordDetailDO.getToBatch());
transactionCreateReqVO.setContainerNumber(productionreturnRecordDetailDO.getToContainerNumber());
transactionCreateReqVO.setAmount(BigDecimal.ZERO);
transactionCreateReqVO.setLocationCode(productionreturnRecordDetailDO.getToLocationCode());
transactionCreateReqVO.setQty(productionreturnRecordDetailDO.getQty());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDO = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
transactionCreateReqVO.setAreaType(areabasicDO.getType());
transactionCreateReqVO.setAreaCode(areabasicDO.getCode());
transactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVO.getItemCode(), areabasicDO.getCode()).getInPackUnit());
transactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVO.getItemCode(), transactionCreateReqVO.getPackUnit()).getPackQty());
transactionCreateReqVO.setWarehouseCode(areabasicDO.getWarehouseCode());
LocationDO toTocationDOTransaction = locationService.queryByCode(productionreturnRecordDetailDO.getToLocationCode());
transactionCreateReqVO.setLocationGroupCode(toTocationDOTransaction.getLocationGroupCode());
transactionCreateReqVO.setSiteId(productionreturnRecordDetailDO.getSiteId());
// 到货日期 生产日期 生效日期 失效日期
transactionCreateReqVO.setArriveDate(LocalDateTime.now());
transactionCreateReqVO.setProduceDate(LocalDateTime.now());
transactionCreateReqVO.setActiveTime(LocalDateTime.now());
transactionCreateReqVO.setExpireDate(LocalDateTimeUtils.max());
transactionCreateReqVOList.add(transactionCreateReqVO);
// 出动作
TransactionCreateReqVO transactionCreateReqVOOut = new TransactionCreateReqVO();
BeanUtils.copyProperties(productionreturnRecordDetailDO, transactionCreateReqVOOut);
TransactiontypeDO transactiontypeDOOut = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getOutTransactionType());
transactionCreateReqVOOut.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVOOut.setInventoryAction(transactiontypeDOOut.getInventoryAction());
transactionCreateReqVOOut.setTransactionType(transactiontypeDOOut.getCode());
transactionCreateReqVOOut.setBusinessType(productionreturnRecordMainDO.getBusinessType());
transactionCreateReqVOOut.setOwnerCode(productionreturnRecordDetailDO.getFromOwnerCode());
transactionCreateReqVOOut.setRecordNumber(number);
transactionCreateReqVOOut.setId(null);
// 去箱去批 统一 由库存事务 处理
transactionCreateReqVOOut.setBatch(productionreturnRecordDetailDO.getFromBatch());
transactionCreateReqVOOut.setPackingNumber(productionreturnRecordDetailDO.getFromPackingNumber());
// transactionCreateReqVOOut.setPackingNumber("");
// transactionCreateReqVOOut.setBatch("");
transactionCreateReqVOOut.setInventoryStatus(InventoryStatusEnum.OK.getCode());
transactionCreateReqVOOut.setContainerNumber(productionreturnRecordDetailDO.getFromContainerNumber());
transactionCreateReqVOOut.setAmount(BigDecimal.ZERO);
transactionCreateReqVOOut.setWarehouseCode(productionreturnRecordMainDO.getFromWarehouseCode());
transactionCreateReqVOOut.setLocationCode(productionreturnRecordDetailDO.getFromLocationCode());
transactionCreateReqVOOut.setQty(productionreturnRecordDetailDO.getQty());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVOOut.getLocationCode());
transactionCreateReqVOOut.setAreaType(areabasicDOOut.getType());
transactionCreateReqVOOut.setAreaCode(areabasicDOOut.getCode());
transactionCreateReqVOOut.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVOOut.getItemCode(), areabasicDOOut.getCode()).getOutPackUnit());
transactionCreateReqVOOut.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVOOut.getItemCode(), transactionCreateReqVOOut.getPackUnit()).getPackQty());
transactionCreateReqVOOut.setWarehouseCode(areabasicDO.getWarehouseCode());
LocationDO fromLocationDOTransaction = locationService.queryByCode(productionreturnRecordDetailDO.getFromLocationCode());
transactionCreateReqVOOut.setLocationGroupCode(fromLocationDOTransaction.getLocationGroupCode());
transactionCreateReqVOOut.setSiteId(productionreturnRecordDetailDO.getSiteId());
// 到货日期 生产日期 生效日期 失效日期
transactionCreateReqVOOut.setArriveDate(LocalDateTime.now());
transactionCreateReqVOOut.setProduceDate(LocalDateTime.now());
transactionCreateReqVOOut.setActiveTime(LocalDateTime.now());
transactionCreateReqVOOut.setExpireDate(LocalDateTimeUtils.max());
transactionCreateReqVOList.add(transactionCreateReqVOOut);
productionreturnRecordDetailDOListRs.add(productionreturnRecordDetailDO);
if(productionreturnConfirmationSwitchFlag){
productionreturnRecordDetailDO.setReceiveStatus(HoldReceiveTypeEnum.TO_BE_CONFIRMED.getCode());//待确认
}else {
productionreturnRecordDetailDO.setReceiveStatus(HoldReceiveTypeEnum.RECEIVED.getCode());//已接收
}
if(!productionreturnConfirmationSwitchFlag){
// 添加库存事务list
// 入动作
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(productionreturnRecordDetailDO, transactionCreateReqVO);
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getInTransactionType());
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
transactionCreateReqVO.setBusinessType(productionreturnRecordMainDO.getBusinessType());
transactionCreateReqVO.setOwnerCode(productionreturnRecordDetailDO.getFromOwnerCode());
transactionCreateReqVO.setRecordNumber(number);
transactionCreateReqVO.setId(null);
transactionCreateReqVO.setPackingNumber(productionreturnRecordDetailDO.getToPackingNumber());
transactionCreateReqVO.setBatch(productionreturnRecordDetailDO.getToBatch());
transactionCreateReqVO.setContainerNumber(productionreturnRecordDetailDO.getToContainerNumber());
transactionCreateReqVO.setAmount(BigDecimal.ZERO);
transactionCreateReqVO.setLocationCode(productionreturnRecordDetailDO.getToLocationCode());
transactionCreateReqVO.setQty(productionreturnRecordDetailDO.getQty());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDO = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
transactionCreateReqVO.setAreaType(areabasicDO.getType());
transactionCreateReqVO.setAreaCode(areabasicDO.getCode());
transactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVO.getItemCode(), areabasicDO.getCode()).getInPackUnit());
transactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVO.getItemCode(), transactionCreateReqVO.getPackUnit()).getPackQty());
transactionCreateReqVO.setWarehouseCode(areabasicDO.getWarehouseCode());
LocationDO toTocationDOTransaction = locationService.queryByCode(productionreturnRecordDetailDO.getToLocationCode());
transactionCreateReqVO.setLocationGroupCode(toTocationDOTransaction.getLocationGroupCode());
transactionCreateReqVO.setSiteId(productionreturnRecordDetailDO.getSiteId());
// 到货日期 生产日期 生效日期 失效日期
transactionCreateReqVO.setArriveDate(LocalDateTime.now());
transactionCreateReqVO.setProduceDate(LocalDateTime.now());
transactionCreateReqVO.setActiveTime(LocalDateTime.now());
transactionCreateReqVO.setExpireDate(LocalDateTimeUtils.max());
transactionCreateReqVOList.add(transactionCreateReqVO);
// 出动作
TransactionCreateReqVO transactionCreateReqVOOut = new TransactionCreateReqVO();
BeanUtils.copyProperties(productionreturnRecordDetailDO, transactionCreateReqVOOut);
TransactiontypeDO transactiontypeDOOut = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getOutTransactionType());
transactionCreateReqVOOut.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVOOut.setInventoryAction(transactiontypeDOOut.getInventoryAction());
transactionCreateReqVOOut.setTransactionType(transactiontypeDOOut.getCode());
transactionCreateReqVOOut.setBusinessType(productionreturnRecordMainDO.getBusinessType());
transactionCreateReqVOOut.setOwnerCode(productionreturnRecordDetailDO.getFromOwnerCode());
transactionCreateReqVOOut.setRecordNumber(number);
transactionCreateReqVOOut.setId(null);
// 去箱去批 统一 由库存事务 处理
transactionCreateReqVOOut.setBatch(productionreturnRecordDetailDO.getFromBatch());
transactionCreateReqVOOut.setPackingNumber(productionreturnRecordDetailDO.getFromPackingNumber());
// transactionCreateReqVOOut.setPackingNumber("");
// transactionCreateReqVOOut.setBatch("");
transactionCreateReqVOOut.setInventoryStatus(InventoryStatusEnum.OK.getCode());
transactionCreateReqVOOut.setContainerNumber(productionreturnRecordDetailDO.getFromContainerNumber());
transactionCreateReqVOOut.setAmount(BigDecimal.ZERO);
transactionCreateReqVOOut.setWarehouseCode(productionreturnRecordMainDO.getFromWarehouseCode());
transactionCreateReqVOOut.setLocationCode(productionreturnRecordDetailDO.getFromLocationCode());
transactionCreateReqVOOut.setQty(productionreturnRecordDetailDO.getQty());
// 根据 库位 获取 库区DO
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVOOut.getLocationCode());
transactionCreateReqVOOut.setAreaType(areabasicDOOut.getType());
transactionCreateReqVOOut.setAreaCode(areabasicDOOut.getCode());
transactionCreateReqVOOut.setPackUnit(jobUtils.getItemareaDO(transactionCreateReqVOOut.getItemCode(), areabasicDOOut.getCode()).getOutPackUnit());
transactionCreateReqVOOut.setPackQty(jobUtils.getItempackageDO(transactionCreateReqVOOut.getItemCode(), transactionCreateReqVOOut.getPackUnit()).getPackQty());
transactionCreateReqVOOut.setWarehouseCode(areabasicDO.getWarehouseCode());
LocationDO fromLocationDOTransaction = locationService.queryByCode(productionreturnRecordDetailDO.getFromLocationCode());
transactionCreateReqVOOut.setLocationGroupCode(fromLocationDOTransaction.getLocationGroupCode());
transactionCreateReqVOOut.setSiteId(productionreturnRecordDetailDO.getSiteId());
// 到货日期 生产日期 生效日期 失效日期
transactionCreateReqVOOut.setArriveDate(LocalDateTime.now());
transactionCreateReqVOOut.setProduceDate(LocalDateTime.now());
transactionCreateReqVOOut.setActiveTime(LocalDateTime.now());
transactionCreateReqVOOut.setExpireDate(LocalDateTimeUtils.max());
transactionCreateReqVOList.add(transactionCreateReqVOOut);
productionreturnRecordDetailDOListRs.add(productionreturnRecordDetailDO);
}
}
trendsApi.createTrends(productionreturnRecordMainDO.getId(), "record_productionreturn_main", null, "生产退料申请直接生成记录", JSONUtil.toJsonStr(productionreturnRecordMainDO),TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
}
productionreturnRecordDetailMapper.insertBatch(productionreturnRecordDetailDOList);
// 增加库存事务
transactionService.createTransaction(transactionCreateReqVOList);
if(!productionreturnConfirmationSwitchFlag){
// 增加库存事务
transactionService.createTransaction(transactionCreateReqVOList);
}
// 更新申请状态为已完成
mainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
productionreturnRequestMainMapper.updateById(mainDO);

376
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productionscrapRequest/ProductionscrapRequestMainServiceImpl.java

@ -2,11 +2,15 @@ package com.win.module.wms.service.productionscrapRequest;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.qms.api.InspectionQ3.InspectionQ3Api;
import com.win.module.system.api.serialnumber.SerialNumberApi;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.system.enums.serialNumber.RuleCodeEnum;
@ -17,27 +21,42 @@ import com.win.module.wms.convert.productionscrapRequest.ProductionscrapRequestM
import com.win.module.wms.dal.dataobject.areabasic.AreabasicDO;
import com.win.module.wms.dal.dataobject.balance.BalanceDO;
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO;
import com.win.module.wms.dal.dataobject.interfaceinfo.InterfaceInfoDO;
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO;
import com.win.module.wms.dal.dataobject.location.LocationDO;
import com.win.module.wms.dal.dataobject.mstr.MstrDO;
import com.win.module.wms.dal.dataobject.productionscrapRecord.ProductionscrapRecordDetailDO;
import com.win.module.wms.dal.dataobject.productionscrapRecord.ProductionscrapRecordMainDO;
import com.win.module.wms.dal.dataobject.productionscrapRequest.ProductionscrapRequestDetailDO;
import com.win.module.wms.dal.dataobject.productionscrapRequest.ProductionscrapRequestMainDO;
import com.win.module.wms.dal.dataobject.qadCostcentre.QadCostcentreDO;
import com.win.module.wms.dal.dataobject.qadProject.QadProjectDO;
import com.win.module.wms.dal.dataobject.recordsetting.RecordsettingDO;
import com.win.module.wms.dal.dataobject.requestsetting.RequestsettingDO;
import com.win.module.wms.dal.dataobject.stdcostprice.StdcostpriceDO;
import com.win.module.wms.dal.dataobject.subjectaccount.SubjectAccountDO;
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO;
import com.win.module.wms.dal.dataobject.workshop.WorkshopDO;
import com.win.module.wms.dal.dataobject.workstation.WorkstationDO;
import com.win.module.wms.dal.mysql.balance.BalanceMapper;
import com.win.module.wms.dal.mysql.location.LocationMapper;
import com.win.module.wms.dal.mysql.mstr.MstrMapper;
import com.win.module.wms.dal.mysql.productionscrapRecord.ProductionscrapRecordDetailMapper;
import com.win.module.wms.dal.mysql.productionscrapRecord.ProductionscrapRecordMainMapper;
import com.win.module.wms.dal.mysql.productionscrapRequest.ProductionscrapRequestDetailMapper;
import com.win.module.wms.dal.mysql.productionscrapRequest.ProductionscrapRequestMainMapper;
import com.win.module.wms.dal.mysql.qadCostcentre.QadCostcentreMapper;
import com.win.module.wms.dal.mysql.qadProject.QadProjectMapper;
import com.win.module.wms.dal.mysql.subjectaccount.SubjectAccountMapper;
import com.win.module.wms.dal.mysql.workstation.WorkstationMapper;
import com.win.module.wms.enums.common.InterfaceTypeEnum;
import com.win.module.wms.enums.common.InventoryStatusEnum;
import com.win.module.wms.enums.request.RequestStatusEnum;
import com.win.module.wms.enums.request.RequestStatusState;
import com.win.module.wms.service.accountcalendar.AccountcalendarService;
import com.win.module.wms.service.balance.BalanceService;
import com.win.module.wms.service.interfaceinfo.InterfaceInfoService;
import com.win.module.wms.service.interfaceinfo.dto.UnplannedissueRecordDTO;
import com.win.module.wms.service.itembasic.ItembasicService;
import com.win.module.wms.service.itempackage.ItempackageService;
import com.win.module.wms.service.location.LocationService;
@ -51,6 +70,8 @@ import com.win.module.wms.service.transaction.TransactionService;
import com.win.module.wms.service.workshop.WorkshopService;
import com.win.module.wms.service.workstation.WorkstationService;
import com.win.module.wms.util.JobUtils;
import com.win.module.wms.util.LocalDateTimeAdapter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
@ -59,6 +80,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
@ -74,6 +97,7 @@ import static com.win.module.wms.enums.ErrorCodeConstants.*;
*
* @author 超级管理员
*/
@Slf4j
@Service
@Validated
public class ProductionscrapRequestMainServiceImpl implements ProductionscrapRequestMainService {
@ -132,6 +156,28 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
@Lazy
@Resource
private StdcostpriceService stdcostpriceService;
@Resource
private SubjectAccountMapper subjectAccountMapper;
@Resource
private MstrMapper mstrMapper;
@Lazy
@Resource
private AccountcalendarService accountcalendarService;
@Lazy
@Resource
private InterfaceInfoService interfaceInfoService;
@Resource
private InspectionQ3Api inspectionQ3Api;
@Resource
private QadCostcentreMapper qadCostcentreMapper;
@Resource
private WorkstationMapper workstationMapper;
@Resource
private QadProjectMapper qadProjectMapper;
@Lazy
@Resource
private BalanceService balanceService;
@Override
@Transactional
@ -166,11 +212,63 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
if(itembasicDO != null){
itemTypeSet.add(itembasicDO.getType());
}
// 校验生产线代码
validatorProductionline(detailDO.getProductionLineCode());
// 如果生产线不为空
if(StringUtils.isNotEmpty(detailDO.getProductionLineCode())){
// 校验生产线代码
validatorProductionline(detailDO.getProductionLineCode());
}
// 校验工位是否存在
validatorWorkStation(mainDo.getWorkshopCode(), detailDO.getProductionLineCode(), detailDO.getWorkStationCode());
String reasonCodeRequisition = mainDo.getReasonCodeRequisition();
if(StringUtils.isNotEmpty(reasonCodeRequisition)){
LambdaQueryWrapperX<SubjectAccountDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
lambdaQueryWrapperX.eq(SubjectAccountDO::getCode,reasonCodeRequisition);
lambdaQueryWrapperX.eq(SubjectAccountDO::getCostcentreType,mainDo.getCostCenterType());
SubjectAccountDO subjectAccountDO = subjectAccountMapper.selectOne(lambdaQueryWrapperX);
mainDo.setQadTtunrcisAcc(subjectAccountDO.getAccountingAccount());
if(subjectAccountDO != null){
if("TRUE".equals(subjectAccountDO.getIsFromPlMstr())){
// 产品类
String prodCla = itembasicDO.getProdCla();
if(StringUtils.isNotEmpty(prodCla)){
LambdaQueryWrapperX<MstrDO> mstrDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
mstrDOLambdaQueryWrapperX.eq(MstrDO::getPlProdLine,prodCla);
List<MstrDO> mstrDOS = mstrMapper.selectList(mstrDOLambdaQueryWrapperX);
if(mstrDOS != null && mstrDOS.size() > 0){
MstrDO mstrDO = mstrDOS.get(0);
if("A".equals(subjectAccountDO.getPlMstrType())){
detailDO.setQadTtunrcisAcc(mstrDO.getPlMvarAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlMvarCc());
}else if("B".equals(subjectAccountDO.getPlMstrType())) {
detailDO.setQadTtunrcisAcc(mstrDO.getPlCchgAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlCchgCc());
}else if("C".equals(subjectAccountDO.getPlMstrType())){
detailDO.setQadTtunrcisAcc(mstrDO.getPlScrpAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlScrpCc());
}else if("D".equals(subjectAccountDO.getPlMstrType())){
detailDO.setQadTtunrcisAcc(mstrDO.getPlDscrAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlDscrCc());
}else {
log.debug("计划外出库,客户账户产品类型不存在的类型");
}
}
}
}else {
// 不是来自产品类取科目账户配置表的会计账户
detailDO.setQadTtunrcisAcc(subjectAccountDO.getAccountingAccount());
detailDO.setQadPlCostCenter(mainDo.getCostCenterCode());//成本中心
}
}
}
detailDO.setQadProjectCode(detailDO.getProjectCode());
if(detailDO.getSinglePrice() != null){
detailDO.setSinglePrice(detailDO.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}
if(detailDO.getAmount() != null){
detailDO.setAmount(detailDO.getAmount().setScale(2,RoundingMode.HALF_UP));
}
}
if(itemTypeSet.size() > 1){
// 校验 子表数据 物料类型要一致性(创建标签时 前端好判断 否则前端无法实现)
// 线边原料报废子列物料类型不是统一的一个类型不能处理
@ -201,45 +299,6 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
detailDO.setUpdateTime(LocalDateTime.now());
detailDO.setRemark(null);
subDOListPack.add(detailDO);
// BigDecimal itemPackagingDOQty = BigDecimal.ZERO;
// if(StringUtils.isEmpty(detailDO.getPackUnit())){
// // 修改 包装规格及包装数量 从前端选择来 20240326 cxm -----取消
// // 获取标包信息
// ItempackageDO itemPackagingDO = jobUtils.getItempackageDOByItemCodeAndLocationCodeAndInOrOut(detailDO.getItemCode(), detailDO.getFromLocationCode(), "in");
// // 获取标包数量
// itemPackagingDOQty = itemPackagingDO.getPackQty();
// detailDO.setPackUnit(itemPackagingDO.getPackUnit());
// detailDO.setPackQty(itemPackagingDOQty);
// }else {
// // 20240729 zxb 如果页面选择了包装和数量,则用用户选择的
// itemPackagingDOQty = detailDO.getPackQty();
// detailDO.setPackQty(itemPackagingDOQty);
// }
// // 库存余额输入数量
// BigDecimal detailDOQty = detailDO.getQty();
// // 判断 库存余额输入的数量 大于 标包数 进行拆分
// if (detailDO.getQty().compareTo(itemPackagingDOQty) == 1) {
// // 库存余额 除以 标包 保留0位 具体子表 例如:保留1位 1.60-1.6 1.61-1.7 1.66-1.7 -1.62--1.7
// // 拆分数据总条数 bdCount
// BigDecimal bdCount = detailDOQty.divide(itemPackagingDOQty, 0, BigDecimal.ROUND_UP);
// int forInt = bdCount.intValue();
// // 最后一条数据 插入数量 residueQty = 库存余额数 - (拆分数据总条数-1)*标包数
// BigDecimal residueQty = detailDOQty.subtract(itemPackagingDOQty.multiply(bdCount.subtract(new BigDecimal(1))));
// for (int i = 0; i < forInt; i++) {
// ProductionscrapRequestDetailDO detailDOPack = new ProductionscrapRequestDetailDO();
// BeanUtils.copyProperties(detailDO, detailDOPack);
// // 最后一条数据 插入数量
// if (i == (forInt - 1)) {
// detailDOPack.setQty(residueQty);
// } else {
// detailDOPack.setQty(detailDO.getPackQty());
// }
// subDOListPack.add(detailDOPack);
// }
// } else {
// // 判断 库存余额输入的数量 小于等于 标包数
// subDOListPack.add(detailDO);
// }
}
productionscrapRequestDetailMapper.insertBatch(subDOListPack);
return mainDo;
@ -250,7 +309,6 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
detailDO.setItemDesc1(itembasicDO.getDesc1());
detailDO.setItemDesc2(itembasicDO.getDesc2());
detailDO.setItemName(itembasicDO.getName());
detailDO.setProjectCode(itembasicDO.getProject());
detailDO.setUom(itembasicDO.getUom());
}
@ -274,7 +332,14 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
// 更新
ProductionscrapRequestMainDO updateObj = ProductionscrapRequestMainConvert.INSTANCE.convert(updateReqVO);
trendsApi.createTrends(updateObj.getId(), "request_productionscrap_main", JSONUtil.toJsonStr(oldObj), "修改了线边原料报废申请", JSONUtil.toJsonStr(updateObj),TrendsTypeEnum.UPDATE, String.valueOf(getLoginUserId()));
return productionscrapRequestMainMapper.updateById(updateObj);
int cnt = productionscrapRequestMainMapper.updateById(updateObj);
if(StringUtils.isNotEmpty(updateReqVO.getProductionLineCode())){
LambdaUpdateWrapper<ProductionscrapRequestDetailDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(ProductionscrapRequestDetailDO::getProductionLineCode,updateReqVO.getProductionLineCode());
updateWrapper.eq(ProductionscrapRequestDetailDO::getMasterId,updateObj.getId());
productionscrapRequestDetailMapper.update(new ProductionscrapRequestDetailDO(),updateWrapper);
}
return cnt;
}
@Override
@ -429,6 +494,7 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
@Transactional
public void generateJob(ProductionscrapRequestMainDO mainDO, List<ProductionscrapRequestDetailDO> detailList) {
Long loginUserId = getLoginUserId();
// 跳过任务直接生成记录
if("TRUE".equals(mainDO.getDirectCreateRecord())){
ProductionscrapRecordMainDO productionscrapRecordMainDO = new ProductionscrapRecordMainDO();
@ -455,7 +521,7 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
productionscrapRecordMainDO.setCreator(null);
productionscrapRecordMainDO.setUpdateTime(null);
productionscrapRecordMainDO.setUpdater(null);
productionscrapRecordMainDO.setDepartmentCode(userApi.getUser(getLoginUserId()).getDeptId().toString());
productionscrapRecordMainDO.setDepartmentCode(userApi.getUser(loginUserId).getDeptId().toString());
productionscrapRecordMainMapper.insert(productionscrapRecordMainDO);
// 库存事务
@ -593,6 +659,62 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
mainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
productionscrapRequestMainMapper.updateById(mainDO);
trendsApi.createTrends(productionscrapRecordMainDO.getId(), "record_productionscrap_main", null, "线边原料报废直接生成记录", JSONUtil.toJsonStr(productionscrapRecordMainDO), TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
List<UnplannedissueRecordDTO> dtoList = new ArrayList<>();
List<ProductionscrapRecordDetailDO> detailDOList = productionscrapRecordDetailMapper.selectListByMasterId(productionscrapRecordMainDO.getId());
for (ProductionscrapRecordDetailDO productionscrapRecordDetailDO : detailDOList) {
UnplannedissueRecordDTO unplannedissueRecordDTO = new UnplannedissueRecordDTO();
BeanUtils.copyProperties(productionscrapRecordMainDO, unplannedissueRecordDTO);
BeanUtils.copyProperties(productionscrapRecordDetailDO, unplannedissueRecordDTO);
String qadUnplannedissueNumber = serialNumberApi.generateCode(RuleCodeEnum.QAD_UNPLANNEDISSUE_NUMBER.getCode());
unplannedissueRecordDTO.setQadNumber(qadUnplannedissueNumber);
LocationDO locationDO = locationService.selectLocation(productionscrapRecordDetailDO.getFromLocationCode());
if (StringUtils.isEmpty(locationDO.getQadLocationCode())) {
throw exception(LOCATION_QAD_EXCEPTION, locationDO.getCode() + "该库位QAD不存在");
}
unplannedissueRecordDTO.setProjectCode(productionscrapRecordDetailDO.getQadProjectCode());
unplannedissueRecordDTO.setQadLocationCode(locationDO.getQadLocationCode());
unplannedissueRecordDTO.setRemark(productionscrapRecordMainDO.getLineScrapReason());
dtoList.add(unplannedissueRecordDTO);
}
if (dtoList.size() > 0) {
// 过来物料是否为ERP管理
List<UnplannedissueRecordDTO> filterList = new ArrayList<>();
for (UnplannedissueRecordDTO unplannedissueRecordDTO : dtoList) {
ItembasicDO itembasicDO = itembasicService.getItembasicBycode(unplannedissueRecordDTO.getItemCode());
if (itembasicDO == null) {
continue;
}
if ("TRUE".equals(itembasicDO.getIsOutErp())) {
continue;
} else {
filterList.add(unplannedissueRecordDTO);
}
}
if (filterList.size() > 0) {
// 添加到接口记录表
Gson gson = new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter()).serializeNulls().create();
InterfaceInfoDO interfaceInfoDO = new InterfaceInfoDO();
interfaceInfoDO.setNumber("post" + "_" + InterfaceTypeEnum.RECORD_UNPLANNEDISSUE_MAIN.getCode() + '_' + productionscrapRecordMainDO.getId());
interfaceInfoDO.setInterfaceType("WMS-QAD");
interfaceInfoDO.setInterfaceName("推送计划外出库记录");
interfaceInfoDO.setUrl("/wms/unplannedissue-job-main/execute");
// 根据当前时间调用账期日历获取有效时间
LocalDateTime activeTime = accountcalendarService.getAccountCalendar();
for (UnplannedissueRecordDTO dto : filterList) {
dto.setSystemCreateTime(LocalDateTime.now());
dto.setActiveDate(activeTime);
}
interfaceInfoDO.setReqBody(gson.toJson(filterList));
interfaceInfoDO.setCreator(loginUserId.toString());
interfaceInfoDO.setCreateTime(LocalDateTime.now());
interfaceInfoDO.setInterfaceStatus("3");
interfaceInfoDO.setBusinessNumber(productionscrapRecordMainDO.getNumber());
interfaceInfoDO.setBusinessId(productionscrapRecordMainDO.getId());
interfaceInfoDO.setRemark("功能模块--线边报废申请--生成记录");
interfaceInfoService.insertInterfaceData(interfaceInfoDO);
}
}
return;
}
}
@ -682,38 +804,119 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
private String validatorProductionscrapRequestDetailImport(ProductionscrapRequestDetailDO detailDO, ProductionscrapRequestMainDO mainDo) {
StringBuilder message = new StringBuilder();
try {
this.validatorProductionline(detailDO.getProductionLineCode());
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
// 生产线校验
if(StringUtils.isNotEmpty(detailDO.getProductionLineCode())){
try {
this.validatorProductionline(detailDO.getProductionLineCode());
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
}
}
try {
WorkstationDO workstationDO = validatorWorkStation(mainDo.getWorkshopCode(), detailDO.getProductionLineCode(), detailDO.getWorkStationCode());
if (workstationDO != null) {
// 工位代码
if(StringUtils.isEmpty(detailDO.getWorkStationCode())){
message.append("工位代码不能为空").append(",");
}else {
LambdaQueryWrapperX<WorkstationDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
lambdaQueryWrapperX.eq(WorkstationDO::getCode,detailDO.getWorkStationCode());
if(StringUtils.isNotEmpty(detailDO.getProductionLineCode())){
lambdaQueryWrapperX.eq(WorkstationDO::getProductionLineCode,detailDO.getProductionLineCode());
}
lambdaQueryWrapperX.eq(WorkstationDO::getWorkshopCode,mainDo.getWorkshopCode());
WorkstationDO workstationDO = workstationMapper.selectOne(lambdaQueryWrapperX, false);
if(workstationDO == null){
message.append("工位代码不存在").append(",");
}else {
detailDO.setFromLocationCode(workstationDO.getRawLocationCode());
}
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
}
// try {
// // 校验 物料包装规格关系
// ItempackageDO itempackageDO = itempackageService.getItempackageDO(detailDO.getItemCode(), detailDO.getPackUnit());
// detailDO.setPackQty(itempackageDO.getPackQty());
// detailDO.setPackUnit(itempackageDO.getPackUnit());
// } catch (Exception ex) {
// message.append(ex.getMessage()).append(",");
// }
try {
ItembasicDO itembasicDO = validatorItembasic(detailDO.getItemCode());
detailDO.setUom(itembasicDO.getUom());
detailDO.setItemDesc1(itembasicDO.getDesc1());
detailDO.setItemDesc2(itembasicDO.getDesc2());
detailDO.setItemName(itembasicDO.getName());
detailDO.setProjectCode(itembasicDO.getProject());
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
}
// 校验项目代码
if(StringUtils.isNotEmpty(detailDO.getProjectCode())){
LambdaQueryWrapperX<QadProjectDO> qadProjectDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
qadProjectDOLambdaQueryWrapperX.eq(QadProjectDO::getProjectCode,detailDO.getProjectCode());
QadProjectDO qadProjectDO = qadProjectMapper.selectOne(qadProjectDOLambdaQueryWrapperX);
if(qadProjectDO == null){
message.append("项目代码不存在").append(",");
}
}
try {
String reasonCodeRequisition = mainDo.getReasonCodeRequisition();
if(StringUtils.isNotEmpty(reasonCodeRequisition)){
ItembasicDO itembasicDO = validatorItembasic(detailDO.getItemCode());
LambdaQueryWrapperX<SubjectAccountDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
lambdaQueryWrapperX.eq(SubjectAccountDO::getCode,reasonCodeRequisition);
lambdaQueryWrapperX.eq(SubjectAccountDO::getCostcentreType,mainDo.getCostCenterType());
SubjectAccountDO subjectAccountDO = subjectAccountMapper.selectOne(lambdaQueryWrapperX);
mainDo.setQadTtunrcisAcc(subjectAccountDO.getAccountingAccount());
if(subjectAccountDO != null){
if("TRUE".equals(subjectAccountDO.getIsFromPlMstr())){
// 产品类
String prodCla = itembasicDO.getProdCla();
if(StringUtils.isNotEmpty(prodCla)){
LambdaQueryWrapperX<MstrDO> mstrDOLambdaQueryWrapperX = new LambdaQueryWrapperX<>();
mstrDOLambdaQueryWrapperX.eq(MstrDO::getPlProdLine,prodCla);
List<MstrDO> mstrDOS = mstrMapper.selectList(mstrDOLambdaQueryWrapperX);
if(mstrDOS != null && mstrDOS.size() > 0){
MstrDO mstrDO = mstrDOS.get(0);
if("A".equals(subjectAccountDO.getPlMstrType())){
detailDO.setQadTtunrcisAcc(mstrDO.getPlMvarAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlMvarCc());
}else if("B".equals(subjectAccountDO.getPlMstrType())) {
detailDO.setQadTtunrcisAcc(mstrDO.getPlCchgAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlCchgCc());
}else if("C".equals(subjectAccountDO.getPlMstrType())){
detailDO.setQadTtunrcisAcc(mstrDO.getPlScrpAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlScrpCc());
}else if("D".equals(subjectAccountDO.getPlMstrType())){
detailDO.setQadTtunrcisAcc(mstrDO.getPlDscrAcct());
detailDO.setQadPlCostCenter(mstrDO.getPlDscrCc());
}else {
log.debug("计划外出库,客户账户产品类型不存在的类型");
}
}
}
}else {
// 不是来自产品类取科目账户配置表的会计账户
detailDO.setQadTtunrcisAcc(subjectAccountDO.getAccountingAccount());
detailDO.setQadPlCostCenter(mainDo.getCostCenterCode());//成本中心
}
}
}
detailDO.setQadProjectCode(detailDO.getProjectCode());
if(detailDO.getSinglePrice() != null){
detailDO.setSinglePrice(detailDO.getSinglePrice().setScale(2, RoundingMode.HALF_UP));
}else {
// 查询标准成本价
StdcostpriceDO stdcostpriceDO = stdcostpriceService.queryStdcostpriceByItemCode(detailDO.getItemCode());
detailDO.setSinglePrice(stdcostpriceDO.getPrice().setScale(2, RoundingMode.HALF_UP));
}
if(detailDO.getAmount() != null){
detailDO.setAmount(detailDO.getAmount().setScale(2,RoundingMode.HALF_UP));
}else {
BigDecimal amount = detailDO.getSinglePrice().multiply(detailDO.getQty());
detailDO.setAmount(amount.setScale(2,RoundingMode.HALF_UP));
}
}catch (Exception ex){
message.append(ex.getMessage()).append(",");
}
// 校验库存余额是否存在
BalanceDO balanceDo = balanceService.getBalanceListByStatusList("", detailDO.getItemCode(), detailDO.getBatch(), null, detailDO.getFromLocationCode());
if(balanceDo == null){
message.append("库存余额不存在,物料代码:"+detailDO.getItemCode()+",批次:"+detailDO.getBatch()+",库位代码(工位对应的原料库位):"+detailDO.getFromLocationCode()).append(",");
}else {
BigDecimal qty = balanceDo.getQty();
if(qty.compareTo(detailDO.getQty()) < 0){
message.append("库存余额数量:"+balanceDo.getQty()+",数量:"+detailDO.getQty()).append(",");
}
}
return message.toString();
}
@ -723,10 +926,49 @@ public class ProductionscrapRequestMainServiceImpl implements ProductionscrapReq
private String validatorProductionscrapRequestMainImport(ProductionscrapRequestMainDO mainDo, BusinesstypeDO businesstypeDO, RequestsettingDO requestsettingDO) {
StringBuilder message = new StringBuilder();
try {
validatorWorkshop(mainDo.getWorkshopCode());
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
// 必填字段校验
if(StringUtils.isNotEmpty(mainDo.getQ3Number())){
boolean q3Flag = inspectionQ3Api.checkInspectionQ3(mainDo.getQ3Number());
if(q3Flag){
message.append("Q3通知单号不存在:"+mainDo.getQ3Number()).append(",");
}
}
// 报废原因
if(StringUtils.isEmpty(mainDo.getLineScrapReason())){
message.append("报废原因不能为空").append(",");
}
if(StringUtils.isEmpty(mainDo.getCostCenterCode())){
message.append("成本中心代码不能为空").append(",");
}else {
//校验成本中心是否存在
LambdaQueryWrapperX<QadCostcentreDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
lambdaQueryWrapperX.eq(QadCostcentreDO::getCostcentreCode,mainDo.getCostCenterCode());
QadCostcentreDO subjectAccountDO = qadCostcentreMapper.selectOne(lambdaQueryWrapperX,false);
if(subjectAccountDO == null){
message.append("成本中心代码不存在").append(",");
}else {
mainDo.setCostCenterType(subjectAccountDO.getCostcentreType());
}
}
if(StringUtils.isEmpty(mainDo.getReasonCodeRequisition())){
message.append("原因代码不能为空").append(",");
}else {
LambdaQueryWrapperX<SubjectAccountDO> lambdaQueryWrapperX = new LambdaQueryWrapperX<>();
lambdaQueryWrapperX.eq(SubjectAccountDO::getCode,mainDo.getReasonCodeRequisition());
lambdaQueryWrapperX.eq(SubjectAccountDO::getCostcentreType,mainDo.getCostCenterType());
SubjectAccountDO subjectAccountDO = subjectAccountMapper.selectOne(lambdaQueryWrapperX);
if(subjectAccountDO == null){
message.append("原因代码不存在").append(",");
}
}
if(StringUtils.isEmpty(mainDo.getWorkshopCode())){
message.append("车间代码不能为空").append(",");
}else {
try {
validatorWorkshop(mainDo.getWorkshopCode());
} catch (Exception ex) {
message.append(ex.getMessage()).append(",");
}
}
mainDo.setBusinessType(businesstypeDO.getCode());
mainDo.setFromAreaTypes(businesstypeDO.getOutAreaTypes());

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productreceiptJob/ProductreceiptJobMainServiceImpl.java

@ -987,6 +987,8 @@ public class ProductreceiptJobMainServiceImpl implements ProductreceiptJobMainSe
}
} else {
log.debug("所有请求检验申请已经存在");
productreceiptRecordMainDO.setInspectRequestFlag("FALSE");
productreceiptRecordMainMapper.updateById(productreceiptRecordMainDO);
}
}

535
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productreceiptRecord/BackflushRecordDetailbServiceImpl.java

@ -1,25 +1,54 @@
package com.win.module.wms.service.productreceiptRecord;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.util.collection.CollectionUtils;
import com.win.framework.common.util.date.LocalDateTimeUtils;
import com.win.module.wms.controller.productreceiptRecord.vo.*;
import com.win.module.wms.controller.transaction.vo.TransactionCreateReqVO;
import com.win.module.wms.convert.backflushdetailbqad.BackflushDetailbQadConvert;
import com.win.module.wms.convert.productreceiptRecord.BackflushRecordDetailbConvert;
import com.win.module.wms.dal.dataobject.areabasic.AreabasicDO;
import com.win.module.wms.dal.dataobject.backflushdetailbqad.BackflushDetailbQadDO;
import com.win.module.wms.dal.dataobject.balance.BalanceDO;
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO;
import com.win.module.wms.dal.dataobject.itemarea.ItemareaDO;
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO;
import com.win.module.wms.dal.dataobject.location.LocationDO;
import com.win.module.wms.dal.dataobject.productreceiptDetailb.ProductreceiptDetailbDO;
import com.win.module.wms.dal.dataobject.productreceiptRecord.ProductreceiptRecordDetailDO;
import com.win.module.wms.dal.dataobject.productreceiptRecord.ProductreceiptRecordDetailbDO;
import com.win.module.wms.dal.dataobject.productreceiptRecord.ProductreceiptRecordMainDO;
import com.win.module.wms.dal.dataobject.productredressRecord.ProductredressRecordDetailDO;
import com.win.module.wms.dal.dataobject.productredressRecord.ProductredressRecordMainDO;
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO;
import com.win.module.wms.dal.dataobject.workstation.WorkstationDO;
import com.win.module.wms.dal.mysql.itembasic.ItembasicMapper;
import com.win.module.wms.dal.mysql.productreceiptRecord.ProductreceiptRecordDetailMapper;
import com.win.module.wms.dal.mysql.productreceiptRecord.ProductreceiptRecordDetailbMapper;
import com.win.module.wms.dal.mysql.productreceiptRecord.ProductreceiptRecordMainMapper;
import com.win.module.wms.dal.mysql.productredressRecord.ProductredressRecordDetailMapper;
import com.win.module.wms.dal.mysql.productredressRecord.ProductredressRecordMainMapper;
import com.win.module.wms.enums.common.InventoryStatusEnum;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.module.wms.enums.ErrorCodeConstants.BACKFLUSH_DETAILB_QAD_IMPORT_LIST_IS_EMPTY;
import static com.win.module.wms.enums.ErrorCodeConstants.BACKFLUSH_RECORD_DETAILB_NOT_EXISTS;
import static com.win.module.wms.enums.ErrorCodeConstants.*;
import static com.win.module.wms.enums.ErrorCodeConstants.BALANCE_EXCEPTION;
/**
* 制品收货记录子 Service 实现类
@ -33,7 +62,15 @@ public class BackflushRecordDetailbServiceImpl implements BackflushRecordDetailb
@Resource
private ProductreceiptRecordDetailbMapper productreceiptRecordDetailbMapper;
@Resource
private ProductreceiptRecordMainService productreceiptRecordMainService;
private ProductreceiptRecordMainMapper productreceiptRecordMainMapper;
@Resource
private ProductreceiptRecordDetailMapper productreceiptRecordDetailMapper;
@Resource
private ProductredressRecordDetailMapper productredressRecordDetailMapper;
@Resource
private ItembasicMapper itembasicMapper;
@Resource
private ProductredressRecordMainMapper productredressRecordMainMapper;
@Override
public String createBackflushRecordDetailb(BackflushRecordDetailbCreateReqVO createReqVO) {
@ -123,6 +160,42 @@ public class BackflushRecordDetailbServiceImpl implements BackflushRecordDetailb
if (mainDO.getQty() == null || mainDO.getQty().compareTo(BigDecimal.ZERO) == 0) {
message.append("消耗原料数量不能为空并且等于0").append(",");
}
if (message == null || message.length() == 0) {
// 验证物料是否存在
ItembasicDO itembasicDO = itembasicMapper.selectByCode(mainDO.getParentItemCode());
if (itembasicDO == null) message.append("父物料号不存在【").append(mainDO.getParentItemCode()).append("】").append(",");
ItembasicDO itembasicDOI = itembasicMapper.selectByCode(mainDO.getItemCode());
if (itembasicDOI == null) message.append("消耗原料物料号不存在【").append(mainDO.getItemCode()).append("】").append(",");
}
if (message == null || message.length() == 0) {
// 校验数据
// 判断 qad回传数据 是完工的还是回收的 负数为完工消耗 正数为回收入库
String isProductreceipt = "true";
if (mainDO.getQty().compareTo(BigDecimal.ZERO) > 0) {
isProductreceipt = "false";
}
if (isProductreceipt.equals("true")) {
ProductreceiptRecordMainDO productreceiptRecordMainDO = productreceiptRecordMainMapper.selectOne("number", mainDO.getProductreceiptNumber());
if (productreceiptRecordMainDO == null) {
message.append("未查询到收货记录 单据号:").append(mainDO.getProductreceiptNumber());
} else {
List<ProductreceiptRecordDetailDO> productreceiptRecordDetailDOList = productreceiptRecordDetailMapper.selectList("master_id", productreceiptRecordMainDO.getId(), "item_code", mainDO.getParentItemCode());
if (productreceiptRecordDetailDOList == null || productreceiptRecordDetailDOList.size() == 0) {
message.append("未查询到收货记录 物料:").append(mainDO.getParentItemCode()).append(" ;单据号:").append(mainDO.getProductreceiptNumber());
}
}
} else {
ProductredressRecordMainDO productredressRecordMainDO = productredressRecordMainMapper.selectOne("number", mainDO.getProductreceiptNumber());
if (productredressRecordMainDO == null) {
message.append("未查询到回收记录 单据号:").append(mainDO.getProductreceiptNumber());
} else {
List<ProductredressRecordDetailDO> productredressRecordDetailDOList = productredressRecordDetailMapper.selectList("master_id", productredressRecordMainDO.getId(), "item_code", mainDO.getParentItemCode());
if (productredressRecordDetailDOList == null || productredressRecordDetailDOList.size() == 0) {
message.append("未查询到回收记录 物料:").append(mainDO.getParentItemCode()).append(" ;单据号:").append(mainDO.getProductreceiptNumber());
}
}
}
}
return message.toString();
}
@ -170,14 +243,462 @@ public class BackflushRecordDetailbServiceImpl implements BackflushRecordDetailb
isProductreceipt = "false";
}
if (isProductreceipt.equals("true")) {
productreceiptRecordMainService.generateProductreceiptRecordByQAD(backflushDetailbQadDOList.get(0).getProductreceiptNumber(),backflushDetailbQadDOList.get(0).getParentItemCode(),backflushDetailbQadDOList,false);
// this.generateProductreceiptRecordTransaction(backflushDetailbQadDOList.get(0).getProductreceiptNumber(),backflushDetailbQadDOList.get(0).getParentItemCode(),backflushDetailbQadDOList);
} else {
productreceiptRecordMainService.generateProductredressByQAD(backflushDetailbQadDOList.get(0).getProductreceiptNumber(),backflushDetailbQadDOList.get(0).getParentItemCode(),backflushDetailbQadDOList,false);
// this.generateProductredressTransaction(backflushDetailbQadDOList.get(0).getProductreceiptNumber(),backflushDetailbQadDOList.get(0).getParentItemCode(),backflushDetailbQadDOList);
}
}
}
return errorList;
}
//
// private void generateProductreceiptRecordTransaction(String number, String parentItemCode, List<BackflushDetailbQadDO> backflushDetailbQadDOListNumber) {
// ProductreceiptRecordMainDO productreceiptRecordMainDO = productreceiptRecordMainMapper.selectOne("number", number);
// List<ProductreceiptRecordDetailDO> productreceiptRecordDetailDOList = productreceiptRecordDetailMapper.selectList("master_id", productreceiptRecordMainDO.getId(), "item_code", parentItemCode);
//
// ProductreceiptRecordDetailDO productreceiptRecordDetailDO = productreceiptRecordDetailDOList.get(0);
// // 下线结算集合
// List<ProductreceiptRecordDetailbDO> offlinesettlementRecordList = new ArrayList<>();
// //库存事务
// List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>();
// List<ProductreceiptRecordDetailbDO> productreceiptRequestDetailbDOList = new ArrayList<>();
// for (BackflushDetailbQadDO backflushDetailbQadDO : backflushDetailbQadDOListNumber) {
// ProductreceiptRecordDetailbDO productreceiptRecordDetailbDO = new ProductreceiptRecordDetailbDO();
// productreceiptRecordDetailbDO.setProcessCode(productreceiptRecordDetailDO.getProcessCode());
// productreceiptRecordDetailbDO.setBomVersion("1");
// productreceiptRecordDetailbDO.setItemCode(backflushDetailbQadDO.getItemCode());
// productreceiptRecordDetailbDO.setMasterId(productreceiptRecordDetailDO.getId());
// productreceiptRecordDetailbDO.setNumber(productreceiptRecordMainDO.getNumber());
// productreceiptRecordDetailbDO.setQty(backflushDetailbQadDO.getQty().abs()); // 从QAD回传的数量有正有负 统一绝对值处理
// productreceiptRecordDetailbDO.setCreator(productreceiptRecordMainDO.getCreator());
// productreceiptRecordDetailbDO.setUpdater(productreceiptRecordMainDO.getUpdater());
// // 赋值物料相关信息
//// ItembasicDO itembasicDO = itembasicService.selectItembasic(backflushDetailbQadDO.getItemCode());
// QueryWrapper<ItembasicDO> itembasicDOQueryWrapper = new QueryWrapper<>();
// itembasicDOQueryWrapper.eq("code", backflushDetailbQadDO.getItemCode());
// itembasicDOQueryWrapper.eq("available", "TRUE");
// ItembasicDO itembasicDO = itembasicMapper.selectOne(itembasicDOQueryWrapper);
// productreceiptRecordDetailbDO.setUom(itembasicDO.getUom());
// productreceiptRecordDetailbDO.setItemName(itembasicDO.getName());
// productreceiptRecordDetailbDO.setItemDesc1(itembasicDO.getDesc1());
// productreceiptRecordDetailbDO.setItemDesc2(itembasicDO.getDesc2());
// productreceiptRecordDetailbDO.setProjectCode(itembasicDO.getProject());
// // 根据 生产线 工位 查询工位信息 并赋值 from_location_code
//// WorkstationDO workstationDO = workstationService.selectWorkstationExist(productreceiptRecordDetailDO.getWorkStationCode(), productreceiptRecordMainDO.getWorkshopCode(), productreceiptRecordDetailDO.getProductionlineCode());
// WorkstationDO workstationDO;
// QueryWrapper<WorkstationDO> queryWrapperWorkstation = new QueryWrapper<>();
// queryWrapperWorkstation.eq("code", productreceiptRecordDetailDO.getWorkStationCode());
// queryWrapperWorkstation.eq("workshop_code", productreceiptRecordMainDO.getWorkshopCode());
// if (!org.apache.commons.lang3.StringUtils.isEmpty(productreceiptRecordDetailDO.getProductionlineCode())) {
// queryWrapperWorkstation.eq("production_line_code", productreceiptRecordDetailDO.getProductionlineCode());
// }
// queryWrapperWorkstation.eq("available", "TRUE");
// List<WorkstationDO> workstationDOS = workstationMapper.selectList(queryWrapperWorkstation);
// if (!CollectionUtil.isEmpty(workstationDOS)) {
// workstationDO = workstationDOS.get(0);
// } else {
// if (auto) {
// backflushDetailbQadDO.setRemark("车间,生产线代码与工位不匹配:" + "车间" + productreceiptRecordMainDO.getWorkshopCode() + "生产线" + productreceiptRecordDetailDO.getProductionlineCode() + "工位" + productreceiptRecordDetailDO.getWorkStationCode() + "无效");
// backflushDetailbQadDO.setStatus(2);// 失败
// continue;
// } else {
// throw exception(WORKSTATION_RELATION_ERROR, "车间" + productreceiptRecordMainDO.getWorkshopCode() + "生产线" + productreceiptRecordDetailDO.getProductionlineCode() + "工位" + productreceiptRecordDetailDO.getWorkStationCode() + "无效");
// }
// }
// productreceiptRecordDetailbDO.setFromLocationCode(workstationDO.getRawLocationCode());
// // 查询 管理精度 根据不同管理精度进行消耗
// String manageMode = jobUtils.getManageMode(productreceiptRecordDetailbDO.getItemCode(), workstationDO.getRawLocationCode());
// // 按数量管理
// if ("BY_QUANTITY".equals(manageMode)) {
// // 根据 from_location_code 查询库存余额
//// TODO: 如果按批次 查询批次获取库存余额 排序批次 如果第一条批次不够数量 需要扣除第二条余额 库存事务出的动作要存2条
// List<String> inventoryStatus = new ArrayList<>();
// inventoryStatus.add("OK");
// BalanceDO balanceDO = balanceService.checkBalanceNotError(productreceiptRecordDetailbDO.getPackingNumber(), productreceiptRecordDetailbDO.getItemCode(), productreceiptRecordDetailbDO.getBatch(), "OK", workstationDO.getRawLocationCode());
// if (balanceDO != null) {
// productreceiptRecordDetailbDO.setPackingNumber(balanceDO.getPackingNumber());
// productreceiptRecordDetailbDO.setBatch(balanceDO.getBatch());
// productreceiptRecordDetailbDO.setInventoryStatus(InventoryStatusEnum.OK.getCode());
// productreceiptRecordDetailbDO.setFromAreaCode(balanceDO.getAreaCode());
// productreceiptRecordDetailbDO.setFromLocationGroupCode(balanceDO.getLocationGroupCode());
// //添加库存事务list
// // 出动作
// TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
// BeanUtils.copyProperties(productreceiptRecordDetailbDO, transactionCreateReqVO);
// BusinesstypeDO businesstypeDO = businesstypeService.selectBusinesstypeExist(productreceiptRecordMainDO.getBusinessType());
// TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getOutTransactionType());
// transactionCreateReqVO.setWorker(productreceiptRecordMainDO.getCreator());
// transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
// transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
// transactionCreateReqVO.setBusinessType(businesstypeDO.getCode());
// transactionCreateReqVO.setOwnerCode("");
// transactionCreateReqVO.setRecordNumber(productreceiptRecordDetailbDO.getNumber());
// transactionCreateReqVO.setId(null);
// transactionCreateReqVO.setPackingNumber(productreceiptRecordDetailbDO.getPackingNumber());
// transactionCreateReqVO.setBatch(productreceiptRecordDetailbDO.getBatch());
// transactionCreateReqVO.setContainerNumber("");
// transactionCreateReqVO.setSinglePrice(balanceDO.getSinglePrice());
// transactionCreateReqVO.setWarehouseCode(balanceDO.getWarehouseCode());
// transactionCreateReqVO.setAmount(balanceDO.getAmount());
// transactionCreateReqVO.setDeptId(productreceiptRecordMainDO.getDepartmentCode());
// transactionCreateReqVO.setUserId(Long.valueOf(productreceiptRecordMainDO.getCreator()));
// if (balanceDO.getArriveDate() == null) {
// transactionCreateReqVO.setArriveDate(LocalDateTime.now());
// } else {
// transactionCreateReqVO.setArriveDate(balanceDO.getArriveDate());
// }
// if (balanceDO.getProduceDate() == null) {
// transactionCreateReqVO.setProduceDate(LocalDateTime.now());
// } else {
// transactionCreateReqVO.setProduceDate(balanceDO.getProduceDate());
// }
// transactionCreateReqVO.setExpireDate(balanceDO.getExpireDate());
// transactionCreateReqVO.setActiveTime(LocalDateTime.now());
// transactionCreateReqVO.setLocationCode(productreceiptRecordDetailbDO.getFromLocationCode());
// transactionCreateReqVO.setQty(productreceiptRecordDetailbDO.getQty());
// // 根据 库位 获取 库区DO
// AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
// transactionCreateReqVO.setWarehouseCode(areabasicDOOut.getWarehouseCode());
// transactionCreateReqVO.setAreaType(areabasicDOOut.getType());
// transactionCreateReqVO.setAreaCode(areabasicDOOut.getCode());
//// transactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(productreceiptRecordDetailbDO.getItemCode(), areabasicDOOut.getCode()).getOutPackUnit());
//// transactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(productreceiptRecordDetailbDO.getItemCode(),transactionCreateReqVO.getPackUnit()).getPackQty());
// transactionCreateReqVO.setPackUnit(null);
// transactionCreateReqVO.setPackQty(BigDecimal.ZERO);
// transactionCreateReqVOList.add(transactionCreateReqVO);
// } else {
// // 增加负库存逻辑
// ItemareaDO itemareaDOByLocationCode = jobUtils.getItemareaDOByLocationCode(productreceiptRecordDetailbDO.getItemCode(), workstationDO.getRawLocationCode());
// productreceiptRecordDetailbDO.setPackingNumber(null);
// productreceiptRecordDetailbDO.setBatch("");
// productreceiptRecordDetailbDO.setInventoryStatus(InventoryStatusEnum.OK.getCode());
// productreceiptRecordDetailbDO.setFromAreaCode(itemareaDOByLocationCode.getAreaCode());
// QueryWrapper<LocationDO> queryWrapperLocationDO = new QueryWrapper<>();
// queryWrapperLocationDO.eq("code", workstationDO.getRawLocationCode());
// queryWrapperLocationDO.eq("available", "TRUE");
// LocationDO locationDO = locationMapper.selectOne(queryWrapperLocationDO);
// productreceiptRecordDetailbDO.setFromLocationGroupCode(locationDO.getLocationGroupCode());
// //添加库存事务list
// // 出动作
// TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
// BeanUtils.copyProperties(productreceiptRecordDetailbDO, transactionCreateReqVO);
// BusinesstypeDO businesstypeDO = businesstypeService.selectBusinesstypeExist(productreceiptRecordMainDO.getBusinessType());
// TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getOutTransactionType());
// transactionCreateReqVO.setWorker(productreceiptRecordMainDO.getCreator());
// transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
// transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
// transactionCreateReqVO.setBusinessType(businesstypeDO.getCode());
// transactionCreateReqVO.setOwnerCode("");
// transactionCreateReqVO.setRecordNumber(productreceiptRecordDetailbDO.getNumber());
// transactionCreateReqVO.setId(null);
// transactionCreateReqVO.setPackingNumber(productreceiptRecordDetailbDO.getPackingNumber());
// transactionCreateReqVO.setBatch(productreceiptRecordDetailbDO.getBatch());
// transactionCreateReqVO.setContainerNumber("");
// transactionCreateReqVO.setSinglePrice(BigDecimal.ZERO);
// transactionCreateReqVO.setAmount(BigDecimal.ZERO);
// transactionCreateReqVO.setArriveDate(LocalDateTime.now());
// transactionCreateReqVO.setProduceDate(LocalDateTime.now());
// transactionCreateReqVO.setExpireDate(LocalDateTimeUtils.max());
// transactionCreateReqVO.setActiveTime(LocalDateTime.now());
// transactionCreateReqVO.setLocationCode(productreceiptRecordDetailbDO.getFromLocationCode());
// transactionCreateReqVO.setDeptId(productreceiptRecordMainDO.getDepartmentCode());
// transactionCreateReqVO.setUserId(Long.valueOf(productreceiptRecordMainDO.getCreator()));
//
// LocationDO fromLocationCode = locationService.queryByCode(productreceiptRecordDetailbDO.getFromLocationCode());
// if (fromLocationCode != null) {
// transactionCreateReqVO.setLocationGroupCode(fromLocationCode.getLocationGroupCode());
// transactionCreateReqVO.setAreaCode(fromLocationCode.getAreaCode());
// transactionCreateReqVO.setWarehouseCode(fromLocationCode.getWarehouseCode());
// }
// transactionCreateReqVO.setQty(productreceiptRecordDetailbDO.getQty());
// // 根据 库位 获取 库区DO
// AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
// transactionCreateReqVO.setWarehouseCode(areabasicDOOut.getWarehouseCode());
// transactionCreateReqVO.setAreaType(areabasicDOOut.getType());
// transactionCreateReqVO.setAreaCode(areabasicDOOut.getCode());
//// transactionCreateReqVO.setPackUnit(jobUtils.getItemareaDO(productreceiptRecordDetailbDO.getItemCode(), areabasicDOOut.getCode()).getOutPackUnit());
//// transactionCreateReqVO.setPackQty(jobUtils.getItempackageDO(productreceiptRecordDetailbDO.getItemCode(),transactionCreateReqVO.getPackUnit()).getPackQty());
// transactionCreateReqVO.setPackUnit(null);
// transactionCreateReqVO.setPackQty(BigDecimal.ZERO);
// transactionCreateReqVOList.add(transactionCreateReqVO);
// }
// }
// // 按批次管理
// if ("BY_BATCH".equals(manageMode)) {
// LambdaQueryWrapper<BalanceDO> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(BalanceDO::getPackingNumber, "")
// .eq(BalanceDO::getItemCode, productreceiptRecordDetailbDO.getItemCode())
// .eq(BalanceDO::getInventoryStatus, "OK")
// .eq(BalanceDO::getLocationCode, workstationDO.getRawLocationCode())
// .eq(BalanceDO::getFrozen, "FALSE")
// .gt(BalanceDO::getExpireDate, LocalDateTimeUtil.format(LocalDateTime.now(), DatePattern.NORM_DATETIME_FORMATTER))
// .orderByAsc(BalanceDO::getBatch)
// .orderByDesc(BalanceDO::getQty);
// List<BalanceDO> balanceDOList = balanceMapper.selectList(queryWrapper);
// if (!CollectionUtils.isAnyEmpty(balanceDOList)) {
// // throw exception(BALANCE_EXCEPTION,"库存余额不足");
// BigDecimal totalQty = productreceiptRecordDetailbDO.getQty();
// boolean flag = false;
// for (BalanceDO balanceDO : balanceDOList) {
// productreceiptRecordDetailbDO.setPackingNumber(balanceDO.getPackingNumber());
// productreceiptRecordDetailbDO.setBatch(balanceDO.getBatch());
// productreceiptRecordDetailbDO.setInventoryStatus(InventoryStatusEnum.OK.getCode());
// productreceiptRecordDetailbDO.setFromAreaCode(balanceDO.getAreaCode());
// productreceiptRecordDetailbDO.setFromLocationGroupCode(balanceDO.getLocationGroupCode());
// // 出动作
// TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
// BeanUtils.copyProperties(productreceiptRecordDetailbDO, transactionCreateReqVO);
// BusinesstypeDO businesstypeDO = businesstypeService.selectBusinesstypeExist(productreceiptRecordMainDO.getBusinessType());
// TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getOutTransactionType());
// transactionCreateReqVO.setWorker(productreceiptRecordMainDO.getCreator());
// transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
// transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
// transactionCreateReqVO.setBusinessType(businesstypeDO.getCode());
// transactionCreateReqVO.setOwnerCode("");
// transactionCreateReqVO.setRecordNumber(productreceiptRecordDetailbDO.getNumber());
// transactionCreateReqVO.setId(null);
// transactionCreateReqVO.setPackingNumber(productreceiptRecordDetailbDO.getPackingNumber());
// transactionCreateReqVO.setBatch(productreceiptRecordDetailbDO.getBatch());
// transactionCreateReqVO.setContainerNumber("");
// transactionCreateReqVO.setSinglePrice(balanceDO.getSinglePrice());
// transactionCreateReqVO.setAmount(balanceDO.getAmount());
// transactionCreateReqVO.setDeptId(productreceiptRecordMainDO.getDepartmentCode());
// transactionCreateReqVO.setUserId(Long.valueOf(productreceiptRecordMainDO.getCreator()));
// if (balanceDO.getArriveDate() == null) {
// transactionCreateReqVO.setArriveDate(LocalDateTime.now());
// } else {
// transactionCreateReqVO.setArriveDate(balanceDO.getArriveDate());
// }
// if (balanceDO.getProduceDate() == null) {
// transactionCreateReqVO.setProduceDate(LocalDateTime.now());
// } else {
// transactionCreateReqVO.setProduceDate(balanceDO.getProduceDate());
// }
// transactionCreateReqVO.setExpireDate(balanceDO.getExpireDate());
// transactionCreateReqVO.setActiveTime(LocalDateTime.now());
// transactionCreateReqVO.setLocationCode(productreceiptRecordDetailbDO.getFromLocationCode());
//
// // 根据 库位 获取 库区DO
// AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
// transactionCreateReqVO.setWarehouseCode(areabasicDOOut.getWarehouseCode());
// transactionCreateReqVO.setAreaType(areabasicDOOut.getType());
// LocationDO fromLocationCode = locationService.queryByCode(transactionCreateReqVO.getLocationCode());
// if (fromLocationCode != null) {
// transactionCreateReqVO.setLocationGroupCode(fromLocationCode.getLocationGroupCode());
// transactionCreateReqVO.setAreaCode(fromLocationCode.getAreaCode());
// transactionCreateReqVO.setWarehouseCode(fromLocationCode.getWarehouseCode());
// }
// transactionCreateReqVO.setPackUnit(null);
// transactionCreateReqVO.setPackQty(BigDecimal.ZERO);
// transactionCreateReqVO.setSiteId(productreceiptRecordDetailbDO.getSiteId());
// if (balanceDO.getQty().compareTo(BigDecimal.ZERO) == 0) {
// continue;
// }
// // 判断 库存余额数量是整数还是负数
// if (balanceDO.getQty().compareTo(BigDecimal.ZERO) < 0) {
// // 库存余额是负数
// // 则此时库存应该负的更多
// // 正常情况下负库存只有99999999的批次
// if (balanceDO.getBatch().equals("99999999")) {
// transactionCreateReqVO.setQty(totalQty);
// transactionCreateReqVOList.add(transactionCreateReqVO);
// flag = true;
// break;
// }
// } else {
// // 库存余额是正数
// if (totalQty.compareTo(balanceDO.getQty()) > 0) {
// // 消耗数量 大于 库存数量 10 -3 =7
// totalQty = totalQty.subtract(balanceDO.getQty());
// transactionCreateReqVO.setQty(balanceDO.getQty());
// transactionCreateReqVOList.add(transactionCreateReqVO);
// } else {
// // 消耗数量 小于 库存
// transactionCreateReqVO.setQty(totalQty);
// transactionCreateReqVOList.add(transactionCreateReqVO);
// flag = true;
// break;
// }
// }
// }
// if (totalQty.compareTo(BigDecimal.ZERO) > 0 && !flag) { //所有的库存余额依然 不够 消耗的数量,生成一个负库存
// // 增加负库存数据场景
// increaseNegativeInventory(productreceiptRecordMainDO, transactionCreateReqVOList, productreceiptRecordDetailbDO, workstationDO, totalQty);
// }
// } else {
// // 增加负库存数据场景
// increaseNegativeInventory(productreceiptRecordMainDO, transactionCreateReqVOList, productreceiptRecordDetailbDO, workstationDO, BigDecimal.ZERO);
// }
// }
// // 按包装管理
// if ("BY_PACKAGING".equals(manageMode)) {
// throw exception(BALANCE_EXCEPTION, "物料:" + productreceiptRecordDetailbDO.getItemCode() + " 库位:" + workstationDO.getRawLocationCode() + " 暂不支持按包装管理");
// }
// // 按唯一码管理
// if ("BY_UNIQUE_ID".equals(manageMode)) {
// throw exception(BALANCE_EXCEPTION, "暂不支持按唯一码管理");
// }
// // 判断 物料 是否为 下线结算物料 创建 下线结算记录
// if (itembasicService.isOfflines(productreceiptRecordDetailbDO.getItemCode())) {
// offlinesettlementRecordList.add(productreceiptRecordDetailbDO);
// }
// productreceiptRequestDetailbDOList.add(productreceiptRecordDetailbDO);
// backflushDetailbQadDO.setStatus(1);
// }
// productreceiptRecordDetailbMapper.insertBatch(productreceiptRequestDetailbDOList);
// //增加库存事务
// if (transactionCreateReqVOList != null && transactionCreateReqVOList.size() > 0) {
// transactionService.createTransaction(transactionCreateReqVOList);
// }
// // 更新 qad 状态
// if (auto) {
// backflushDetailbQadMapper.updateBatch(backflushDetailbQadDOListNumber);
// }
// // 创建 下线结算记录
// if (offlinesettlementRecordList != null && !offlinesettlementRecordList.isEmpty()) {
// generateOfflinesettlementRecord(productreceiptRecordMainDO, offlinesettlementRecordList);
// }
// }
//
// private void generateProductredressTransaction(String number, String parentItemCode, List<BackflushDetailbQadDO> backflushDetailbQadDOListNumber) {
//
// ProductredressRecordMainDO productredressRecordMainDO = productredressRecordMainMapper.selectOne("number", number);
// if (productredressRecordMainDO == null) {
// if (auto) {
// for (BackflushDetailbQadDO backflushDetailbQadDO : backflushDetailbQadDOListNumber) {
// backflushDetailbQadDO.setRemark("未查询到回收记录 单据号:" + number);
// backflushDetailbQadDO.setStatus(2);// 失败
// }
// // 更新 qad 状态
// backflushDetailbQadMapper.updateBatch(backflushDetailbQadDOListNumber);
// return;
// } else {
// throw exception(PRODUCTREDRESS_RECORD_MAIN_NOT_EXISTS, "单据号:" + number);
// }
// }
// List<ProductredressRecordDetailDO> productredressRecordDetailDOList = productredressRecordDetailMapper.selectList("master_id", productredressRecordMainDO.getId(), "item_code", parentItemCode);
// if (productredressRecordDetailDOList == null || productredressRecordDetailDOList.size() == 0) {
// if (auto) {
// for (BackflushDetailbQadDO backflushDetailbQadDO : backflushDetailbQadDOListNumber) {
// backflushDetailbQadDO.setRemark("未查询到回收记录 物料:" + parentItemCode + " ;单据号:" + number);
// backflushDetailbQadDO.setStatus(2);// 失败
// }
// // 更新 qad 状态
// backflushDetailbQadMapper.updateBatch(backflushDetailbQadDOListNumber);
// return;
// } else {
// throw exception(PRODUCTREDRESS_RECORD_DETAIL_NOT_EXISTS, "单据号:" + number + " 物料:" + parentItemCode);
// }
// }
// ProductredressRecordDetailDO productredressRecordDetailDO = productredressRecordDetailDOList.get(0);
// // 增加业务类型
// BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("ProductredressRecord", "制品回收记录");
// // 查询制品收货子表:回冲记录子表 record_backflush_detailb
// // 查询 制品收货记录 子表 —— 按照 物料代码 箱码 批次 库位 查询制品收货记录子表 对应数据
// QueryWrapper<ProductreceiptRecordDetailDO> productreceiptRecordDetailMapperQueryWrapper = new QueryWrapper<>();
// productreceiptRecordDetailMapperQueryWrapper.eq("item_code", productredressRecordDetailDO.getItemCode());
// productreceiptRecordDetailMapperQueryWrapper.eq("packing_number", productredressRecordDetailDO.getPackingNumber());
// productreceiptRecordDetailMapperQueryWrapper.eq("batch", productredressRecordDetailDO.getBatch());
// // productreceiptRecordDetailMapperQueryWrapper.eq("to_location_code",productredressRecordDetailDO.getToLocationCode());
// List<ProductreceiptRecordDetailDO> productreceiptRecordDetailDOList = productreceiptRecordDetailMapper.selectList(productreceiptRecordDetailMapperQueryWrapper);
// if (productreceiptRecordDetailDOList == null || productreceiptRecordDetailDOList.size() == 0) {
// if (auto) {
// for (BackflushDetailbQadDO backflushDetailbQadDO : backflushDetailbQadDOListNumber) {
// backflushDetailbQadDO.setRemark("未查询到收货记录子 物料:" + productredressRecordDetailDO.getItemCode() + " ;包装号:" + productredressRecordDetailDO.getPackingNumber() + ";批次:" + productredressRecordDetailDO.getBatch());
// backflushDetailbQadDO.setStatus(2);// 失败
// }
// // 更新 qad 状态
// backflushDetailbQadMapper.updateBatch(backflushDetailbQadDOListNumber);
// return;
// } else {
// throw exception(PRODUCTREDRESS_RECORD_DETAIL_NOT_EXISTS);
// }
// }
// // 查询 制品收货子子表 —— 按照 收货记录子表id
// QueryWrapper<ProductreceiptRecordDetailbDO> productreceiptRecordDetailbDOQueryWrapper = new QueryWrapper<>();
// productreceiptRecordDetailbDOQueryWrapper.eq("master_id", productreceiptRecordDetailDOList.get(0).getId());
// List<ProductreceiptRecordDetailbDO> productreceiptRecordDetailbDOList = productreceiptRecordDetailbMapper.selectList(productreceiptRecordDetailbDOQueryWrapper);
// TransactiontypeDO transactiontypeDOIN = jobUtils.selectDocumentFromTransactionType(businesstypeDO.getInTransactionType());
// // 库存事务
// List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>();
// for (BackflushDetailbQadDO backflushDetailbQadDO : backflushDetailbQadDOListNumber) {
//
//// List<ProductreceiptRecordDetailbDO> filteredList = productreceiptRecordDetailbDOList.stream()
//// .filter(detail -> backflushDetailbQadDO.getItemCode().equals(detail.getItemCode()))
//// .collect(Collectors.toList());
//
// // 匹配 收货记录子子表与当地QAD回传数据 无匹配 批次为8个0
// List<ProductreceiptRecordDetailbDO> filteredList = new ArrayList<>();
// for (ProductreceiptRecordDetailbDO productreceiptRecordDetailbDO : productreceiptRecordDetailbDOList) {
// if (backflushDetailbQadDO.getItemCode().equals(productreceiptRecordDetailbDO.getItemCode())) {
// filteredList.add(productreceiptRecordDetailbDO);
// }
// }
//
// ProductreceiptRecordDetailbDO productreceiptRecordDetailbDO;
// // 当QAD回传数据大于收货消耗数据时 插入8个0批次的库存
// String batch = "";
// if (filteredList == null || filteredList.size() == 0) {
// // 没有匹配的收货消耗时,获取集合第一条
// if (productreceiptRecordDetailbDOList == null || productreceiptRecordDetailbDOList.size() == 0) {
// backflushDetailbQadDO.setRemark("未查询到消耗记录 主表ID:" + productreceiptRecordDetailDOList.get(0).getId());
// backflushDetailbQadDO.setStatus(2);// 失败
// continue;
// }
// productreceiptRecordDetailbDO = productreceiptRecordDetailbDOList.get(0);
// batch = "00000000";
// } else {
// productreceiptRecordDetailbDO = filteredList.get(0);
// batch = productreceiptRecordDetailbDO.getBatch();
// }
//
// // 消耗的原材料 入动作
// TransactionCreateReqVO transactionCreateReqVOIN = new TransactionCreateReqVO();
// BeanUtils.copyProperties(productreceiptRecordDetailbDO, transactionCreateReqVOIN);
// transactionCreateReqVOIN.setItemCode(backflushDetailbQadDO.getItemCode());
// transactionCreateReqVOIN.setLocationGroupCode(productreceiptRecordDetailbDO.getFromLocationGroupCode());
// transactionCreateReqVOIN.setWorker(productredressRecordMainDO.getCreator());
// transactionCreateReqVOIN.setInventoryAction(transactiontypeDOIN.getInventoryAction());
// transactionCreateReqVOIN.setTransactionType(transactiontypeDOIN.getCode());
// transactionCreateReqVOIN.setBusinessType(productredressRecordMainDO.getBusinessType());
// transactionCreateReqVOIN.setOwnerCode("");
// transactionCreateReqVOIN.setRecordNumber(number);
// transactionCreateReqVOIN.setId(null);
// transactionCreateReqVOIN.setPackingNumber(productreceiptRecordDetailbDO.getPackingNumber());
// transactionCreateReqVOIN.setBatch(batch);
// transactionCreateReqVOIN.setContainerNumber("");
// transactionCreateReqVOIN.setAmount(BigDecimal.ZERO);
// transactionCreateReqVOIN.setQty(backflushDetailbQadDO.getQty().abs());
// transactionCreateReqVOIN.setDeptId(productredressRecordMainDO.getDepartmentCode());
// transactionCreateReqVOIN.setUserId(Long.valueOf(productredressRecordMainDO.getCreator()));
// //工位库位
// transactionCreateReqVOIN.setLocationCode(productreceiptRecordDetailbDO.getFromLocationCode());
// // 根据 库位 获取 库区DO
// AreabasicDO areabasicDOIN = jobUtils.getAreabasicDO(transactionCreateReqVOIN.getLocationCode());
// transactionCreateReqVOIN.setWarehouseCode(areabasicDOIN.getWarehouseCode());
// transactionCreateReqVOIN.setAreaType(areabasicDOIN.getType());
// transactionCreateReqVOIN.setPackQty(new BigDecimal(0));
// transactionCreateReqVOIN.setPackUnit(null);
// transactionCreateReqVOIN.setSiteId(productreceiptRecordDetailbDO.getSiteId());
// transactionCreateReqVOList.add(transactionCreateReqVOIN);
// backflushDetailbQadDO.setStatus(1);
// }
//
// // 20240803 cxm 回收子子物料 根据包装号更新ProductreceiptDetailbDO mes绑定表中 is_return 释放唯一码 保证下次唯一码能再次使用
// List<ProductreceiptDetailbDO> productreceiptDetailbDOList = productreceiptDetailbMapper.selectList("packing_number", productredressRecordDetailDO.getPackingNumber());
// if (!org.springframework.util.CollectionUtils.isEmpty(productreceiptDetailbDOList)) {
// for (ProductreceiptDetailbDO productreceiptDetailbDO : productreceiptDetailbDOList) {
// productreceiptDetailbDO.setIsReturn("TRUE");
// }
// productreceiptDetailbMapper.updateBatch(productreceiptDetailbDOList);
// }
// // 增加库存事务
// if (transactionCreateReqVOList != null && transactionCreateReqVOList.size() > 0) {
// transactionService.createTransaction(transactionCreateReqVOList);
// }
// // 更新 qad 状态
// if (auto) {
// backflushDetailbQadMapper.updateBatch(backflushDetailbQadDOListNumber);
// }
// }
}

11
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/productreceiptRecord/ProductreceiptRecordMainServiceImpl.java

@ -1723,11 +1723,12 @@ public class ProductreceiptRecordMainServiceImpl implements ProductreceiptRecord
});
}
});
Thread t1 = new Thread(() -> {
// 增加库存事务
transactionService.createTransaction(transactionCreateReqVOList);
});
t1.start();
// Thread t1 = new Thread(() -> {
// // 增加库存事务
// transactionService.createTransaction(transactionCreateReqVOList);
// });
// t1.start();
transactionService.createTransaction(transactionCreateReqVOList);
// 变更记录
trendsApi.createTrends(productreceiptRecordMainDO.getId(), "record_productreceipt_main", null, "增加了制品收货记录", JSONUtil.toJsonStr(productreceiptRecordMainDO), TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
// 根据单据开关判断是否创建 回冲记录

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanDetailService.java

@ -1,5 +1,6 @@
package com.win.module.wms.service.purchasePlan;
import java.time.LocalDateTime;
import java.util.*;
import javax.validation.*;
@ -92,4 +93,10 @@ public interface PurchasePlanDetailService {
void addOtherReturnVo(List<PurchasePlanDetailRespVO> list);
List<PurchasePlanDetailDO> selectList(Long masterId);
/**
* 根据要货计划号判断该计划是否送达日期为最小如果非最小提示
* @param ppNumber
*/
void verifyBooleanMinPlan(String ppNumber);
}

32
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanDetailServiceImpl.java

@ -27,7 +27,9 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -327,6 +329,36 @@ public class PurchasePlanDetailServiceImpl implements PurchasePlanDetailService
return purchasePlanDetailMapper.selectList(masterId);
}
@Override
public void verifyBooleanMinPlan(String ppNumber) {
List<PurchasePlanMainDO> planMainDOS = purchasePlanMainMapper.selectList("number", ppNumber);
PurchasePlanMainDO purchasePlanMainDO = planMainDOS.get(0);//要货计划主
String supplierCode = purchasePlanMainDO.getSupplierCode();
QueryWrapper<PurchasePlanMainDO> wrapper = new QueryWrapper<>();
wrapper.eq("supplier_code",supplierCode);
wrapper.eq("status","4");
wrapper.isNotNull("delivery_date");
wrapper.orderByAsc("delivery_date");
List<PurchasePlanMainDO> planMainDOS1 = purchasePlanMainMapper.selectList(wrapper);
if(planMainDOS1.isEmpty()){
throw exception(PURCHASE_PLAN_MAIN_NOT_EXISTS);
}else{
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime deliveryDate = planMainDOS1.get(0).getDeliveryDate();
String selectDate = deliveryDate.format(formatter);
LocalDateTime deliveryDate1 = purchasePlanMainDO.getDeliveryDate();
if(deliveryDate1==null){
//抛出异常
throw exception(PURCHASE_PLAN_DELIVERYDATE_NOT_NULL);
}
String uesDate = deliveryDate1.format(formatter);
if(!selectDate.equals(uesDate)){//提示最小
throw exception(PURCHASE_PLAN_DELIVERYDATE_NOT_MIN,uesDate,planMainDOS1.get(0).getNumber(),selectDate);
}
}
}
/**
* 校验创建并赋值一些参数
* @param detailDo

9
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasePlan/PurchasePlanMainServiceImpl.java

@ -209,12 +209,14 @@ public class PurchasePlanMainServiceImpl implements PurchasePlanMainService {
//发货计划新增自动转为发布
this.accPurchasePlanMain(id);
}else{//存在在相同供应商 订单号 送达日期的数据需要更新明细
//HL-5991 供应商号 订单号 送达日期相同 更新明细如果明细为关闭则不更新这条明细
Long id1 = openPlanMainDO.getId();
createReqVO.setId(id1);
validatorToCreateUpdate(createReqVO);
}
}
}else{//存在在相同供应商 订单号 送达日期的数据需要更新明细
//HL-5991 供应商号 订单号 送达日期相同 更新明细如果明细为关闭则不更新这条明细
Long id1 = openPlanMainDO.getId();
createReqVO.setId(id1);
validatorToCreateUpdate(createReqVO);
@ -700,7 +702,8 @@ public class PurchasePlanMainServiceImpl implements PurchasePlanMainService {
poNumberAndPoLineGroupSet.add(tempOne.getPoNumber()+"_"+tempOne.getPoLine()+"_"+tempOne.getItemCode());
}
}
List<PurchasePlanDetailDO> purchasePlanDetailDOS = purchasePlanDetailMapper.selectList(planMainDO.getId());
//HL-5991 供应商号 订单号 送达日期相同 更新明细如果明细为关闭则不更新这条明细
List<PurchasePlanDetailDO> purchasePlanDetailDOS = purchasePlanDetailMapper.selectList(planMainDO.getId());//里面包含关闭和未关闭的明细数据
for (PurchasePlanDetailDO purchasePlanDetailDO : subDOList) {
Boolean a = true;
if(purchasePlanDetailDO.getPlanQty() == null){
@ -709,7 +712,9 @@ public class PurchasePlanMainServiceImpl implements PurchasePlanMainService {
for(PurchasePlanDetailDO en:purchasePlanDetailDOS){
if(purchasePlanDetailDO.getPoLine().equals(en.getPoLine())&& purchasePlanDetailDO.getItemCode().equals(en.getItemCode())){//订单号订单行物料号相同走更新
en.setPlanQty(purchasePlanDetailDO.getPlanQty());
purchasePlanDetailMapper.updateById(en);
if("TRUE".equals(en.getAvailable())){
purchasePlanDetailMapper.updateById(en);
}
a = false;
}
}

7
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/purchasereturnRequest/PurchasereturnRequestMainServiceImpl.java

@ -1896,6 +1896,13 @@ public class PurchasereturnRequestMainServiceImpl implements PurchasereturnReque
List<PurchasereturnRequestMainPrintVO> voList = PurchasereturnRequestMainConvert.INSTANCE.convertPrintVOList1(data.getRecords());
for (PurchasereturnRequestMainPrintVO vo : voList) {
if("1".equals(vo.getTenantId())){
vo.setNameYW("Changchun");
vo.setNameZW("长春");
}else{
vo.setNameYW("Chengdu");
vo.setNameZW("成都");
}
if(vo.getCreator()!=null){
AdminUserRespDTO userRespDTO = userApi.getUser(vo.getCreator());
vo.setCreator(userRespDTO==null?"":userRespDTO.getNickname());

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/putawayJob/PutawayJobMainServiceImpl.java

@ -56,6 +56,7 @@ import com.win.module.wms.service.transaction.TransactionService;
import com.win.module.wms.util.JobUtils;
import com.win.module.wms.util.LocalDateTimeAdapter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -720,6 +721,9 @@ public class PutawayJobMainServiceImpl implements PutawayJobMainService {
putawayRecordDetailDO.setFromLocationGroupCode(fromLocationDO.getLocationGroupCode());
putawayRecordDetailDO.setFromAreaCode(fromLocationDO.getAreaCode());
}
if(StringUtils.isNotEmpty(batchReqVO.getToLocationCode())){
putawayRecordDetailDO.setToLocationCode(batchReqVO.getToLocationCode());
}
String toLocationCode = putawayRecordDetailDO.getToLocationCode();
QueryWrapper<LocationDO> queryWrapperToLocationDO = new QueryWrapper<>();
queryWrapperToLocationDO.eq("code", toLocationCode);
@ -819,7 +823,7 @@ public class PutawayJobMainServiceImpl implements PutawayJobMainService {
transactionCreateReqVOIn.setBatch(putawayJobDetailDO.getBatch());
transactionCreateReqVOIn.setPackingNumber(putawayJobDetailDO.getPackingNumber());
transactionCreateReqVOIn.setInventoryStatus(toInventoryStatus);
transactionCreateReqVOIn.setLocationCode(putawayJobDetailDO.getToLocationCode());
transactionCreateReqVOIn.setLocationCode(putawayRecordDetailDO.getToLocationCode());
transactionCreateReqVOIn.setSinglePrice(balanceDO.getSinglePrice());
if(transactionCreateReqVOIn.getSinglePrice() == null){
StdcostpriceDO stdcostpriceDO = stdcostpriceService.queryStdcostpriceByItemCode(transactionCreateReqVOIn.getItemCode());

175
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/repleinshJob/RepleinshJobMainServiceImpl.java

@ -251,47 +251,54 @@ public class RepleinshJobMainServiceImpl implements RepleinshJobMainService {
// 移除预计出
expectoutService.deleteExpectoutByJobNumber(repleinshJobMainDO.getNumber());
// 根据任务改变申请状态
// QueryWrapper<RepleinshRequestMainDO> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("number", repleinshJobMainDO.getRequestNumber());
// RepleinshRequestMainDO repleinshRequestMainDO = repleinshRequestMainMapper.selectOne(queryWrapper);
// QueryWrapper<RepleinshRequestDetailDO> repleinshRequestDetailDOQueryWrapper = new QueryWrapper<>();
// repleinshRequestDetailDOQueryWrapper.eq("master_id", repleinshRequestMainDO.getId());
// List<RepleinshRequestDetailDO> repleinshRequestDetailDOList1 = repleinshRequestDetailMapper.selectList(repleinshRequestDetailDOQueryWrapper);
// // 判断 该申请下 所有任务都已执行
// List<RepleinshJobMainDO> repleinshJobMainDOList = repleinshJobMainMapper.selectList("request_number", repleinshRequestMainDO.getNumber());
// boolean allWc = false;
// BigDecimal sumJob = BigDecimal.ZERO;
// BigDecimal sumRequest = BigDecimal.ZERO;
// // 优化查询 20240820 cxm
// List<Long> masterIdList = new ArrayList<>();
// for (RepleinshJobMainDO repleinshJobMainDO1 : repleinshJobMainDOList) {
// masterIdList.add(repleinshJobMainDO1.getId());
// // 任务状态 不等于 关闭 和 完成
// if (!repleinshJobMainDO1.getStatus().equals(JobStatusEnum.CLOSED.getCode()) && !repleinshJobMainDO1.getStatus().equals(JobStatusEnum.COMPLETED.getCode())) {
// allWc = false;
// break;
// } else {
// allWc = true;
// }
// }
// List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectByMasterIdList(masterIdList);
// for (RepleinshJobDetailDO repleinshJobDetailDO : repleinshJobDetailDOList) {
// sumJob = sumJob.add(repleinshJobDetailDO.getQty());
// }
// for (RepleinshRequestDetailDO repleinshRequestDetailDO : repleinshRequestDetailDOList1) {
// sumRequest = sumRequest.add(repleinshRequestDetailDO.getQty());
// }
// if (allWc) {
// // 查下 任务数量 是否满足 当前申请 数量 如果申请数量<任务数量 返回提示
// if (sumRequest.compareTo(sumJob) == 0) {
// repleinshRequestMainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
// } else {
// repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
// }
// } else {
// repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
// }
// repleinshRequestMainMapper.updateById(repleinshRequestMainDO);
// 根据任务改变申请状态
QueryWrapper<RepleinshRequestMainDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("number", repleinshJobMainDO.getRequestNumber());
RepleinshRequestMainDO repleinshRequestMainDO = repleinshRequestMainMapper.selectOne(queryWrapper);
QueryWrapper<RepleinshRequestDetailDO> repleinshRequestDetailDOQueryWrapper = new QueryWrapper<>();
repleinshRequestDetailDOQueryWrapper.eq("master_id", repleinshRequestMainDO.getId());
List<RepleinshRequestDetailDO> repleinshRequestDetailDOList1 = repleinshRequestDetailMapper.selectList(repleinshRequestDetailDOQueryWrapper);
// 判断 该申请下 所有任务都已执行
List<RepleinshJobMainDO> repleinshJobMainDOList = repleinshJobMainMapper.selectList("request_number", repleinshRequestMainDO.getNumber());
boolean allWc = false;
BigDecimal sumJob = BigDecimal.ZERO;
BigDecimal sumRequest = BigDecimal.ZERO;
// 优化查询 20240820 cxm
List<Long> masterIdList = new ArrayList<>();
for (RepleinshJobMainDO repleinshJobMainDO1 : repleinshJobMainDOList) {
masterIdList.add(repleinshJobMainDO1.getId());
// 任务状态 不等于 关闭 和 完成
if (!repleinshJobMainDO1.getStatus().equals(JobStatusEnum.CLOSED.getCode()) && !repleinshJobMainDO1.getStatus().equals(JobStatusEnum.COMPLETED.getCode())) {
allWc = false;
break;
} else {
allWc = true;
}
}
List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectByMasterIdList(masterIdList);
for (RepleinshJobDetailDO repleinshJobDetailDO : repleinshJobDetailDOList) {
sumJob = sumJob.add(repleinshJobDetailDO.getQty());
}
for (RepleinshRequestDetailDO repleinshRequestDetailDO : repleinshRequestDetailDOList1) {
sumRequest = sumRequest.add(repleinshRequestDetailDO.getQty());
}
if (allWc) {
// 查下 任务数量 是否满足 当前申请 数量 如果申请数量<任务数量 返回提示
if (sumRequest.compareTo(sumJob) == 0) {
repleinshRequestMainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
} else {
repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
}
} else {
repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
}
repleinshRequestMainDO.setStatus(RequestStatusEnum.CLOSED.getCode());
repleinshRequestMainMapper.updateById(repleinshRequestMainDO);
return repleinshJobMainMapper.updateById(repleinshJobMainDO);
}
@ -613,52 +620,60 @@ public class RepleinshJobMainServiceImpl implements RepleinshJobMainService {
// 6. 申请 部分完成 状态 下 处理按钮:
// a. 执行处理时,申请数量<=任务数量 返回提示《已存在任务数量满足当前申请数量,不可再进行【处理】操作》
// b. 推荐时,库存不满足申请数量,只推荐一部分,导致任务数量 != 任务数量
// 20240918 cxm HL-5057 取消部分完成逻辑
// QueryWrapper<RepleinshRequestMainDO> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("number", repleinshJobMainDO.getRequestNumber());
// RepleinshRequestMainDO repleinshRequestMainDO = repleinshRequestMainMapper.selectOne(queryWrapper);
// QueryWrapper<RepleinshRequestDetailDO> repleinshRequestDetailDOQueryWrapper = new QueryWrapper<>();
// repleinshRequestDetailDOQueryWrapper.eq("master_id", repleinshRequestMainDO.getId());
// List<RepleinshRequestDetailDO> repleinshRequestDetailDOList1 = repleinshRequestDetailMapper.selectList(repleinshRequestDetailDOQueryWrapper);
// // 判断 该申请下 所有任务都已执行
// List<RepleinshJobMainDO> repleinshJobMainDOList = repleinshJobMainMapper.selectList("request_number", repleinshRequestMainDO.getNumber());
// boolean allWc = false;
// BigDecimal sumJob = BigDecimal.ZERO;
// BigDecimal sumRequest = BigDecimal.ZERO;
// // 优化查询 20240820 cxm
// List<Long> masterIdList = new ArrayList<>();
// for (RepleinshJobMainDO repleinshJobMainDO1 : repleinshJobMainDOList) {
// // 特殊情况 排除 只有主没有子的数据
// List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectList(repleinshJobMainDO1.getId());
// if (repleinshJobDetailDOList == null || repleinshJobDetailDOList.size() == 0) {
// continue;
// }
// masterIdList.add(repleinshJobMainDO1.getId());
// // 任务状态 不等于 关闭 和 完成
// if (!repleinshJobMainDO1.getStatus().equals(JobStatusEnum.CLOSED.getCode()) && !repleinshJobMainDO1.getStatus().equals(JobStatusEnum.COMPLETED.getCode())) {
// allWc = false;
// break;
// } else {
// allWc = true;
// }
// }
// List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectByMasterIdList(masterIdList);
// for (RepleinshJobDetailDO repleinshJobDetailDO : repleinshJobDetailDOList) {
// sumJob = sumJob.add(repleinshJobDetailDO.getQty());
// }
// for (RepleinshRequestDetailDO repleinshRequestDetailDO : repleinshRequestDetailDOList1) {
// sumRequest = sumRequest.add(repleinshRequestDetailDO.getQty());
// }
// if (allWc) {
// // 查下 任务数量 是否满足 当前申请 数量 如果申请数量<任务数量 返回提示
// if (sumRequest.compareTo(sumJob) == 0) {
// repleinshRequestMainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
// } else {
// repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
// }
// } else {
// repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
// }
// repleinshRequestMainMapper.updateById(repleinshRequestMainDO);
// 20240918 cxm HL-5057 取消部分完成逻辑 任务完成后直接更改申请为完成
QueryWrapper<RepleinshRequestMainDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("number", repleinshJobMainDO.getRequestNumber());
RepleinshRequestMainDO repleinshRequestMainDO = repleinshRequestMainMapper.selectOne(queryWrapper);
QueryWrapper<RepleinshRequestDetailDO> repleinshRequestDetailDOQueryWrapper = new QueryWrapper<>();
repleinshRequestDetailDOQueryWrapper.eq("master_id", repleinshRequestMainDO.getId());
List<RepleinshRequestDetailDO> repleinshRequestDetailDOList1 = repleinshRequestDetailMapper.selectList(repleinshRequestDetailDOQueryWrapper);
// 判断 该申请下 所有任务都已执行
List<RepleinshJobMainDO> repleinshJobMainDOList = repleinshJobMainMapper.selectList("request_number", repleinshRequestMainDO.getNumber());
boolean allWc = false;
BigDecimal sumJob = BigDecimal.ZERO;
BigDecimal sumRequest = BigDecimal.ZERO;
// 优化查询 20240820 cxm
List<Long> masterIdList = new ArrayList<>();
for (RepleinshJobMainDO repleinshJobMainDO1 : repleinshJobMainDOList) {
// 特殊情况 排除 只有主没有子的数据
List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectList(repleinshJobMainDO1.getId());
if (repleinshJobDetailDOList == null || repleinshJobDetailDOList.size() == 0) {
continue;
}
masterIdList.add(repleinshJobMainDO1.getId());
// 任务状态 不等于 关闭 和 完成
if (!repleinshJobMainDO1.getStatus().equals(JobStatusEnum.CLOSED.getCode()) && !repleinshJobMainDO1.getStatus().equals(JobStatusEnum.COMPLETED.getCode())) {
allWc = false;
break;
} else {
allWc = true;
}
}
List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectByMasterIdList(masterIdList);
for (RepleinshJobDetailDO repleinshJobDetailDO : repleinshJobDetailDOList) {
sumJob = sumJob.add(repleinshJobDetailDO.getQty());
}
for (RepleinshRequestDetailDO repleinshRequestDetailDO : repleinshRequestDetailDOList1) {
sumRequest = sumRequest.add(repleinshRequestDetailDO.getQty());
}
if (allWc) {
// 查下 任务数量 是否满足 当前申请 数量 如果申请数量<任务数量 返回提示
if (sumRequest.compareTo(sumJob) == 0) {
repleinshRequestMainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
} else {
repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
}
} else {
repleinshRequestMainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
}
repleinshRequestMainDO.setStatus(RequestStatusEnum.COMPLETED.getCode());
repleinshRequestMainMapper.updateById(repleinshRequestMainDO);
// 变更记录

129
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/repleinshRequest/RepleinshRequestMainServiceImpl.java

@ -85,8 +85,12 @@ import com.win.module.wms.util.RecommendedUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
@ -175,6 +179,10 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
private ItembasicMapper itembasicMapper;
@Resource
private ConfigApi configApi;
@Resource
private PlatformTransactionManager transactionManager;
RepleinshRequestMainCreateReqVO repleinshRequestMainCreateReqVO ;
@Override
@Transactional
@ -200,6 +208,16 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
mainDO.setDirectCreateRecord(requestsettingDO.getDirectCreateRecord());
mainDO.setFromWarehouseCode(createReqVO.getFromWarehouseCode());
mainDO.setToWarehouseCode(createReqVO.getFromWarehouseCode());
if(createReqVO.getCreator() != null && !"".equals(createReqVO.getCreator())) {
mainDO.setCreator(createReqVO.getCreator());
} else {
mainDO.setCreator(null);
}
if(createReqVO.getUpdater() != null && !"".equals(createReqVO.getUpdater())) {
mainDO.setUpdater(createReqVO.getUpdater());
} else {
mainDO.setUpdater(null);
}
AdminUserRespDTO adminUserRespDTO = userApi.getUser(getLoginUserId());
if (adminUserRespDTO == null) {
mainDO.setDepartmentCode(createReqVO.getDepartmentCode());
@ -214,9 +232,16 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
detailDO.setInventoryStatus(InventoryStatusEnum.OK.getCode()); // 默认合格
detailDO.setId(null);
detailDO.setCreateTime(null);
detailDO.setCreator(null);
detailDO.setUpdateTime(null);
detailDO.setUpdater(null);
if(createReqVO.getCreator() != null && !"".equals(createReqVO.getCreator())) {
detailDO.setCreator(createReqVO.getCreator());
} else {
detailDO.setCreator(null);
}
if(createReqVO.getUpdater() != null && !"".equals(createReqVO.getUpdater())) {
detailDO.setUpdater(createReqVO.getUpdater());
} else {
detailDO.setUpdater(null);
}
}
repleinshRequestDetailMapper.insertBatch(subDOList);
// 调用自动执行方法
@ -671,36 +696,38 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
/**
* 根据开关 判断补料任务按什么拆分
*/
@Transactional
private void splitType(RepleinshRequestMainDO mainDO, List<RepleinshRequestDetailDO> detailDOList, boolean isAuto) {
// 20240918 cxm HL-5057 砍掉部分完成逻辑
// 查下 任务数量 是否满足 当前申请 数量 如果申请数量<任务数量 返回提示
QueryWrapper<RepleinshJobMainDO> repleinshJobMainDOQueryWrapper = new QueryWrapper<>();
repleinshJobMainDOQueryWrapper.eq("request_number",mainDO.getNumber());
repleinshJobMainDOQueryWrapper.ne("status","4");
List<RepleinshJobMainDO> repleinshJobMainDOList = repleinshJobMainMapper.selectList(repleinshJobMainDOQueryWrapper);
if (repleinshJobMainDOList != null && repleinshJobMainDOList.size() > 0) {
BigDecimal sumJob = BigDecimal.ZERO;
BigDecimal sumRequest = BigDecimal.ZERO;
for (RepleinshRequestDetailDO repleinshRequestDetailDO : detailDOList) {
sumRequest = sumRequest.add(repleinshRequestDetailDO.getQty());
}
// 优化查询 20240820 cxm
List<Long> masterIdList = new ArrayList<>();
for (RepleinshJobMainDO repleinshJobMainDO : repleinshJobMainDOList) {
masterIdList.add(repleinshJobMainDO.getId());
}
List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectByMasterIdList(masterIdList);
for (RepleinshJobDetailDO repleinshJobDetailDO : repleinshJobDetailDOList) {
sumJob = sumJob.add(repleinshJobDetailDO.getQty());
}
if (sumRequest.compareTo(sumJob) <= 0) {
// 自动轮询 处理 返回 不异常处理
if (isAuto) {
return;
} else {
throw exception(REQUEST_JOB_DO_NOT_HANDLE);
}
}
}
// QueryWrapper<RepleinshJobMainDO> repleinshJobMainDOQueryWrapper = new QueryWrapper<>();
// repleinshJobMainDOQueryWrapper.eq("request_number",mainDO.getNumber());
// repleinshJobMainDOQueryWrapper.ne("status","4");
// List<RepleinshJobMainDO> repleinshJobMainDOList = repleinshJobMainMapper.selectList(repleinshJobMainDOQueryWrapper);
// if (repleinshJobMainDOList != null && repleinshJobMainDOList.size() > 0) {
// BigDecimal sumJob = BigDecimal.ZERO;
// BigDecimal sumRequest = BigDecimal.ZERO;
// for (RepleinshRequestDetailDO repleinshRequestDetailDO : detailDOList) {
// sumRequest = sumRequest.add(repleinshRequestDetailDO.getQty());
// }
// // 优化查询 20240820 cxm
// List<Long> masterIdList = new ArrayList<>();
// for (RepleinshJobMainDO repleinshJobMainDO : repleinshJobMainDOList) {
// masterIdList.add(repleinshJobMainDO.getId());
// }
// List<RepleinshJobDetailDO> repleinshJobDetailDOList = repleinshJobDetailMapper.selectByMasterIdList(masterIdList);
// for (RepleinshJobDetailDO repleinshJobDetailDO : repleinshJobDetailDOList) {
// sumJob = sumJob.add(repleinshJobDetailDO.getQty());
// }
// if (sumRequest.compareTo(sumJob) <= 0) {
// // 自动轮询 处理 返回 不异常处理
// if (isAuto) {
// return;
// } else {
// throw exception(REQUEST_JOB_DO_NOT_HANDLE);
// }
// }
// }
SwitchDO switchDO = switchService.selectSwitchExist("CreateRepleinshJobSplitByPackage");
// 跳过任务直接生成记录
if ("TRUE".equals(mainDO.getDirectCreateRecord())) {
@ -756,13 +783,22 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
recommendedUtils.getBalanceByBatchOffShelfByRepleinsh(detailDO.getItemCode(), detailDO.getInventoryStatus(), detailDO.getProjectCode(), detailDO.getUnexecutedQty(), mainDO.getFromAreaTypes(),detailDO.getToLocationCode());
// 20240723 提示信息 以站内信发送 同事更新申请主状态为部分完成(第一条任务无库存推荐时)
if (balanceDOListJob == null || balanceDOListJob.size() == 0) {
mainDO.setStatus(RequestStatusEnum.PARTIAL.getCode());
mainDO.setRemark("【" + detailDO.getItemCode() + "】该物料推荐库存扣除预计出后,无有效库存");
repleinshRequestMainMapper.updateById(mainDO);
trendsApi.createTrends(mainDO.getId(), "job_repleinsh_main", "【" + detailDO.getItemCode() + "】该物料推荐库存扣除预计出后,无有效库存", TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
// 该处return 只限于当前循环 主表仍insert入 用事务回滚方式 对于申请表修改还要继续 最后 用删除主信息来做
// repleinshJobMainMapper.deleteById(repleinshJobMainDO);
return;
// mainDO.setStatus(RequestStatusEnum.PARTIAL.getCode()); // 20240918 cxm HL-5057 去掉部分完成状态
// mainDO.setRemark("【" + detailDO.getItemCode() + "】该物料推荐库存扣除预计出后,无有效库存");
// repleinshRequestMainMapper.updateById(mainDO);
// trendsApi.createTrends(mainDO.getId(), "job_repleinsh_main", "【" + detailDO.getItemCode() + "】该物料推荐库存扣除预计出后,无有效库存", TrendsTypeEnum.CREATE, String.valueOf(getLoginUserId()));
// return; // 20240918 cxm HL-5057 无库存时 不创建申请和任务
// 20240918 cxm HL-5057 有多少推荐创建多少任务 无库存不创建申请和任务 forCount == 0 第一次
if (forCount == 0) {
log.info("[补料创建任务--->【{}】该物料推荐库存扣除预计出后,无有效库存]", detailDO.getItemCode());
throw exception(ISSUE_JOB_MAIN_GETBALANCEBYBATCHOFFSHELF_ERROR,detailDO.getItemCode());
// throw new RuntimeException("【"+detailDO.getItemCode()+"】该物料推荐库存扣除预计出后,无有效库存");
} else {
mainDO.setRemark("【" + detailDO.getItemCode() + "】该物料推荐库存扣除预计出后,创建了部分任务");
repleinshRequestMainMapper.updateById(mainDO);
return;
}
}
// 自动轮询 处理 创建主方法在这里写 for循环之前插入会造成很多多余流水号
if (forCount == 0) {
@ -1350,7 +1386,6 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
* 自动补料定时任务触发-未完成--暂时废弃---需要物料库区配置子表详细到对应的库位才能实现
*/
@Override
@Transactional
public void autoRepleinshCreate() {
String inventoryStatus = "OK";
// 从系统参数中获取 库区类型 (目前配置:超市区) 只支持一种
@ -1378,6 +1413,7 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
balanceDOQueryWrapper.groupBy("item_code,area_code,inventory_status");
List<BalanceDO> balanceDOList = balanceMapper.selectList(balanceDOQueryWrapper);
if (balanceDOList != null && balanceDOList.size() > 0) balanceQty = balanceDOList.get(0).getQty();
log.info("[自动补料--->物料:{}]", itemareaDO.getItemCode());
log.info("[自动补料--->库存数量为{}]", balanceQty);
// 判断 最低库存数量 是否大于当前库存数量
// 查询现有补料预计入
@ -1401,7 +1437,7 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
log.info("[自动补料--->物料:{} 上架策略指定库位 {} ]", itemareaDO.getItemCode(),toLocationCode);
LocationDO locationDO = locationMapper.selectLocation(toLocationCode);
// 创建补料申请
RepleinshRequestMainCreateReqVO repleinshRequestMainCreateReqVO = new RepleinshRequestMainCreateReqVO();
repleinshRequestMainCreateReqVO = new RepleinshRequestMainCreateReqVO();
repleinshRequestMainCreateReqVO.setExtraProperties("自动补料");
repleinshRequestMainCreateReqVO.setCreator("1");
repleinshRequestMainCreateReqVO.setCreateTime(LocalDateTime.now());
@ -1436,7 +1472,18 @@ public class RepleinshRequestMainServiceImpl implements RepleinshRequestMainServ
}
}
log.info("[自动补料--->创建补料申请{}]", "应该成功了吧");
this.createRepleinshRequestMain(repleinshRequestMainCreateReqVO);
new Thread(() -> {
// 手动提交事务
TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition());
try {
this.createRepleinshRequestMain(repleinshRequestMainCreateReqVO);
// 手动提交事务
transactionManager.commit(status);
}catch (Exception e) {
// 如果发生异常,回滚事务
transactionManager.rollback(status);
}
}).start();
}
}
}

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleService.java

@ -9,6 +9,7 @@ import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
/**
* 规则 Service 接口
@ -264,5 +265,5 @@ public interface RuleService {
*/
List<RuleRespVO> getGroundingList(String itemCode, String inventoryStatus);
List<RuleImportErrorVO> importRuleList(List<RuleImportExcelVO> list, Integer mode, Boolean updatePart);
List<RuleImportErrorVO> importRuleList(List<RuleImportExcelVO> list, Integer mode, Boolean updatePart, Set<String> codeSet);
}

255
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/rule/RuleServiceImpl.java

@ -31,7 +31,6 @@ import com.win.module.wms.dal.dataobject.locationgroup.LocationgroupDO;
import com.win.module.wms.dal.dataobject.project.ProjectDO;
import com.win.module.wms.dal.dataobject.rule.RuleDO;
import com.win.module.wms.dal.dataobject.supplier.SupplierDO;
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO;
import com.win.module.wms.dal.dataobject.warehouse.WarehouseDO;
import com.win.module.wms.dal.mysql.areabasic.AreabasicMapper;
import com.win.module.wms.dal.mysql.balance.BalanceMapper;
@ -1120,7 +1119,7 @@ public class RuleServiceImpl implements RuleService {
}
@Override
public List<RuleImportErrorVO> importRuleList(List<RuleImportExcelVO> data ,Integer mode , Boolean updatePart){
public List<RuleImportErrorVO> importRuleList(List<RuleImportExcelVO> data ,Integer mode , Boolean updatePart,Set<String> codeSet){
if (CollUtil.isEmpty(data)) {
throw exception(RULE_IMPORT_LIST_IS_EMPTY);
}
@ -1165,32 +1164,128 @@ public class RuleServiceImpl implements RuleService {
.stream()
.map(LocationDO::getCode)
.collect(Collectors.toSet());
// 查询所有库存事务类型信息
Set<String> transactiontypeSet = transactiontypeMapper.selectList(new QueryWrapper<TransactiontypeDO>().eq("available", "TRUE"))
// 查询所有务类型信息
Set<String> businesstypeSet = businesstypeMapper.selectList(new QueryWrapper<BusinesstypeDO>().eq("available", "TRUE"))
.stream()
.map(TransactiontypeDO::getCode)
.map(BusinesstypeDO::getCode)
.collect(Collectors.toSet());
//查询所有字典项集合(因为没有重复的字典项,所以可以这样做)
Set<String> dictTypeSet = dictDataMapper.selectList(new QueryWrapper<DictDataDO>().eq("status", "0").in("dict_type","item_type","abc_class","inventory_status","storage_type","item_group"))
.stream()
.map(DictDataDO::getValue)
.collect(Collectors.toSet());
//查询对应字典信息
// Set<String> itemTypesSet = new HashSet<>(Arrays.asList(DictFrameworkUtils.dictTypeDictDataValue("item_type")));
// Set<String> abcClassesSet = new HashSet<>(Arrays.asList(DictFrameworkUtils.dictTypeDictDataValue("abc_class")));
// Set<String> inventoryStatusSet = new HashSet<>(Arrays.asList(DictFrameworkUtils.dictTypeDictDataValue("inventory_status")));
// Set<String> storageTypeSet = new HashSet<>(Arrays.asList(DictFrameworkUtils.dictTypeDictDataValue("storage_type")));
Gson gson = new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter()).serializeNulls().create();
data.forEach(rule ->{
Gson gson = new GsonBuilder()
.registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter())
.serializeNulls()
.disableHtmlEscaping() // 禁用HTML转义
.create();
for (RuleImportExcelVO rule : data) {
if (mode != null) {
String message = validateRuleImport(rule,dictTypeSet,customerSet, supplierCodeSet,itembasicSet,projectSet,transactiontypeSet,warehouseSet,areabasicSet,locationgroupSet,locationSet);
if (!message.isEmpty()){
//通用字典表
StringBuilder message = validateRuleImport(rule, dictTypeSet, customerSet, supplierCodeSet, itembasicSet, projectSet, businesstypeSet, warehouseSet, areabasicSet, locationgroupSet, locationSet,codeSet);
Map<String, String> dictTypeMap = dictDataMapper.selectList(
new QueryWrapper<DictDataDO>()
.eq("status", "0")
.in("dict_type","inventory_status","storage_type","item_group"))
.stream()
.collect(Collectors.toMap(DictDataDO::getLabel, DictDataDO::getValue));
//物料类型字典表
Map<String, String> itemTypeMap = dictDataMapper.selectList(
new QueryWrapper<DictDataDO>()
.eq("status", "0")
.eq("dict_type","item_type"))
.stream()
.collect(Collectors.toMap(DictDataDO::getLabel, DictDataDO::getValue));
//ABC类字典表
Map<String, String> abcTypeMap = dictDataMapper.selectList(
new QueryWrapper<DictDataDO>()
.eq("status", "0")
.eq("dict_type","abc_class"))
.stream()
.collect(Collectors.toMap(DictDataDO::getLabel, DictDataDO::getValue));
//验证库存状态并且重新赋值
if (StringUtils.isNotBlank(rule.getInventoryValue())) {
StringBuilder inventoryValues = new StringBuilder();
String[] valueArray = rule.getInventoryValue().split(",");
for (String value : valueArray) {
String s = dictTypeMap.get(value);
if (StringUtils.isNotBlank(s)) {
inventoryValues.append(s).append(",");
} else {
message.append(value).append(" ").append("库存状态不正确").append(", ");
}
}
if (inventoryValues.length() > 0) {
inventoryValues.setLength(inventoryValues.length() - 1); // 删除最后一个逗号
}
rule.setInventoryValue(inventoryValues.toString()); // 使用 setInventoryValue 来设置最终的值
}
//验证存储类型并且重新赋值
if (StringUtils.isNotBlank(rule.getStorageValue())) {
StringBuilder storageValues = new StringBuilder();
String[] valueArray = rule.getStorageValue().split(",");
for (String value : valueArray) {
String s = dictTypeMap.get(value);
if (StringUtils.isNotBlank(s)) {
storageValues.append(s).append(",");
} else {
message.append(value).append(" ").append("存储类型不正确").append(", ");
}
}
if (storageValues.length() > 0) {
storageValues.setLength(storageValues.length() - 1); // 删除最后一个逗号
}
rule.setStorageValue(storageValues.toString());
}
// 验证物料类型对应的值是否正确
if (StringUtils.isNotBlank(rule.getItemValue()) && "物料类型".equals(rule.getItem())) {
StringBuilder values = new StringBuilder();
String[] valueArray = rule.getItemValue().split(",");
for (String value : valueArray) {
String s = itemTypeMap.get(value);
if (StringUtils.isNotBlank(s)) {
values.append(s).append(",");
} else {
message.append(value).append(" ").append("物料类型不正确").append(", ");
}
}
if (values.length() > 0) {
values.setLength(values.length() - 1); // 删除最后一个逗号
}
rule.setItemValue(values.toString());
}
// 验证ABC类对应的值是否正确
else if (StringUtils.isNotBlank(rule.getItemValue()) && "ABC类".equals(rule.getItem())) {
StringBuilder values = new StringBuilder();
String[] valueArray = rule.getItemValue().split(",");
for (String value : valueArray) {
String s = abcTypeMap.get(value);
if (StringUtils.isNotBlank(s)) {
values.append(s).append(",");
} else {
message.append(value).append(" ").append("ABC类不正确").append(", ");
}
}
if (values.length() > 0) {
values.setLength(values.length() - 1); // 删除最后一个逗号
}
rule.setItemValue(values.toString());
}
if (message.length() != 0) {
RuleImportErrorVO errorVO = RuleConvert.INSTANCE.convert02(rule);
errorVO.setImportStatus("失败");
errorVO.setImportRemark(message.substring(0, message.length() - 1));
errorList.add(errorVO);
}else {
} else {
RuleDO ruleDO = new RuleDO();
ruleDO.setName(rule.getName());
ruleDO.setStatus(rule.getStatus());
@ -1198,39 +1293,68 @@ public class RuleServiceImpl implements RuleService {
ruleDO.setPriority(rule.getPriority());
ruleDO.setStrategyCode("S005");
//整理condition字段
//设置默认值
List<Map<String, Object>> conditionList = new ArrayList<>();
if (rule.getSupplier() == null) {
rule.setSupplier("供应商");
}
if (rule.getSupplierType() == null) {
rule.setSupplierType("包含");
}
conditionList.add(createCondition(rule.getSupplier(), rule.getSupplierType(), rule.getSupplierValue()));
//设置默认值
if (rule.getItem() == null) {
rule.setItem("物料");
}
if (rule.getItemType() == null) {
rule.setItemType("包含");
}
conditionList.add(createCondition(rule.getItem(), rule.getItemType(), rule.getItemValue()));
//设置默认值
if (rule.getWeight() == null) {
rule.setWeight("重量");
}
if (rule.getWeightType() == null) {
rule.setWeightType("大于");
}
conditionList.add(createCondition(rule.getWeight(), rule.getWeightType(), rule.getWeightValue()));
conditionList.add(createCondition("InventoryStatus", rule.getInventoryType(), rule.getInventoryValue()));
conditionList.add(createCondition("StorageType", rule.getStorageType(), rule.getStorageValue()));
conditionList.add(createCondition("TransactionType", rule.getTransactionType(), rule.getTransactionValue()));
if (rule.getInventoryType() == null) {
rule.setInventoryType("包含");
}
conditionList.add(createCondition("库存状态", rule.getInventoryType(), rule.getInventoryValue()));
if (rule.getStorageType() == null) {
rule.setStorageType("包含");
}
conditionList.add(createCondition("存储类型", rule.getStorageType(), rule.getStorageValue()));
if (rule.getTransactionType() == null) {
rule.setTransactionType("包含");
}
conditionList.add(createCondition("业务类型", rule.getTransactionType(), rule.getTransactionValue()));
//整理configuration字段
Map<String, Object> configuration = createConfiguration(rule);
String conditionJson = gson.toJson(conditionList);
String configurationJson = gson.toJson(configuration);
ruleDO.setCondition(conditionJson);
ruleDO.setConfiguration(configurationJson);
System.out.println(ruleDO);
RuleDO existRuleDO = existRuleDO(ruleDO);
if (existRuleDO == null && mode != 3 ) {
if (existRuleDO == null && mode != 3) {
ruleMapper.insert(ruleDO);
}else if (existRuleDO != null && mode != 2){
} else if (existRuleDO != null && mode != 2) {
ruleDO.setId(existRuleDO.getId());
ruleMapper.updateById(ruleDO);
}
}
}
});
}
return errorList;
}
private String validateRuleImport(RuleImportExcelVO ruleVO,Set<String> dictTypeSet,Set<String> customerSet,Set<String> supplierSet,Set<String> itembasicSet,Set<String> projectSet,Set<String> transactiontypeSet,Set<String> warehouseSet,Set<String> areabasicSet,Set<String> locationgroupSet,Set<String> locationSet){
private StringBuilder validateRuleImport(RuleImportExcelVO ruleVO,Set<String> dictTypeSet,Set<String> customerSet,Set<String> supplierSet,Set<String> itembasicSet,Set<String> projectSet,Set<String> businesstypeSet,Set<String> warehouseSet,Set<String> areabasicSet,Set<String> locationgroupSet,Set<String> locationSet,Set<String> codeSet){
StringBuilder message = new StringBuilder();
// if (StringUtils.isEmpty(ruleVO.getStrategyCode())) {
// message.append("策略代码不能为空").append(",");
// }
if (StringUtils.isEmpty(ruleVO.getName())) {
message.append("策略名称不能为空").append(",");
}
@ -1243,6 +1367,39 @@ public class RuleServiceImpl implements RuleService {
if (ruleVO.getStatus() == null) {
message.append("状态不能为空").append(",");
}
if (ruleVO.getWarehouseValue() == null) {
message.append("条件四 不能为空").append(",");
}
if (ruleVO.getWarehouseValue() == null) {
message.append("条件四值 不能为空").append(",");
}
if (ruleVO.getEmptyLocationFirst() == null) {
message.append("优先空库位不能为空").append(",");
}
if (ruleVO.getNotEmptyLocationFirst() == null) {
message.append("优先非空库位不能为空").append(",");
}
if (ruleVO.getEnableMixItem() == null) {
message.append("可以混物料不能为空").append(",");
}
if (ruleVO.getEnableMixLot() == null) {
message.append("可以混批次不能为空").append(",");
}
if (ruleVO.getEnableMixStatus() == null) {
message.append("可以混状态不能为空").append(",");
}
if (ruleVO.getAisleOrder() == null) {
message.append("巷道排序方向不能为空").append(",");
}
if (ruleVO.getShelfOrder() == null) {
message.append("货架排序方向不能为空").append(",");
}
if (ruleVO.getRowOrder() == null) {
message.append("行排序方向不能为空").append(",");
}
if (ruleVO.getColumOrder() == null) {
message.append("列排序方向不能为空").append(",");
}
// 验证客户对应的值是否正确
if (StringUtils.isNotBlank(ruleVO.getSupplier()) && "客户".equals(ruleVO.getSupplier())) {
validateValues(ruleVO.getSupplierValue(), customerSet, "客户代码不存在", message);
@ -1251,14 +1408,14 @@ public class RuleServiceImpl implements RuleService {
else if (StringUtils.isNotBlank(ruleVO.getSupplier()) && "供应商".equals(ruleVO.getSupplier())) {
validateValues(ruleVO.getSupplierValue(), supplierSet, "供应商代码不存在", message);
}
// 验证物料类型对应的值是否正确
if (StringUtils.isNotBlank(ruleVO.getItemValue()) && "物料类型".equals(ruleVO.getItem())) {
validateValues(ruleVO.getItemValue(), dictTypeSet, "物料类型不正确", message);
}
// 验证ABC类对应的值是否正确
else if (StringUtils.isNotBlank(ruleVO.getItemValue()) && "ABC类".equals(ruleVO.getItem())) {
validateValues(ruleVO.getItemValue(), dictTypeSet, "ABC类不正确", message);
}
// // 验证物料类型对应的值是否正确
// if (StringUtils.isNotBlank(ruleVO.getItemValue()) && "物料类型".equals(ruleVO.getItem())) {
// validateValues(ruleVO.getItemValue(), dictTypeSet, "物料类型不正确", message);
// }
// // 验证ABC类对应的值是否正确
// else if (StringUtils.isNotBlank(ruleVO.getItemValue()) && "ABC类".equals(ruleVO.getItem())) {
// validateValues(ruleVO.getItemValue(), dictTypeSet, "ABC类不正确", message);
// }
// 验证物料分组对应的值是否正确
else if (StringUtils.isNotBlank(ruleVO.getItemValue()) && "物料分组".equals(ruleVO.getItem())) {
validateValues(ruleVO.getItemValue(), dictTypeSet, "物料分组不正确", message);
@ -1272,17 +1429,17 @@ public class RuleServiceImpl implements RuleService {
validateValues(ruleVO.getItemValue(), projectSet, "项目不正确", message);
}
// 验证库存状态对应的值是否正确
if (StringUtils.isNotBlank(ruleVO.getInventoryValue())) {
validateValues(ruleVO.getInventoryValue(), dictTypeSet, "库存状态不正确", message);
}
// 验证存储类型对应的值是否正确
if (StringUtils.isNotBlank(ruleVO.getStorageValue())) {
validateValues(ruleVO.getStorageValue(), dictTypeSet, "存储类型不正确", message);
}
// // 验证库存状态对应的值是否正确
// if (StringUtils.isNotBlank(ruleVO.getInventoryValue())) {
// validateValues(ruleVO.getInventoryValue(), dictTypeSet, "库存状态不正确", message);
// }
// // 验证存储类型对应的值是否正确
// if (StringUtils.isNotBlank(ruleVO.getStorageValue())) {
// validateValues(ruleVO.getStorageValue(), dictTypeSet, "存储类型不正确", message);
// }
// 验证库存事务类型对应的值是否正确
if (StringUtils.isNotBlank(ruleVO.getTransactionValue())) {
validateValues(ruleVO.getTransactionValue(), transactiontypeSet, "库存事务类型不正确", message);
validateValues(ruleVO.getTransactionValue(), businesstypeSet, "业务类型不正确", message);
}
// 验证仓库对应的值是否正确
@ -1301,7 +1458,11 @@ public class RuleServiceImpl implements RuleService {
else if (StringUtils.isNotBlank(ruleVO.getWarehouseValue()) && "库位".equals(ruleVO.getWarehouse())) {
validateValues(ruleVO.getWarehouseValue(), locationSet, "库位不正确", message);
}
return message.toString();
// 验证溢出库位的值是否正确
if (StringUtils.isNotBlank(ruleVO.getOverflowLocationCode())) {
validateValues(ruleVO.getOverflowLocationCode(), codeSet, "溢出库位不正确", message);
}
return message;
}
// 通用验证方法
@ -1337,10 +1498,10 @@ public class RuleServiceImpl implements RuleService {
entry.put("EnableMixItem", vo.getEnableMixItem());
entry.put("EnableMixLot", vo.getEnableMixLot());
entry.put("EnableMixStatus", vo.getEnableMixStatus());
entry.put("AisleOrder", convertOrder(vo.getAisleOrder()));
entry.put("ShelfOrder", convertOrder(vo.getShelfOrder()));
entry.put("RowOrder", convertOrder(vo.getRowOrder()));
entry.put("ColumOrder", convertOrder(vo.getColumOrder()));
entry.put("AisleOrder", vo.getAisleOrder() == null ? "ASC" : convertOrder(vo.getAisleOrder()));
entry.put("ShelfOrder", vo.getShelfOrder() == null ? "ASC" : convertOrder(vo.getShelfOrder()));
entry.put("RowOrder", vo.getRowOrder() == null ? "ASC" : convertOrder(vo.getRowOrder()));
entry.put("ColumOrder", vo.getColumOrder() == null ? "ASC" : convertOrder(vo.getColumOrder()));
return entry;
}
@ -1348,7 +1509,7 @@ public class RuleServiceImpl implements RuleService {
Map<String, Object> entry = new HashMap<>();
entry.put("ParamCode", convertParamCode(paramCode));
entry.put("Operator", convertOperator(operator));
entry.put("Value", value);
entry.put("Value", value == null ? "" : value);
return entry;
}
@ -1393,6 +1554,12 @@ public class RuleServiceImpl implements RuleService {
return "Volume";
case "面积":
return "Area";
case "库存状态":
return "InventoryStatus";
case "存储类型":
return "StorageType";
case "业务类型":
return "TransactionType";
case "仓库":
return "WarehouseCode";
case "库区":

18
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRecord/SaleShipmentMainRecordService.java

@ -1,12 +1,15 @@
package com.win.module.wms.service.saleShipmentRecord;
import java.util.*;
import javax.validation.*;
import com.win.module.wms.controller.saleShipmentRecord.vo.*;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentMainRecordDO;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.module.wms.controller.saleShipmentRecord.vo.SaleShipmentMainRecordCreateReqVO;
import com.win.module.wms.controller.saleShipmentRecord.vo.SaleShipmentMainRecordExportReqVO;
import com.win.module.wms.controller.saleShipmentRecord.vo.SaleShipmentMainRecordPageReqVO;
import com.win.module.wms.controller.saleShipmentRecord.vo.SaleShipmentMainRecordUpdateReqVO;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentMainRecordDO;
import javax.validation.Valid;
import java.util.List;
/**
* 结算出库记录主 Service 接口
@ -68,5 +71,8 @@ public interface SaleShipmentMainRecordService {
* @return 结算出库记录主列表
*/
List<SaleShipmentMainRecordDO> getSaleShipmentMainRecordList(SaleShipmentMainRecordExportReqVO exportReqVO);
List<SaleShipmentMainRecordDO> getSaleShipmentMainRecordSeniorList(CustomConditions conditions);
Integer saleShipmentMainRecordDOAbort(Long id);
}

248
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRecord/SaleShipmentMainRecordServiceImpl.java

@ -1,21 +1,58 @@
package com.win.module.wms.service.saleShipmentRecord;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.win.framework.common.pojo.CustomConditions;
import com.win.framework.common.pojo.PageResult;
import com.win.module.infra.api.trends.TrendsApi;
import com.win.module.infra.enums.TrendsTypeEnum;
import com.win.module.system.api.serialnumber.SerialNumberApi;
import com.win.module.system.api.user.AdminUserApi;
import com.win.module.system.enums.serialNumber.RuleCodeEnum;
import com.win.module.system.util.StringUtils;
import com.win.module.wms.controller.saleShipmentRecord.vo.*;
import com.win.module.wms.controller.transaction.vo.TransactionCreateReqVO;
import com.win.module.wms.convert.saleShipmentRecord.SaleShipmentDetailRecordConvert;
import com.win.module.wms.convert.saleShipmentRecord.SaleShipmentMainRecordConvert;
import com.win.module.wms.dal.dataobject.areabasic.AreabasicDO;
import com.win.module.wms.dal.dataobject.businesstype.BusinesstypeDO;
import com.win.module.wms.dal.dataobject.interfaceinfo.InterfaceInfoDO;
import com.win.module.wms.dal.dataobject.location.LocationDO;
import com.win.module.wms.dal.dataobject.sale.SaleDetailDO;
import com.win.module.wms.dal.dataobject.sale.SaleMainDO;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentDetailRecordDO;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentMainRecordDO;
import com.win.module.wms.dal.dataobject.saleShipmentRequest.SaleShipmentMainDO;
import com.win.module.wms.dal.dataobject.transactiontype.TransactiontypeDO;
import com.win.module.wms.dal.mysql.sale.SaleDetailMapper;
import com.win.module.wms.dal.mysql.sale.SaleMainMapper;
import com.win.module.wms.dal.mysql.saleShipmentRecord.SaleShipmentDetailRecordMapper;
import com.win.module.wms.dal.mysql.saleShipmentRecord.SaleShipmentMainRecordMapper;
import com.win.module.wms.dal.mysql.saleShipmentRequest.SaleShipmentMainMapper;
import com.win.module.wms.enums.common.InterfaceTypeEnum;
import com.win.module.wms.enums.request.RequestStatusEnum;
import com.win.module.wms.service.accountcalendar.AccountcalendarService;
import com.win.module.wms.service.interfaceinfo.InterfaceInfoService;
import com.win.module.wms.service.location.LocationService;
import com.win.module.wms.service.transaction.TransactionService;
import com.win.module.wms.util.JobUtils;
import com.win.module.wms.util.LocalDateTimeAdapter;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.*;
import com.win.module.wms.dal.dataobject.saleShipmentRecord.SaleShipmentMainRecordDO;
import com.win.framework.common.pojo.PageResult;
import com.win.framework.common.pojo.CustomConditions;
import com.win.module.wms.convert.saleShipmentRecord.SaleShipmentMainRecordConvert;
import com.win.module.wms.dal.mysql.saleShipmentRecord.SaleShipmentMainRecordMapper;
import java.util.stream.Collectors;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.win.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static com.win.module.wms.enums.ErrorCodeConstants.*;
/**
@ -26,9 +63,32 @@ import static com.win.module.wms.enums.ErrorCodeConstants.*;
@Service
@Validated
public class SaleShipmentMainRecordServiceImpl implements SaleShipmentMainRecordService {
@Resource
private AdminUserApi userApi;
@Resource
private JobUtils jobUtils;
@Resource
private TrendsApi trendsApi;
@Resource
private SerialNumberApi serialNumberApi;
@Resource
private TransactionService transactionService;
@Resource
private LocationService locationService;
@Resource
private InterfaceInfoService interfaceInfoService;
@Resource
private AccountcalendarService accountcalendarService;
@Resource
private SaleMainMapper saleMainMapper;
@Resource
private SaleDetailMapper saleDetailMapper;
@Resource
private SaleShipmentMainRecordMapper saleShipmentMainRecordMapper;
@Resource
private SaleShipmentDetailRecordMapper saleShipmentDetailRecordMapper;
@Resource
private SaleShipmentMainMapper saleShipmentMainMapper;
@Override
public Long createSaleShipmentMainRecord(SaleShipmentMainRecordCreateReqVO createReqVO) {
@ -86,4 +146,172 @@ public class SaleShipmentMainRecordServiceImpl implements SaleShipmentMainRecord
public List<SaleShipmentMainRecordDO> getSaleShipmentMainRecordSeniorList(CustomConditions conditions) {
return saleShipmentMainRecordMapper.selectSeniorList(conditions);
}
@Override
@Transactional
public Integer saleShipmentMainRecordDOAbort(Long id) {
SaleShipmentMainRecordDO mainDO = validateSaleShipmentMainRecordDOExists(id);
if (StringUtils.equals(mainDO.getRevokeFlag(), "TRUE") || !StringUtils.isEmpty(mainDO.getRelateRecordNumber())) {
throw exception(SALE_SHIPMENT_MAIN_RECORD_CANNOT_ABORT);
}
mainDO.setRevokeFlag("TRUE");
this.generateAbort(mainDO, saleShipmentDetailRecordMapper.selectList(mainDO.getId()));
int updateCnt = saleShipmentMainRecordMapper.updateById(mainDO);
if (updateCnt == 0) {
throw exception(PLEASE_DO_NOT_RESUBMIT);
}
trendsApi.createTrends(id, "record_sale_shipment_main", "终止了结算出库记录", TrendsTypeEnum.REQUEST_CLOSE, String.valueOf(getLoginUserId()));
return updateCnt;
}
private SaleShipmentMainRecordDO validateSaleShipmentMainRecordDOExists(Long id) {
SaleShipmentMainRecordDO saleShipmentMainDO = saleShipmentMainRecordMapper.selectById(id);
if (saleShipmentMainDO == null) {
throw exception(SALE_SHIPMENT_MAIN_RECORD_NOT_EXISTS);
}
return saleShipmentMainDO;
}
/**
* 结算出库终止操作
*
* @param mainDO
* @param detailDOList
*/
private void generateAbort(SaleShipmentMainRecordDO mainDO, List<SaleShipmentDetailRecordDO> detailDOList) {
SaleShipmentMainRecordCreateReqVO saleShipmentMainRecordCreateReqVO = new SaleShipmentMainRecordCreateReqVO();
BeanUtils.copyProperties(mainDO, saleShipmentMainRecordCreateReqVO);
saleShipmentMainRecordCreateReqVO.setRelateRecordNumber(mainDO.getNumber());
String number = serialNumberApi.generateCode(RuleCodeEnum.SALE_SHIPMENT_RECORD.getCode());
saleShipmentMainRecordCreateReqVO.setNumber(number);
//增加业务类型
BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("SaleShipmentRecord", "结算出库记录");
saleShipmentMainRecordCreateReqVO.setBusinessType(businesstypeDO.getCode());
// SaleShipmentMainRecordDO saleShipmentMainRecordDO = mainDO;
SaleShipmentMainRecordDO saleShipmentMainRecordDO = SaleShipmentMainRecordConvert.INSTANCE.convert(saleShipmentMainRecordCreateReqVO);
saleShipmentMainRecordDO.setExecuteTime(LocalDateTime.now());
saleShipmentMainRecordDO.setAvailable("TRUE");
// saleShipmentMainRecordDO.setExecuteTime(LocalDateTime.now());
saleShipmentMainRecordMapper.insert(saleShipmentMainRecordDO);
saleShipmentMainMapper.update(
new SaleShipmentMainDO() {{
setNumber(saleShipmentMainRecordDO.getRequestNumber());
setStatus(RequestStatusEnum.ABROGATE.getCode());
}},
new LambdaUpdateWrapper<SaleShipmentMainDO>().set(SaleShipmentMainDO::getStatus, RequestStatusEnum.ABROGATE.getCode()).eq(SaleShipmentMainDO::getNumber, saleShipmentMainRecordDO.getRequestNumber()));
//创建出库存事务
List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>();
List<SaleShipmentDetailRecordDO> installRecord = new ArrayList<>();
List<SaleDetailDO> updateSaleDetail = new ArrayList<>();
//销售订单主
Set<String> soNumberSet = detailDOList.stream().map(SaleShipmentDetailRecordDO::getSoNumber).collect(Collectors.toSet());
List<SaleMainDO> saleMainList = saleMainMapper.selectList("number", soNumberSet);
Map<String, SaleMainDO> saleMainMap = saleMainList.stream().collect(Collectors.toMap(SaleMainDO::getNumber, e -> e));
//销售订单子
List<SaleDetailDO> saleDetailList = saleDetailMapper.selectList("number", soNumberSet);
Map<String, SaleDetailDO> saleDetailMap = saleDetailList.stream().collect(Collectors.toMap(e -> String.join("_", e.getNumber(), e.getLineNumber()), e -> e));
//结算出库子
detailDOList.stream().iterator().forEachRemaining(saleShipmentDetailDO -> {
SaleShipmentDetailRecordCreateReqVO saleShipmentDetailRecordCreateReqVO = new SaleShipmentDetailRecordCreateReqVO();
BeanUtils.copyProperties(saleShipmentDetailDO, saleShipmentDetailRecordCreateReqVO);
saleShipmentDetailRecordCreateReqVO.setNumber(number);
saleShipmentDetailRecordCreateReqVO.setMasterId(saleShipmentMainRecordDO.getId());
saleShipmentDetailRecordCreateReqVO.setQty(saleShipmentDetailRecordCreateReqVO.getQty().negate());
SaleShipmentDetailRecordDO recordDetailDO = SaleShipmentDetailRecordConvert.INSTANCE.convert(saleShipmentDetailRecordCreateReqVO);
installRecord.add(recordDetailDO);
//销售订单数据
SaleMainDO saleMainDO = saleMainMap.get(recordDetailDO.getSoNumber());
if (ObjectUtils.isNotEmpty(saleMainDO)) {
SaleDetailDO saleDetailDO = saleDetailMap.get(String.join("_", recordDetailDO.getSoNumber(), recordDetailDO.getSoLine()));
if (ObjectUtils.isEmpty(saleDetailDO.getSettleQty())) {
saleDetailDO.setSettleQty(BigDecimal.ZERO);
}
saleDetailDO.setSettleQty(saleDetailDO.getSettleQty().add(saleShipmentDetailRecordCreateReqVO.getQty()));
updateSaleDetail.add(saleDetailDO);
}
//添加发货任务的库存事务list
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVO);
//增加业务类型
transactionCreateReqVO.setBusinessType(businesstypeDO.getCode());
String inTransactionType = businesstypeDO.getInTransactionType();
if (StringUtils.isNotEmpty(inTransactionType)) {
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(inTransactionType);
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
transactionCreateReqVO.setBusinessType(saleShipmentMainRecordDO.getBusinessType());
transactionCreateReqVO.setLocationCode(recordDetailDO.getFromLocationCode());
transactionCreateReqVO.setOwnerCode(recordDetailDO.getFromOwnerCode());
transactionCreateReqVO.setRecordNumber(number);
transactionCreateReqVO.setBatch(recordDetailDO.getBatch());
transactionCreateReqVO.setInventoryStatus("OK");
if (StringUtils.isEmpty(recordDetailDO.getPackingNumber())) {
transactionCreateReqVO.setPackingNumber("");
} else {
transactionCreateReqVO.setPackingNumber(recordDetailDO.getPackingNumber());
}
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVO.setId(null);
transactionCreateReqVO.setAmount(BigDecimal.ZERO);
transactionCreateReqVO.setSiteId(recordDetailDO.getSiteId());
// 根据 库位 获取 库区DO
String locationCode = transactionCreateReqVO.getLocationCode();
if (StringUtils.isNotEmpty(locationCode)) {
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
transactionCreateReqVO.setAreaType(areabasicDOOut.getType());
}
transactionCreateReqVOList.add(transactionCreateReqVO);
}
});
//批量插入子
saleShipmentDetailRecordMapper.insertBatch(installRecord);
//批量修改
saleDetailMapper.updateBatch(updateSaleDetail);
//创建库存事务
transactionService.createTransaction(transactionCreateReqVOList);
if (!CollectionUtils.isEmpty(detailDOList)) {
this.generateAbortAddInterfaceInfo(saleShipmentMainRecordDO, installRecord);
}
trendsApi.createTrends(mainDO.getId(), "request_sale_shipment_main", "结算出库作废修改结算出库记录", TrendsTypeEnum.REQUEST_CLOSE, String.valueOf(getLoginUserId()));
}
/**
* @param mainDO
* @param detailDOList
*/
private void generateAbortAddInterfaceInfo(SaleShipmentMainRecordDO mainDO, List<SaleShipmentDetailRecordDO> detailDOList) {
if (!CollectionUtils.isEmpty(detailDOList)) {
// 添加到接口记录表
Gson gson = new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter()).serializeNulls().create();
InterfaceInfoDO interfaceInfoDO = new InterfaceInfoDO();
interfaceInfoDO.setNumber(String.join("_", "sale", "dis", InterfaceTypeEnum.REQUEST_SALE_SHIPMENT_MAIN.getCode(), String.valueOf(mainDO.getId())));
interfaceInfoDO.setInterfaceType("WMS-QAD");
interfaceInfoDO.setInterfaceName("推送结算出库撤销");
interfaceInfoDO.setUrl("/wms/record-sale-shipment-main/saleShipmentMainRecordDOAbort");
Map<String, Object> shMap = new HashMap<>();
Set<String> FromLocationCodeSet = detailDOList.stream().map(SaleShipmentDetailRecordDO::getFromLocationCode).collect(Collectors.toSet());
List<LocationDO> locationList = locationService.selectLocationBypcodes(FromLocationCodeSet);
Map<String, LocationDO> locationMap = locationList.stream().collect(Collectors.toMap(LocationDO::getCode, e -> e));
detailDOList.stream().iterator().forEachRemaining(detailDO ->
detailDO.setFromLocationCode(Optional.ofNullable(locationMap.get(detailDO.getFromLocationCode()))
.map(LocationDO::getQadLocationCode)
.orElseThrow(() -> exception(LOCATION_QAD_AND_LOCATIONCODE_NOT_EXISTS, detailDO.getFromLocationCode()))));
// 设置账期
LocalDateTime activeTime = accountcalendarService.getAccountCalendar();
mainDO.setActiveDate(activeTime);
shMap.put("main", mainDO);
shMap.put("detail", detailDOList);
interfaceInfoDO.setReqBody(gson.toJson(shMap));
interfaceInfoDO.setCreator("1");
interfaceInfoDO.setCreateTime(LocalDateTime.now());
interfaceInfoDO.setInterfaceStatus("3");
interfaceInfoDO.setBusinessNumber(mainDO.getNumber());
interfaceInfoDO.setBusinessId(mainDO.getId());
interfaceInfoService.insertInterfaceData(interfaceInfoDO);
}
}
}

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRequest/SaleShipmentMainService.java

@ -140,5 +140,5 @@ public interface SaleShipmentMainService {
* @param id
* @return
*/
Integer abortSaleShipmentMainAbort(Long id);
// Integer abortSaleShipmentMainAbort(Long id);
}

133
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/saleShipmentRequest/SaleShipmentMainServiceImpl.java

@ -586,10 +586,16 @@ public class SaleShipmentMainServiceImpl implements SaleShipmentMainService {
if (RequestStatusEnum.HANDLING.getCode().equals(mainDO.getStatus())) {
this.generateRecord(mainDO, saleShipmentDetailMapper.selectList(mainDO.getId()));
}
SaleShipmentMainDO mianDO = saleShipmentMainMapper.selectById(id);
List<SaleShipmentDetailDO> detailDOList = saleShipmentDetailMapper.selectList("master_id", id);
generateAbortAddInterfaceInfo(mianDO, detailDOList, "推送结算出库审批");
trendsApi.createTrends(id, "request_sale_shipment_main", "审批同意了结算出库申请", TrendsTypeEnum.REQUEST_AGREE, String.valueOf(getLoginUserId()));
return saleShipmentMainMapper.updateById(mainDO);
}
//执行
@Transactional
@Override
@ -630,134 +636,18 @@ public class SaleShipmentMainServiceImpl implements SaleShipmentMainService {
}
/**
* 终止
*
* @param id
* @return
*/
@Transactional
@Override
public Integer abortSaleShipmentMainAbort(Long id) {
SaleShipmentMainDO mainDO = validateSaleShipmentMainAbortExists(id);
if (ObjectUtils.isEmpty(mainDO)) {
throw exception(SALE_SHIPMENT_MAIN_NOT_EXISTS);
}
if (StringUtils.equals(mainDO.getStatus(), RequestStatusEnum.ABORT.getCode())) {
throw exception(SALE_SHIPMENT_MAIN_REQUEST_CANNOT_ABORT);
}
mainDO.setStatus(RequestStatusEnum.ABORT.getCode());
int updateCnt = saleShipmentMainMapper.updateById(mainDO);
if (updateCnt == 0) {
throw exception(PLEASE_DO_NOT_RESUBMIT);
}
this.generateAbort(mainDO, saleShipmentDetailMapper.selectList(mainDO.getId()));
trendsApi.createTrends(id, "request_sale_shipment_main", "终止了结算出库申请", TrendsTypeEnum.REQUEST_CLOSE, String.valueOf(getLoginUserId()));
return updateCnt;
}
/**
* 结算出库终止操作
*
* @param mainDO
* @param detailDOList
*/
private void generateAbort(SaleShipmentMainDO mainDO, List<SaleShipmentDetailDO> detailDOList) {
SaleShipmentMainRecordCreateReqVO saleShipmentMainRecordCreateReqVO = new SaleShipmentMainRecordCreateReqVO();
BeanUtils.copyProperties(mainDO, saleShipmentMainRecordCreateReqVO);
saleShipmentMainRecordCreateReqVO.setRequestNumber(mainDO.getNumber());
String number = serialNumberApi.generateCode(RuleCodeEnum.SALE_SHIPMENT_RECORD.getCode());
saleShipmentMainRecordCreateReqVO.setNumber(number);
//增加业务类型
BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("SaleShipmentRecord", "结算出库记录");
saleShipmentMainRecordCreateReqVO.setBusinessType(businesstypeDO.getCode());
SaleShipmentMainRecordDO saleShipmentMainRecordDO = SaleShipmentMainRecordConvert.INSTANCE.convert(saleShipmentMainRecordCreateReqVO);
saleShipmentMainRecordDO.setDepartmentCode(userApi.getUser(getLoginUserId()).getDeptId().toString());
saleShipmentMainRecordDO.setExecuteTime(LocalDateTime.now());
saleShipmentMainRecordDO.setAvailable("TRUE");
saleShipmentMainRecordDO.setExecuteTime(LocalDateTime.now());
saleShipmentMainRecordMapper.insert(saleShipmentMainRecordDO);
//创建出库存事务
List<TransactionCreateReqVO> transactionCreateReqVOList = new ArrayList<>();
for (SaleShipmentDetailDO saleShipmentDetailDO : detailDOList) {
SaleShipmentDetailRecordCreateReqVO saleShipmentDetailRecordCreateReqVO = new SaleShipmentDetailRecordCreateReqVO();
BeanUtils.copyProperties(saleShipmentDetailDO, saleShipmentDetailRecordCreateReqVO);
saleShipmentDetailRecordCreateReqVO.setNumber(number);
saleShipmentDetailRecordCreateReqVO.setMasterId(saleShipmentMainRecordDO.getId());
saleShipmentDetailRecordCreateReqVO.setQty(saleShipmentDetailRecordCreateReqVO.getQty().negate());
SaleShipmentDetailRecordDO recordDetailDO = SaleShipmentDetailRecordConvert.INSTANCE.convert(saleShipmentDetailRecordCreateReqVO);
saleShipmentDetailRecordMapper.insert(recordDetailDO);
SaleMainDO saleMainDO = saleMainMapper.selectOne("number", recordDetailDO.getSoNumber());
if (ObjectUtils.isNotEmpty(saleMainDO)) {
SaleDetailDO saleDetailDO = saleDetailMapper.selectOne("number", recordDetailDO.getSoNumber(), "line_number", recordDetailDO.getSoLine());
if (ObjectUtils.isEmpty(saleDetailDO.getSettleQty())) {
saleDetailDO.setSettleQty(BigDecimal.ZERO);
}
if (ObjectUtils.isNotEmpty(saleMainDO) && StringUtils.equals("DISCRETE", saleMainDO.getType())) {
if (saleShipmentDetailDO.getQty().compareTo(saleDetailDO.getOrderQty().add(saleDetailDO.getSettleQty().negate())) == -1) {
throw exception(QTY_EXCEPTION, "销售订单" + saleMainDO.getNumber() +
"结算数量" + saleDetailDO.getSettleQty().negate() + "销售订单数量" + saleDetailDO.getOrderQty() +
"不能为负数" + (saleDetailDO.getSettleQty().negate().add(saleShipmentDetailDO.getQty())).subtract(saleDetailDO.getOrderQty()));
} else {
saleDetailDO.setSettleQty(saleDetailDO.getSettleQty().add(recordDetailDO.getQty().negate()));
saleDetailMapper.updateById(saleDetailDO);
}
}
}
//添加发货任务的库存事务list
TransactionCreateReqVO transactionCreateReqVO = new TransactionCreateReqVO();
BeanUtils.copyProperties(recordDetailDO, transactionCreateReqVO);
//增加业务类型
transactionCreateReqVO.setBusinessType(businesstypeDO.getCode());
String inTransactionType = businesstypeDO.getInTransactionType();
if (StringUtils.isNotEmpty(inTransactionType)) {
TransactiontypeDO transactiontypeDO = jobUtils.selectDocumentFromTransactionType(inTransactionType);
transactionCreateReqVO.setInventoryAction(transactiontypeDO.getInventoryAction());
transactionCreateReqVO.setTransactionType(transactiontypeDO.getCode());
transactionCreateReqVO.setBusinessType(saleShipmentMainRecordDO.getBusinessType());
transactionCreateReqVO.setLocationCode(recordDetailDO.getFromLocationCode());
transactionCreateReqVO.setOwnerCode(recordDetailDO.getFromOwnerCode());
transactionCreateReqVO.setRecordNumber(number);
transactionCreateReqVO.setBatch(recordDetailDO.getBatch());
transactionCreateReqVO.setInventoryStatus("OK");
if (StringUtils.isEmpty(recordDetailDO.getPackingNumber())) {
transactionCreateReqVO.setPackingNumber("");
} else {
transactionCreateReqVO.setPackingNumber(recordDetailDO.getPackingNumber());
}
transactionCreateReqVO.setWorker(String.valueOf(userApi.getUser(getLoginUserId()).getId()));
transactionCreateReqVO.setId(null);
transactionCreateReqVO.setAmount(BigDecimal.ZERO);
transactionCreateReqVO.setSiteId(recordDetailDO.getSiteId());
// 根据 库位 获取 库区DO
String locationCode = transactionCreateReqVO.getLocationCode();
if (StringUtils.isNotEmpty(locationCode)) {
AreabasicDO areabasicDOOut = jobUtils.getAreabasicDO(transactionCreateReqVO.getLocationCode());
transactionCreateReqVO.setAreaType(areabasicDOOut.getType());
}
transactionCreateReqVOList.add(transactionCreateReqVO);
}
}
//创建库存事务
transactionService.createTransaction(transactionCreateReqVOList);
if (!CollectionUtils.isEmpty(detailDOList)) {
this.generateAbortAddInterfaceInfo(mainDO, detailDOList);
}
trendsApi.createTrends(mainDO.getId(), "request_sale_shipment_main", "结算出库作废修改结算出库记录", TrendsTypeEnum.REQUEST_CLOSE, String.valueOf(getLoginUserId()));
}
/**
* @param mainDO
* @param detailDOList
*/
private void generateAbortAddInterfaceInfo(SaleShipmentMainDO mainDO, List<SaleShipmentDetailDO> detailDOList) {
private void generateAbortAddInterfaceInfo(SaleShipmentMainDO mainDO, List<SaleShipmentDetailDO> detailDOList, String interfaceName) {
if (!CollectionUtils.isEmpty(detailDOList)) {
// 添加到接口记录表
Gson gson = new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter()).serializeNulls().create();
InterfaceInfoDO interfaceInfoDO = new InterfaceInfoDO();
interfaceInfoDO.setNumber("dis" + "_" + InterfaceTypeEnum.REQUEST_SALE_SHIPMENT_MAIN.getCode() + '_' + mainDO.getId());
interfaceInfoDO.setNumber(String.join("_", "sale", "agree", InterfaceTypeEnum.REQUEST_SALE_SHIPMENT_MAIN.getCode(), String.valueOf(mainDO.getId())));
interfaceInfoDO.setInterfaceType("WMS-QAD");
interfaceInfoDO.setInterfaceName("推送结算出库终止");
interfaceInfoDO.setUrl("/wms/sale-shipment-main-discard/handleSaleShipmentMainDiscard");
interfaceInfoDO.setInterfaceName(interfaceName);
interfaceInfoDO.setUrl("/wms/sale-shipment-main-discard/agreeSaleShipmentMain");
Map<String, Object> shMap = new HashMap<>();
for (SaleShipmentDetailDO detailDO : detailDOList) {
@ -768,6 +658,9 @@ public class SaleShipmentMainServiceImpl implements SaleShipmentMainService {
throw exception(LOCATION_QAD_AND_LOCATIONCODE_NOT_EXISTS, detailDO.getFromLocationCode());
}
}
LocalDateTime activeTime = accountcalendarService.getAccountCalendar();
mainDO.setActiveDate(activeTime);
shMap.put("main", mainDO);
shMap.put("detail", detailDOList);
interfaceInfoDO.setReqBody(gson.toJson(shMap));

82
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierdeliverRequest/SupplierdeliverRequestMainServiceImpl.java

@ -96,6 +96,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -183,6 +184,7 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
@Override
@Transactional
public Long createSupplierdeliverRequestMain(SupplierdeliverRequestMainCreateReqVO createReqVO) {
verifyBooleanMinPlan(createReqVO.getPpNumber());
// 插入主表
BusinesstypeDO businesstypeDO = jobUtils.selectDocumentSettingFromBusinessType("SupplierDeliverRequest", "供应商发货申请");
createReqVO.setBusinessType(businesstypeDO.getCode());
@ -512,8 +514,8 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
this.validatorItembasic(detailDo.getItemCode());
this.validatorSupplierItemExist(mainDo.getSupplierCode(), detailDo.getItemCode());
//PurchasePlanDetailDO purchasePlanDetailDO = this.validatorPurchasePlan(mainDo, detailDo);
PurchasePlanDetailDO purchasePlanDetailDO = selectPurchasePlans(mainDo.getPpNumber(), mainDo.getSupplierCode(), detailDo.getPoNumber(),
detailDo.getPoLine(), detailDo.getItemCode());
// PurchasePlanDetailDO purchasePlanDetailDO = selectPurchasePlans(mainDo.getPpNumber(), mainDo.getSupplierCode(), detailDo.getPoNumber(),
// detailDo.getPoLine(), detailDo.getItemCode());
QueryWrapper<PurchaseMainDO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("number", detailDo.getPoNumber());
@ -606,6 +608,10 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
SupplierdeliverRequestMainDO supplierdeliverRequestMainDO = validatorMainMethod(createReqVO);
// 子表校验
List<SupplierdeliverRequestDetailCreateReqVO> subList = createReqVO.getSubList();
for(SupplierdeliverRequestDetailCreateReqVO detailDo:subList){
PurchasePlanDetailDO purchasePlanDetailDO = selectPurchasePlans(createReqVO.getPpNumber(), createReqVO.getSupplierCode(), createReqVO.getPoNumber(),
detailDo.getPoLine(), detailDo.getItemCode());
}
//根据要货计划单号查询要货计划并根据订单号+订单行+物料号作为ke与新增发货申请做比较
String ppNumber = supplierdeliverRequestMainDO.getPpNumber(); // 要货计划单号
PurchaseMainDO purchaseMainDO = purchaseMainMapper.selectByNumber(subList.get(0).getPoNumber());
@ -613,14 +619,16 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
queryWrapperX.eq(PurchasePlanDetailDO::getNumber, ppNumber);
queryWrapperX.eq(PurchasePlanDetailDO::getAvailable, "TRUE");
List<PurchasePlanDetailDO> purchasePlanDetailDOList = purchasePlanDetailMapper.selectList(queryWrapperX);
Map<String, BigDecimal> planQtyMap = new HashMap<>();
Map<String, BigDecimal> shippedQtyMap = new HashMap<>();
Map<String, BigDecimal> planQtyMap = new HashMap<>();//要货计划每条明细的计划数量
Map<String, BigDecimal> shippedQtyMap = new HashMap<>();//要货计划每条明细的发货数量
Map<String, PurchasePlanDetailDO> supplierMap = new HashMap<>();//key 订单号+订单行+物料号 value明细 用于比对关闭明细数据
for (PurchasePlanDetailDO purchasePlanDetailDO : purchasePlanDetailDOList) {
String key = purchasePlanDetailDO.getPoNumber() + "#@#" + purchasePlanDetailDO.getPoLine() + "#@#" + purchasePlanDetailDO.getItemCode();
planQtyMap.put(key, purchasePlanDetailDO.getPlanQty());
planQtyMap.put(key, purchasePlanDetailDO.getPlanQty());//计划数量
shippedQtyMap.put(key, purchasePlanDetailDO.getShippedQty());//已发货数量
supplierMap.put(key,purchasePlanDetailDO);
}
// 获取子表相同订单号,订单行,物料代码的发货数量合计
// 获取新增子表相同订单号,订单行,物料代码的发货数量合计
Map<String, BigDecimal> supplierQtyMap = new HashMap<>();
Map<String, String> supplierAllowOverShipmentMap = new HashMap<>();//key 是物料号 vale是是否超值
Set<String> batchAndPoLineGroupSet = new HashSet<>();//用订单行+批次作唯一校验
@ -643,10 +651,11 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
batchAndPoLineGroupSet.add(supplierdeliverRequestDetailCreateReqVO.getPoLine()+"_"+supplierdeliverRequestDetailCreateReqVO.getBatch());
}
}
for (Map.Entry<String, BigDecimal> entry : planQtyMap.entrySet()) {
List<PurchasePlanDetailDO> closeDetailDo = new ArrayList<>();//需要关闭要货计划明细的列表数据
for (Map.Entry<String, BigDecimal> entry : planQtyMap.entrySet()) {//判断非超发或离散订单下校验合并数量不能大于计划数量,申请数量不能大于该计划下明细中计划数量-发货数
String key = entry.getKey();
BigDecimal planQty = entry.getValue();
if (supplierQtyMap.get(key) != null) {
if (supplierQtyMap.get(key) != null) {//说明下面的数据是要货计划中存在的明细
BigDecimal supplierQtyBig = supplierQtyMap.get(key);//相同行相同物料相同订单号的申请发货数量合
String[] keys = key.split("#@#");
String item = keys[2];
@ -661,9 +670,29 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
throw exception(SUPPLIERDELIVER_REQUEST_MAIN_SHIPEDQTY_CHECK, supplierdeliverRequestMainDO.getPpNumber(), keys[0], keys[1], keys[2], residueBig);
}
}
//HL-5991 申请数量大于等于计划数量的时候关闭子明细即子明细是否可用为FALSE
if(planQty.compareTo(supplierQtyBig) <= 0){//申请数量大于等于计划数量
PurchasePlanDetailDO purchasePlanDetailDO = supplierMap.get(key);
purchasePlanDetailDO.setAvailable("FALSE");
closeDetailDo.add(purchasePlanDetailDO);
}
}
}
//HL-5991 申请数量大于等于计划数量的时候关闭子明细即子明细是否可用为FALSE
if(!closeDetailDo.isEmpty()){
purchasePlanDetailMapper.updateBatch(closeDetailDo);
//判断该要货计划下所有明细是否都为FALSE,如果都为FALSE那么主要货计划也关闭
Long masterId = closeDetailDo.get(0).getMasterId();//要货计划主id
QueryWrapper<PurchasePlanDetailDO> wrapper = new QueryWrapper<>();
wrapper.eq("master_id",masterId);
wrapper.eq("available","TRUE");
List<PurchasePlanDetailDO> purchasePlanDetailDOS = purchasePlanDetailMapper.selectList(wrapper);
if(purchasePlanDetailDOS.isEmpty()){//为空说明子计划都是关闭主也关闭
PurchasePlanMainDO purchasePlanMainDO = purchasePlanMainMapper.selectOne("id", masterId);
purchasePlanMainDO.setStatus("2");//关闭
purchasePlanMainMapper.updateById(purchasePlanMainDO);
}
}
List<SupplierdeliverRequestDetailDO> subDOList = SupplierdeliverRequestDetailConvert.INSTANCE.convertList03(subList);
supplierdeliverRequestMainDO.setId(null);
supplierdeliverRequestMainDO.setCreator(null);
@ -1546,7 +1575,7 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
if (purchasePlanDetailDO != null && "TRUE".equals(purchasePlanDetailDO.getAvailable())) {
return purchasePlanDetailDO;
} else {
throw new UtilException("要货计划明细:订单号" + ppoNumber + "订单行" + ppoLine + "、物料号" + pitemCode + "、无效");
throw new UtilException("要货计划明细:订单号" + ppoNumber + "订单行" + ppoLine + "、物料号" + pitemCode + "、无效");
}
} else {
throw new UtilException("要货计划" + pnubmer + "已经关闭");
@ -1555,4 +1584,37 @@ public class SupplierdeliverRequestMainServiceImpl implements SupplierdeliverReq
throw new UtilException("根据计划单号" + pnubmer + ",供应商代码" + psupplierCode + "未查找到要货计划");
}
}
/**
* 根据要货计划单号校验供应商发货申请选择的要货计划送达日期是否为最小不是提示
* @param ppNumber
*/
public void verifyBooleanMinPlan(String ppNumber) {
List<PurchasePlanMainDO> planMainDOS = purchasePlanMainMapper.selectList("number", ppNumber);
PurchasePlanMainDO purchasePlanMainDO = planMainDOS.get(0);//要货计划主
String supplierCode = purchasePlanMainDO.getSupplierCode();
QueryWrapper<PurchasePlanMainDO> wrapper = new QueryWrapper<>();
wrapper.eq("supplier_code",supplierCode);
wrapper.eq("status","4");
wrapper.isNotNull("delivery_date");
wrapper.orderByAsc("delivery_date");
List<PurchasePlanMainDO> planMainDOS1 = purchasePlanMainMapper.selectList(wrapper);
if(planMainDOS1.isEmpty()){
throw exception(PURCHASE_PLAN_MAIN_NOT_EXISTS);
}else{
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime deliveryDate = planMainDOS1.get(0).getDeliveryDate();
String selectDate = deliveryDate.format(formatter);
LocalDateTime deliveryDate1 = purchasePlanMainDO.getDeliveryDate();
if(deliveryDate1==null){
//抛出异常
throw exception(PURCHASE_PLAN_DELIVERYDATE_NOT_NULL);
}
String uesDate = deliveryDate1.format(formatter);
if(!selectDate.equals(uesDate)){//提示最小
throw exception(PURCHASE_PLAN_DELIVERYDATE_NOT_MIN,uesDate,planMainDOS1.get(0).getNumber(),selectDate);
}
}
}
}

3
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierinvoiceRecord/SupplierinvoiceRecordMainServiceImpl.java

@ -284,9 +284,10 @@ public class SupplierinvoiceRecordMainServiceImpl implements SupplierinvoiceReco
supplierinvoiceDTOList.add(supplierinvoiceDTO);
}
if (supplierinvoiceDTOList.size() > 0) {
long timestamp = System.currentTimeMillis();
Gson gson = new GsonBuilder().registerTypeAdapter(LocalDateTime.class, new LocalDateTimeAdapter()).serializeNulls().create();
InterfaceInfoDO interfaceInfoDO = new InterfaceInfoDO();
interfaceInfoDO.setNumber("record_supplierinvoice_main_" + supplierinvoiceRecordMainDO.getId());
interfaceInfoDO.setNumber(String.join("_","hz",String.valueOf(supplierinvoiceRecordMainDO.getId()),String.valueOf(timestamp)));
interfaceInfoDO.setInterfaceType("SCP-QAD");
interfaceInfoDO.setInterfaceName("推送发票回转");
interfaceInfoDO.setInterfaceStatus("3");

13
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierinvoiceRequest/SupplierinvoiceRequestDetailServiceImpl.java

@ -482,7 +482,6 @@ public class SupplierinvoiceRequestDetailServiceImpl implements SupplierinvoiceR
statusList.add("2");// 通过
statusList.add("3");// 作废
queryWrapper.in("status", statusList);
queryWrapper.eq("request_status", "3");
if (pageReqVO.getDeliveryDate() != null && pageReqVO.getDeliveryDate().length > 0) {
queryWrapper.ge("prh_rcp_date", pageReqVO.getDeliveryDate()[0]);
if (pageReqVO.getDeliveryDate().length > 1) {
@ -491,6 +490,7 @@ public class SupplierinvoiceRequestDetailServiceImpl implements SupplierinvoiceR
}
if(pageReqVO.getIsNegative()!=null&&pageReqVO.getIsNegative()){
queryWrapper.lt("invoicable_quantity", 0);
queryWrapper.apply(" STR_TO_DATE(prh_rcp_date, '%Y-%m-%d') < DATE_FORMAT(CURDATE(), '%Y-%m-01') and (status = '6' or issued_invoicable_quantity is null or issued_invoicable_quantity != invoicable_quantity)");
}
queryWrapper.orderByAsc("invoicable_quantity");
supplierinvoiceInvoicedMapper.selectPage(receiptRecordPage, queryWrapper);
@ -504,7 +504,10 @@ public class SupplierinvoiceRequestDetailServiceImpl implements SupplierinvoiceR
QueryWrapper<SupplierinvoiceInvoicedDO> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq(SupplierinvoiceInvoicedDO::getSupplierCode, pageReqVO.getSupplierCode());
// queryWrapper.eq(SupplierinvoiceInvoicedDO::getOrderType,pageReqVO.getOrderType());
List<String> statusList = new ArrayList<>();
statusList.add("2");// 通过
statusList.add("3");// 作废
queryWrapper.in("status", statusList);
queryWrapper.eq("supplier_code", pageReqVO.getSupplierCode());
queryWrapper.eq("order_type", pageReqVO.getOrderType());
queryWrapper.apply(" STR_TO_DATE(prh_rcp_date, '%Y-%m-%d') < DATE_FORMAT(CURDATE(), '%Y-%m-01') and (status = '6' or issued_invoicable_quantity is null or issued_invoicable_quantity != invoicable_quantity) ");
@ -515,6 +518,7 @@ public class SupplierinvoiceRequestDetailServiceImpl implements SupplierinvoiceR
}
}
queryWrapper.orderByAsc("invoicable_quantity");
queryWrapper.orderByAsc("id");
Page<SupplierinvoiceInvoicedDO> supplierinvoiceInvoicedDOPage = supplierinvoiceInvoicedMapper.selectPage(receiptRecordPage, queryWrapper);
Set<String> recvBillNumSet = new HashSet<>();
Set<String> poLineSet = new HashSet<>();
@ -756,8 +760,13 @@ public class SupplierinvoiceRequestDetailServiceImpl implements SupplierinvoiceR
@Override
public PageResult<ReceiptOrReturnRespVO> getInvoicedSenior(CustomConditions conditions) {
QueryWrapper<SupplierinvoiceInvoicedDO> queryWrapper = QueryWrapperUtils.structure(conditions);
List<String> statusList = new ArrayList<>();
statusList.add("2");// 通过
statusList.add("3");// 作废
queryWrapper.in("status", statusList);
queryWrapper.apply(" STR_TO_DATE(prh_rcp_date, '%Y-%m-%d') < DATE_FORMAT(CURDATE(), '%Y-%m-01') and (status = '6' or issued_invoicable_quantity is null or issued_invoicable_quantity != invoicable_quantity) ");
queryWrapper.orderByAsc("invoicable_quantity");
queryWrapper.orderByAsc("id");
PageResult<SupplierinvoiceInvoicedDO> supplierinvoiceInvoicedDOPage = supplierinvoiceInvoicedMapper.selectPage(conditions, queryWrapper);
Set<String> recvBillNumSet = new HashSet<>();
Set<String> poLineSet = new HashSet<>();

6
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/supplierinvoiceRequest/SupplierinvoiceRequestMainServiceImpl.java

@ -864,7 +864,11 @@ public class SupplierinvoiceRequestMainServiceImpl implements SupplierinvoiceReq
// "tCInvoiceCIAPM_invamount": 【传输供应商维护未税金额】
supplierinvoiceDTO.setTCInvoiceCIAPMInvamount(supplierinvoiceRecordMainDO.getAmount());
// "tCInvoiceCIAPM_taxamount":【传输税额总计:供应商维护税额 + 返利税额】
supplierinvoiceDTO.setTCInvoiceCIAPMTaxamount(supplierinvoiceRecordMainDO.getTaxAmount().add(supplierinvoiceRecordMainDO.getRebateTax()));
BigDecimal rebateTax = supplierinvoiceRecordMainDO.getRebateTax();
if(rebateTax==null){
rebateTax = BigDecimal.ZERO;
}
supplierinvoiceDTO.setTCInvoiceCIAPMTaxamount(supplierinvoiceRecordMainDO.getTaxAmount().add(rebateTax));
supplierinvoiceDTOList.add(supplierinvoiceDTO);
}

2
win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/util/RecommendedUtils.java

@ -292,6 +292,8 @@ public class RecommendedUtils {
if (countQty.compareTo(qty) != -1) {
break;
}
// 20240918 cxm HL-5057 推荐不跨批次 最小批次有多少推荐多少 之后结束推荐逻辑
break;
}
if (balanceDOListJob == null || balanceDOListJob.isEmpty()) {
// 20240715 能创建多少创建多少 空不提示错误 继续往下执行

Loading…
Cancel
Save