Merge remote-tracking branch 'origin/dev_business' into dev_business
已添加23个文件
已修改66个文件
已删除18个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # PowerShell å½ä»¤è§å |
| | | |
| | | ## è§å |
| | | |
| | | ç±äºé¡¹ç®è¿è¡å¨ Windows ç¯å¢ä¸ï¼ç¨æ·ç»ç«¯é»è®¤ä½¿ç¨ PowerShell èé bashã卿ä¾å½ä»¤è¡æå¯¼æ¶ï¼å¿
é¡»ä½¿ç¨ PowerShell è¯æ³ã |
| | | |
| | | ## 常ç¨å½ä»¤å¯¹ç
§ |
| | | |
| | | | æä½ | Bash | PowerShell | |
| | | |------|------|-------------| |
| | | | å é¤ç®å½ | `rm -rf <path>` | `Remove-Item -Recurse -Force <path>` æç®å `ri -r -fo <path>` | |
| | | | å¤å¶æä»¶ | `cp <src> <dest>` | `Copy-Item <src> <dest>` æç®å `cp <src> <dest>` | |
| | | | ç§»å¨æä»¶ | `mv <src> <dest>` | `Move-Item <src> <dest>` æç®å `mv <src> <dest>` | |
| | | | å建ç®å½ | `mkdir -p <path>` | `New-Item -ItemType Directory -Path <path>` æç®å `md <path>` | |
| | | | æ¥çæä»¶ | `cat <file>` | `Get-Content <file>` æç®å `gc <file>` | |
| | | | ååºæä»¶ | `ls` | `Get-ChildItem` æç®å `ls`/`dir` | |
| | | | æ¥æ¾æä»¶ | `find . -name "*.java"` | `Get-ChildItem -Recurse -Filter "*.java"` æç®å `gci -r -fi "*.java"` | |
| | | | æ¥æ¾å
容 | `grep -r "pattern" .` | `Select-String -Path "*.java" -Pattern "pattern"` æç®å `sls "pattern" *.java -r` | |
| | | |
| | | ## å é¤ç®å½ç¤ºä¾ |
| | | |
| | | ```powershell |
| | | # æ¨èï¼ä½¿ç¨ Remove-Item 宿´å½ä»¤ |
| | | Remove-Item -Recurse -Force yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/client |
| | | |
| | | # ç®åå½¢å¼ |
| | | ri -r -fo yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/client |
| | | ``` |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - PowerShell åæ°ä½¿ç¨ `-` åç¼ï¼å¦ `-Recurse`ã`-Force` |
| | | - åæ°å¯ä»¥ç®åé¦åæ¯ï¼å¦ `-r`ã`-fo` |
| | | - è·¯å¾åéç¬¦å¨ PowerShell ä¸å¯ä»¥ä½¿ç¨ `/` æ `\`ï¼æ¨èä½¿ç¨ `/` ä»¥ä¿æè·¨å¹³å°å
¼å®¹ |
| | | - é¿å
`-rf` è¿æ ·ç bash 飿 ¼åæ°ç»åï¼PowerShell 䏿¯æ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | Subproject commit a26b31cc9f3ee9b21b1a754e80fa7359e8a7a8f8 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # å é¤ MES 客æ·åä¾åºå模å - è¿åº¦è·è¸ª |
| | | |
| | | ## 任塿¦è¿° |
| | | å é¤ MES 模åä¸ç¬ç«ç客æ·ï¼MesMdClientï¼åä¾åºåï¼MesMdVendorï¼ç®¡çåè½ï¼æ¹ä¸ºå¤ç¨ï¼ |
| | | - **客æ·**ï¼ä½¿ç¨ CRM ç客æ·ç®¡çï¼CrmCustomerApiï¼ |
| | | - **ä¾åºå**ï¼ä½¿ç¨éè´æ¨¡åçä¾åºå管çï¼ErpSupplierApiï¼ |
| | | |
| | | --- |
| | | |
| | | ## 已宿 â
|
| | | |
| | | ### Step 1: æ©å± CRM å ERP API |
| | | - [x] CrmCustomerApi å·²æ `validateCustomer` æ¹æ³ï¼å¯ç´æ¥ä½¿ç¨ |
| | | - [x] ErpSupplierApi å·²æ `validateSupplier` æ¹æ³ï¼å·²æ ¡éªåå¨+å¯ç¨ï¼ï¼å¯ç´æ¥ä½¿ç¨ |
| | | |
| | | ### Step 2: æ¿æ¢ Service å±å¼ç¨ |
| | | |
| | | **å®¢æ·æ ¡éªæ¿æ¢ï¼4个æä»¶ï¼ï¼** |
| | | - [x] MesWmProductSalesServiceImpl.java |
| | | - [x] MesWmSalesNoticeServiceImpl.java |
| | | - [x] MesWmReturnSalesServiceImpl.java |
| | | - [x] MesQcOqcServiceImpl.java |
| | | |
| | | **ä¾åºåæ ¡éªæ¿æ¢ï¼5个æä»¶ï¼ï¼** |
| | | - [x] MesWmReturnVendorServiceImpl.java |
| | | - [x] MesWmOutsourceReceiptServiceImpl.java |
| | | - [x] MesWmOutsourceIssueServiceImpl.java |
| | | - [x] MesQcIqcServiceImpl.java |
| | | |
| | | ### Step 3: æ¿æ¢ Controller å±å¼ç¨ |
| | | |
| | | **客æ·ä¿¡æ¯æ¼æ¥ï¼å·²å®æï¼ï¼** |
| | | - [x] MesProTaskController.java |
| | | - [x] MesProMpsController.java |
| | | - [x] MesQcOqcController.java |
| | | - [x] MesQcPendingInspectController.java |
| | | - [x] MesWmProductIssueController.java |
| | | - [x] MesWmBatchController.java |
| | | - [x] MesWmPackageController.java |
| | | |
| | | **ä¾åºåä¿¡æ¯æ¼æ¥ï¼å·²å®æï¼ï¼** |
| | | - [x] MesWmMaterialStockController.java |
| | | - [x] MesWmBatchController.java |
| | | - [x] MesWmReturnVendorController.java |
| | | - [x] MesWmOutsourceReceiptController.java |
| | | - [x] MesWmOutsourceIssueController.java |
| | | - [x] MesQcIqcController.java |
| | | - [x] MesQcPendingInspectController.java |
| | | - [x] MesProWorkOrderController.java |
| | | |
| | | ### Step 4: æ´æ° DO 注é |
| | | |
| | | **客æ·ï¼6个æä»¶ï¼ï¼** |
| | | - [x] MesProWorkOrderDO |
| | | - [x] MesProTaskDO |
| | | - [x] MesProMpsDO |
| | | - [x] MesQcOqcDO |
| | | - [x] MesWmBatchDO |
| | | - [x] MesWmPackageDO |
| | | |
| | | **ä¾åºåï¼7个æä»¶ï¼ï¼** |
| | | - [x] MesWmReturnVendorDO |
| | | - [x] MesWmOutsourceReceiptDO |
| | | - [x] MesWmOutsourceIssueDO |
| | | - [x] MesWmMaterialStockDO |
| | | - [x] MesWmBatchDO |
| | | - [x] MesQcIqcDO |
| | | - [x] MesProWorkOrderDO |
| | | |
| | | **å
¶ä»ç¸å
³ DO æä»¶ï¼** |
| | | - [x] MesWmArrivalNoticeDO |
| | | - [x] MesWmItemReceiptDO |
| | | - [x] MesWmProductSalesDO |
| | | - [x] MesWmSalesNoticeDO |
| | | |
| | | ### Step 5: æ¸
çæ ç¨ import |
| | | |
| | | - [x] å 餿æ DO æä»¶ä¸ç `MesMdClientDO` å `MesMdVendorDO` import è¯å¥ |
| | | |
| | | ### Step 6: å é¤ MES 客æ·/ä¾åºå模åæä»¶ |
| | | |
| | | **å¾
å é¤ç®å½ï¼éæå¨æ§è¡ï¼ï¼** |
| | | ``` |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/client/ |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/vendor/ |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/md/client/ |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/md/vendor/ |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/md/client/ |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/md/vendor/ |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/client/ |
| | | yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/vendor/ |
| | | ``` |
| | | |
| | | ### Step 7: å 餿°æ®åºè¡¨ |
| | | |
| | | - [x] `DROP TABLE IF EXISTS mes_md_client;` â
å·²æ§è¡ |
| | | - [x] `DROP TABLE IF EXISTS mes_md_vendor;` â
å·²æ§è¡ |
| | | |
| | | ### ç¼è¯éªè¯ |
| | | - [x] `mvn compile -pl yudao-module-mes -am -q` ç¼è¯éè¿ â
|
| | | |
| | | ### Step 8: å®¢æ·æéè¿æ»¤ï¼ä¸»æ¥è¯¢ï¼ |
| | | |
| | | **已添å CRM API æ¹æ³ï¼** |
| | | - [x] CrmCustomerApi.getPermittedCustomerIds() - è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | |
| | | **已添å å®¢æ·æéè¿æ»¤ç Mapper å Serviceï¼** |
| | | - [x] MesWmSalesNoticeMapper + MesWmSalesNoticeService - åè´§éç¥å |
| | | - [x] MesWmReturnSalesMapper + MesWmReturnSalesService - éå®éè´§å |
| | | - [x] MesWmProductSalesMapper + MesWmProductSalesService - éå®åºåºå |
| | | - [x] MesWmPackageMapper + MesWmPackageService - è£
ç®±å |
| | | - [x] MesWmBatchMapper + MesWmBatchService - æ¹æ¬¡ç®¡ç |
| | | - [x] MesQcOqcMapper + MesQcOqcService - åºè´§æ£éªå |
| | | - [x] MesProWorkOrderMapper + MesProWorkOrderService - ç产工å |
| | | - [x] MesProMpsMapper + MesProMpsService - ç产主计å |
| | | - [x] ErpSaleOrderMapper + ErpSaleOrderService - ERP éå®è®¢å |
| | | |
| | | **ç¼è¯éªè¯ï¼** |
| | | - [x] `mvn compile -pl yudao-module-mes -am -q` ç¼è¯éè¿ â
|
| | | - [x] `mvn compile -pl yudao-module-erp -am -q` ç¼è¯éè¿ â
|
| | | |
| | | ### Step 9: CRM 模åå®¢æ·æéè¿æ»¤ |
| | | |
| | | **已添å å®¢æ·æéè¿æ»¤ï¼** |
| | | - [x] CrmContractMapper + CrmContractService - åå管ç |
| | | - [x] CrmSaleQuotationMapper + CrmSaleQuotationService - é宿¥ä»·å |
| | | |
| | | **ç¼è¯éªè¯ï¼** |
| | | - [x] `mvn compile -pl yudao-module-crm -am -q` ç¼è¯éè¿ â
|
| | | |
| | | --- |
| | | |
| | | ## å¾
æå¨æ§è¡ |
| | | |
| | | ### å 餿¨¡åæä»¶ |
| | | |
| | | å¨ IDE æç»ç«¯ä¸æ§è¡ä»¥ä¸å½ä»¤å é¤ MES 客æ·/ä¾åºå模åæä»¶ï¼ |
| | | |
| | | ```bash |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/client |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/vendor |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/md/client |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/md/vendor |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/md/client |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/md/vendor |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/client |
| | | rm -rf yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/vendor |
| | | ``` |
| | | |
| | | --- |
| | | |
| | | ## ä¿®æ¹è§åæ»ç» |
| | | |
| | | - **å®¢æ· API è°ç¨**ï¼ |
| | | - `clientService.getClientMap(ids)` â `customerApi.getCustomerMap(ids)`ï¼ç´æ¥è¿å Mapï¼ |
| | | - `clientService.validateClientExistsAndEnable(id)` â `customerApi.validateCustomer(id)` |
| | | |
| | | - **ä¾åºå API è°ç¨**ï¼ |
| | | - `vendorService.getVendorMap(ids)` â `supplierApi.getSupplierList(ids).getCheckedData()`ï¼è¿å Listï¼é转 Mapï¼ |
| | | - `vendorService.validateVendorExistsAndEnable(id)` â `supplierApi.validateSupplier(id)` |
| | | |
| | | - **DTO åæ®µå·®å¼**ï¼ |
| | | - `CrmCustomerRespDTO` æ `code` å `nickname` åæ®µï¼åªæ `name` |
| | | - `ErpSupplierRespDTO` æ `code` å `nickname` åæ®µï¼åªæ `name` |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ç产主计åï¼MPSï¼- å端èè°æ¹æ¡ |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - éå®è®¢ååè¡¨é¡µï¼æ°å¢"æ¯å¦éè¦ç产"åï¼ |
| | | - éå®è®¢å详æ
é¡µï¼æ°å¢"æ¯å¦éè¦ç产"å¼å
³ï¼ |
| | | - ç产主计ååè¡¨é¡µï¼æ°å¢ï¼ |
| | | - ç产主计å详æ
é¡µï¼æ°å¢ï¼ |
| | | - çäº§ä¸»è®¡åæ°å¢é¡µï¼æ°å¢ï¼æ¯ææå¨åå»ºï¼ |
| | | |
| | | ## ä¸å¡æµç¨ä¸æ°æ®å¸¦å
¥ |
| | | |
| | | ### 1. æå¨å建 MPS |
| | | |
| | | ``` |
| | | çäº§ä¸»è®¡åæ°å¢é¡µ |
| | | â |
| | | å¡«åï¼äº§åãæ°éã客æ·ãéæ±æ¥æç |
| | | â |
| | | æäº¤å建 MPSï¼ç¼ç èªå¨çæï¼ |
| | | â |
| | | MPS ç¶æä¸ºè稿 |
| | | ``` |
| | | |
| | | **èªå¨çæç¼ç æ ¼å¼**ï¼`MPS + yyyyMMdd + 001`ï¼å¦ MPS20240701001ï¼ |
| | | |
| | | ### 2. éå®è®¢åå®¡æ ¸éè¿ -> èªå¨å建 MPS |
| | | |
| | | ``` |
| | | éå®è®¢åå®¡æ ¸éè¿ |
| | | â |
| | | BPM çå¬å¨è§¦å |
| | | â |
| | | éåéå®è®¢åæç»ï¼å¯¹äº need_production=1 çæç» |
| | | â |
| | | è°ç¨ MesProMpsApi.createMps() å建 MPS |
| | | â |
| | | æ´æ°éå®è®¢åæç»ç mps_id åæ®µ |
| | | ``` |
| | | |
| | | **æ°æ®å¸¦å
¥ï¼** |
| | | - MPS.sale_order_id â éå®è®¢å.id |
| | | - MPS.sale_order_no â éå®è®¢å.no |
| | | - MPS.sale_order_item_id â éå®è®¢åæç».id |
| | | - MPS.product_id â éå®è®¢åæç».productId |
| | | - MPS.quantity â éå®è®¢åæç».count |
| | | - MPS.client_id â éå®è®¢å.customerId |
| | | - MPS.request_date â éå®è®¢å.orderTime |
| | | |
| | | ### 2. MPS ä¸å -> çæç产订å |
| | | |
| | | ``` |
| | | MPS åæ¡ä¸å |
| | | â |
| | | å建ç产工åï¼ç±»å=èªè¡çäº§ï¼æ¥æºç±»å=客æ·è®¢åï¼ |
| | | â |
| | | å·¥åèªå¨ç¡®è®¤ä¸ºå·²ç¡®è®¤ç¶æ |
| | | â |
| | | æ´æ° MPS ç¶æä¸ºå·²ä¸åï¼å
³èå·¥å ID |
| | | ``` |
| | | |
| | | ### 3. MPS åå¹¶ä¸å |
| | | |
| | | ``` |
| | | 鿩夿¡ç¸å产åç MPS |
| | | â |
| | | æ ¡éªï¼ç¸å产åãèç¨¿ç¶æ |
| | | â |
| | | 计ç®åå¹¶æ°é = SUM(quantity) |
| | | â |
| | | åå»ºä¸æ¡ç产工åï¼æ°é为åå¹¶æ°éï¼ |
| | | â |
| | | æ´æ°ææ MPS ç¶æä¸ºå·²ä¸åï¼å
³èåä¸å·¥å |
| | | â |
| | | è®°å½åå¹¶æç»å° mes_pro_mps_merge_item |
| | | ``` |
| | | |
| | | ## API |
| | | |
| | | ### MPS ç¸å
³æ¥å£ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pro-mps/create | å建 MPS | |
| | | | PUT | /mes/pro-mps/update | æ´æ° MPS | |
| | | | DELETE | /mes/pro-mps/delete | å é¤ MPS | |
| | | | GET | /mes/pro-mps/get | è·å MPS 详æ
| |
| | | | GET | /mes/pro-mps/page | å页æ¥è¯¢ MPS | |
| | | | POST | /mes/pro-mps/issue | ä¸ååæ¡ MPS | |
| | | | POST | /mes/pro-mps/merge-issue | åå¹¶ä¸å夿¡ MPS | |
| | | | POST | /mes/pro-mps/cancel | åæ¶ MPS | |
| | | | GET | /mes/pro-mps/export-excel | å¯¼åº MPS | |
| | | |
| | | ### éå®è®¢åæ¥å£åæ´ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | åæ´è¯´æ | |
| | | |------|------|----------| |
| | | | GET | /erp/sale-order/get | ååºæ°å¢ needProductionãmpsId åæ®µ | |
| | | | GET | /erp/sale-order/page | ååºæ°å¢ needProduction åæ®µ | |
| | | | POST | /erp/sale-order/create | è¯·æ±æ°å¢ needProduction åæ®µ | |
| | | | PUT | /erp/sale-order/update | è¯·æ±æ°å¢ needProduction åæ®µ | |
| | | |
| | | ## 请æ±åæ° |
| | | |
| | | ### MPS åå»ºè¯·æ± |
| | | |
| | | ```json |
| | | { |
| | | "productId": 300, |
| | | "quantity": 100.00, |
| | | "unitMeasureId": 1, |
| | | "clientId": 400, |
| | | "requestDate": "2024-01-01T00:00:00", |
| | | "remark": "夿³¨" |
| | | } |
| | | ``` |
| | | |
| | | **说æ**ï¼ |
| | | - `code` åæ®µå¯éï¼ä¸å¡«åèªå¨çæ |
| | | - `saleOrderId`ã`saleOrderNo`ã`saleOrderItemId` å¯éï¼æå¨å建æ¶ä¸å¡« |
| | | ``` |
| | | |
| | | ### MPS ä¸åè¯·æ± |
| | | |
| | | ``` |
| | | POST /mes/pro-mps/issue?id=123 |
| | | ``` |
| | | |
| | | ### MPS åå¹¶ä¸åè¯·æ± |
| | | |
| | | ```json |
| | | // POST /mes/pro-mps/merge-issue |
| | | [123, 124, 125] |
| | | ``` |
| | | |
| | | ## ååºå段 |
| | | |
| | | ### MPS 详æ
ååº |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | id | Long | MPS ç¼å· | |
| | | | code | String | MPS ç¼ç | |
| | | | status | Integer | ç¶æï¼0=è稿 1=å·²ä¸å 2=已宿 3=å·²åæ¶ï¼ | |
| | | | saleOrderId | Long | éå®è®¢åID | |
| | | | saleOrderNo | String | éå®è®¢åå· | |
| | | | saleOrderItemId | Long | éå®è®¢åæç»ID | |
| | | | productId | Long | 产åID | |
| | | | productCode | String | 产åç¼ç | |
| | | | productName | String | 产ååç§° | |
| | | | productSpecification | String | è§æ ¼åå· | |
| | | | unitMeasureName | String | åä½ | |
| | | | quantity | BigDecimal | 计åç产æ°é | |
| | | | quantityProduced | BigDecimal | å·²ç产æ°é | |
| | | | clientId | Long | 客æ·ID | |
| | | | clientCode | String | 客æ·ç¼ç | |
| | | | clientName | String | 客æ·åç§° | |
| | | | requestDate | DateTime | éæ±æ¥æ | |
| | | | issueDate | DateTime | ä¸åæ¥æ | |
| | | | finishDate | DateTime | å®ææ¥æ | |
| | | | workOrderId | Long | ç产工åID | |
| | | | workOrderCode | String | ç产工åç¼ç | |
| | | | mergeFlag | Integer | æ¯å¦åå¹¶ä¸å | |
| | | | mergeBatchNo | String | åå¹¶æ¹æ¬¡å· | |
| | | | remark | String | 夿³¨ | |
| | | | createTime | DateTime | å建æ¶é´ | |
| | | |
| | | ### ååºç¤ºä¾ |
| | | |
| | | ```json |
| | | { |
| | | "code": 0, |
| | | "data": { |
| | | "id": 1024, |
| | | "code": "MPS-001", |
| | | "status": 0, |
| | | "saleOrderId": 100, |
| | | "saleOrderNo": "SO-001", |
| | | "productId": 300, |
| | | "productCode": "P-001", |
| | | "productName": "产åA", |
| | | "quantity": 100.00, |
| | | "quantityProduced": 0, |
| | | "clientId": 400, |
| | | "clientName": "客æ·A", |
| | | "requestDate": "2024-01-01T00:00:00", |
| | | "mergeFlag": 0, |
| | | "createTime": "2024-01-01T10:00:00" |
| | | }, |
| | | "msg": "æä½æå" |
| | | } |
| | | ``` |
| | | |
| | | ## åæ®µå±ç¤ºè§å |
| | | |
| | | | åæ®µ | å±ç¤ºä½ç½® | 说æ | |
| | | |------|----------|------| |
| | | | MPS ç¼ç | å表ã详æ
| 䏻鮿 è¯ | |
| | | | ç¶æ | å表ã详æ
| è稿(è)ãå·²ä¸å(绿)ã已宿(ç´«)ã已忶(红) | |
| | | | éå®è®¢åå· | å表ã详æ
| å
³èæ¥æº | |
| | | | 产åç¼ç /åç§° | å表ã详æ
| ç产对象 | |
| | | | è®¡åæ°é | å表ã详æ
| æ ¸å¿æ°æ® | |
| | | | å·²ç产æ°é | 详æ
| è¿åº¦è·è¸ª | |
| | | | 客æ·åç§° | å表ã详æ
| éæ±æ¹ | |
| | | | éæ±æ¥æ | å表ã详æ
| 交æè¦æ± | |
| | | | ç产工åç¼ç | å表ã详æ
| ä¸ååæ¾ç¤ºï¼å¯ç¹å»è·³è½¬ | |
| | | |
| | | ## ä¸å¡è§å说æ |
| | | |
| | | | åºæ¯ | è§å | |
| | | |------|------| |
| | | | å建 MPS | ä»
èç¨¿ç¶æå¯ç¼è¾ãå é¤ | |
| | | | ä¸å MPS | ä»
èç¨¿ç¶æå¯ä¸åï¼ä¸ååçæç产工åå¹¶èªå¨ç¡®è®¤ | |
| | | | åå¹¶ä¸å | è³å°éæ© 2 æ¡ï¼å¿
é¡»ç¸å产åï¼å¿
须齿¯èç¨¿ç¶æ | |
| | | | åæ¶ MPS | ä»
å·²ä¸åç¶æå¯åæ¶ | |
| | | | 宿 MPS | ç±ç产工å宿æ¶èªå¨è§¦å | |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | 1. **éå®è®¢åå®¡æ¹æµç¨**ï¼éå®è®¢åå®¡æ ¸éè¿åä¼èªå¨å建 MPSï¼æ éå端æå¨è§¦å |
| | | 2. **MPS ä¸éå®è®¢åå
³è**ï¼éè¿ saleOrderItemId åæ®µå
³èï¼å¯è¿½æº¯æ¥æº |
| | | 3. **åå¹¶ä¸åéå¶**ï¼åªè½åå¹¶ç¸å产åç MPSï¼ä¸å产åä¸è½åå¹¶ |
| | | 4. **ç¶æä¸å¯é**ï¼ä¸ååæ æ³åå°èç¨¿ç¶æï¼åªè½åæ¶æå®æ |
| | | 5. **ç产è¿åº¦åæ¥**ï¼MPS çå·²ç产æ°éç±çäº§å·¥åæ¥å·¥æ¶èªå¨æ´æ° |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ============================================= |
| | | -- MES ç产主计åï¼MPSï¼è¡¨ |
| | | -- ============================================= |
| | | CREATE TABLE IF NOT EXISTS `mes_pro_mps` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `code` varchar(64) NOT NULL COMMENT 'MPS ç¼ç ', |
| | | `status` tinyint NOT NULL DEFAULT 0 COMMENT 'ç¶æï¼0=è稿 1=å·²ä¸å 2=已宿 3=已忶ï¼', |
| | | |
| | | -- æ¥æºä¿¡æ¯ï¼æ¥èªéå®è®¢åï¼ |
| | | `sale_order_id` bigint DEFAULT NULL COMMENT 'éå®è®¢åID', |
| | | `sale_order_no` varchar(64) DEFAULT NULL COMMENT 'éå®è®¢åå·', |
| | | `sale_order_item_id` bigint DEFAULT NULL COMMENT 'éå®è®¢åæç»ID', |
| | | |
| | | -- 产åä¿¡æ¯ |
| | | `product_id` bigint NOT NULL COMMENT '产åç¼å·', |
| | | `quantity` decimal(24,6) NOT NULL COMMENT '计åç产æ°é', |
| | | `quantity_produced` decimal(24,6) DEFAULT 0 COMMENT 'å·²ç产æ°é', |
| | | `unit_measure_id` bigint DEFAULT NULL COMMENT '计éåä½ID', |
| | | |
| | | -- 客æ·ä¿¡æ¯ |
| | | `client_id` bigint DEFAULT NULL COMMENT '客æ·ç¼å·', |
| | | |
| | | -- æ¶é´ä¿¡æ¯ |
| | | `request_date` datetime DEFAULT NULL COMMENT 'éæ±æ¥æ', |
| | | `issue_date` datetime DEFAULT NULL COMMENT 'ä¸åæ¥æ', |
| | | `finish_date` datetime DEFAULT NULL COMMENT 'å®ææ¥æ', |
| | | |
| | | -- ç产工åå
³èï¼ä¸ååçæï¼ |
| | | `work_order_id` bigint DEFAULT NULL COMMENT 'ç产工åID', |
| | | `work_order_code` varchar(64) DEFAULT NULL COMMENT 'ç产工åç¼ç ', |
| | | |
| | | -- åå¹¶ä¸åæ è¯ |
| | | `merge_flag` tinyint DEFAULT 0 COMMENT 'æ¯å¦åå¹¶ä¸åï¼0=å¦ 1=æ¯ï¼', |
| | | `merge_batch_no` varchar(64) DEFAULT NULL COMMENT 'åå¹¶æ¹æ¬¡å·', |
| | | |
| | | -- å
¶ä» |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`), |
| | | KEY `idx_sale_order_item_id` (`sale_order_item_id`), |
| | | KEY `idx_product_id` (`product_id`), |
| | | KEY `idx_status` (`status`), |
| | | KEY `idx_merge_batch_no` (`merge_batch_no`) |
| | | ) ENGINE=InnoDB COMMENT='MES ç产主计å'; |
| | | |
| | | -- ============================================= |
| | | -- MPS åå¹¶ä¸åæç»è¡¨ |
| | | -- ============================================= |
| | | CREATE TABLE IF NOT EXISTS `mes_pro_mps_merge_item` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `merge_batch_no` varchar(64) NOT NULL COMMENT 'åå¹¶æ¹æ¬¡å·', |
| | | `mps_id` bigint NOT NULL COMMENT 'MPS ç¼å·', |
| | | `work_order_id` bigint DEFAULT NULL COMMENT 'çæçç产工åID', |
| | | `quantity` decimal(24,6) NOT NULL COMMENT 'åé
æ°é', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`), |
| | | KEY `idx_merge_batch_no` (`merge_batch_no`), |
| | | KEY `idx_mps_id` (`mps_id`) |
| | | ) ENGINE=InnoDB COMMENT='MPS åå¹¶ä¸åæç»'; |
| | | |
| | | -- ============================================= |
| | | -- éå®è®¢åæç»è¡¨æ©å±å段 |
| | | -- ============================================= |
| | | ALTER TABLE `erp_sale_order_items` |
| | | ADD COLUMN `need_production` tinyint DEFAULT 0 COMMENT 'æ¯å¦éè¦ç产ï¼0=å¦ 1=æ¯ï¼' AFTER `out_count`, |
| | | ADD COLUMN `mps_id` bigint DEFAULT NULL COMMENT 'å
³èçMPSç¼å·' AFTER `need_production`; |
| | | |
| | | -- ============================================= |
| | | -- åå
¸ç±»å - MPS ç¶æ |
| | | -- ============================================= |
| | | INSERT INTO `system_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('MPS ç¶æ', 'mes_pro_mps_status', 0, 'MPS ç¶æ', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ============================================= |
| | | -- åå
¸æ°æ® - MPS ç¶æ |
| | | -- ============================================= |
| | | INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | (0, 'è稿', '0', 'mes_pro_mps_status', 0, 'info', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1, 'å·²ä¸å', '1', 'mes_pro_mps_status', 0, 'success', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (2, '已宿', '2', 'mes_pro_mps_status', 0, 'primary', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (3, '已忶', '3', 'mes_pro_mps_status', 0, 'danger', '', '', '1', NOW(), '1', NOW(), b'0'); |
| | |
| | | */ |
| | | CrmCustomerRespDTO validateCustomer(Long id); |
| | | |
| | | /** |
| | | * è·åå½åç¨æ·ææéçå®¢æ· ID å表 |
| | | * |
| | | * å
æ¬ï¼ç¨æ·èªå·±å¨å¢éä¸ãç¨æ·çä¸çº§å¨å¢éä¸ãå
¬æµ·æ°æ® |
| | | * |
| | | * @return ææéçå®¢æ· ID å表ï¼null 表示ä¸éå¶ï¼å³è¶
ç®¡ï¼ |
| | | */ |
| | | List<Long> getPermittedCustomerIds(); |
| | | |
| | | } |
| | |
| | | */ |
| | | CrmCustomerRespDTO validateCustomer(Long id); |
| | | |
| | | /** |
| | | * è·åå½åç¨æ·ææéçå®¢æ· ID å表 |
| | | * |
| | | * å
æ¬ï¼ç¨æ·èªå·±å¨å¢éä¸ãç¨æ·çä¸çº§å¨å¢éä¸ãå
¬æµ·æ°æ® |
| | | * |
| | | * @return ææéçå®¢æ· ID å表 |
| | | */ |
| | | List<Long> getPermittedCustomerIds(); |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.crm.api.customer; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| | | import cn.iocoder.yudao.module.crm.util.CrmPermissionUtils; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.anyMatch; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | /** |
| | | * CRM å®¢æ· API å®ç°ç±» |
| | |
| | | |
| | | @Resource |
| | | private CrmCustomerService customerService; |
| | | @Resource |
| | | private CrmPermissionService permissionService; |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @Override |
| | | public CrmCustomerRespDTO getCustomer(Long id) { |
| | |
| | | |
| | | @Override |
| | | public List<CrmCustomerRespDTO> getCustomerList(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<CrmCustomerDO> customers = customerService.getCustomerList(ids); |
| | | return BeanUtils.toBean(customers, CrmCustomerRespDTO.class); |
| | | // è¿æ»¤æç¨æ·æ²¡ææéçå®¢æ· |
| | | List<CrmCustomerDO> filteredCustomers = filterCustomersByPermission(customers); |
| | | return BeanUtils.toBean(filteredCustomers, CrmCustomerRespDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, CrmCustomerRespDTO> getCustomerMap(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | List<CrmCustomerDO> customers = customerService.getCustomerList(ids); |
| | | return customers.stream() |
| | | .collect(java.util.stream.Collectors.toMap( |
| | | // è¿æ»¤æç¨æ·æ²¡ææéçå®¢æ· |
| | | List<CrmCustomerDO> filteredCustomers = filterCustomersByPermission(customers); |
| | | return filteredCustomers.stream() |
| | | .collect(Collectors.toMap( |
| | | CrmCustomerDO::getId, |
| | | customer -> BeanUtils.toBean(customer, CrmCustomerRespDTO.class))); |
| | | } |
| | |
| | | return getCustomer(id); |
| | | } |
| | | |
| | | } |
| | | @Override |
| | | public List<Long> getPermittedCustomerIds() { |
| | | // 1. è¶
级管çåææææé |
| | | if (CrmPermissionUtils.isCrmAdmin()) { |
| | | return null; // null 表示ä¸éå¶ |
| | | } |
| | | |
| | | Long userId = WebFrameworkUtils.getLoginUserId(); |
| | | if (userId == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | // 2. è·åç¨æ·èªå·±ææéçå®¢æ· ID |
| | | List<CrmPermissionDO> userPermissions = permissionService.getPermissionListByBizTypeAndUserId( |
| | | CrmBizTypeEnum.CRM_CUSTOMER.getType(), userId); |
| | | Set<Long> permittedIds = new HashSet<>(convertSet(userPermissions, CrmPermissionDO::getBizId)); |
| | | |
| | | // 3. è·åç¨æ·çä¸çº§ç¨æ·ææéçå®¢æ· ID |
| | | List<AdminUserRespDTO> subordinates = adminUserApi.getUserListBySubordinate(userId); |
| | | if (CollUtil.isNotEmpty(subordinates)) { |
| | | Set<Long> subordinateUserIds = convertSet(subordinates, AdminUserRespDTO::getId); |
| | | for (Long subordinateId : subordinateUserIds) { |
| | | List<CrmPermissionDO> subordinatePermissions = permissionService.getPermissionListByBizTypeAndUserId( |
| | | CrmBizTypeEnum.CRM_CUSTOMER.getType(), subordinateId); |
| | | permittedIds.addAll(convertSet(subordinatePermissions, CrmPermissionDO::getBizId)); |
| | | } |
| | | } |
| | | |
| | | // 4. æ¥è¯¢ææå®¢æ·ï¼æ¾åºå
¬æµ·æ°æ®ï¼æ²¡æå¢éæåç客æ·ï¼ |
| | | // å
¬æµ·æ°æ®ææäººé½æè¯»æé |
| | | List<CrmCustomerDO> allCustomers = customerService.getCustomerList(); |
| | | Set<Long> allCustomerIds = convertSet(allCustomers, CrmCustomerDO::getId); |
| | | |
| | | // è·åææéé
ç½®çå®¢æ· |
| | | List<CrmPermissionDO> allPermissions = permissionService.getPermissionListByBiz( |
| | | CrmBizTypeEnum.CRM_CUSTOMER.getType(), allCustomerIds); |
| | | Set<Long> hasTeamCustomerIds = convertSet(allPermissions, CrmPermissionDO::getBizId); |
| | | |
| | | // å
¬æµ·æ°æ® = ææå®¢æ· - æå¢éçå®¢æ· |
| | | Set<Long> publicSeaCustomerIds = new HashSet<>(allCustomerIds); |
| | | publicSeaCustomerIds.removeAll(hasTeamCustomerIds); |
| | | |
| | | // åå¹¶ï¼ææéçå®¢æ· + å
¬æµ·å®¢æ· |
| | | permittedIds.addAll(publicSeaCustomerIds); |
| | | |
| | | return new ArrayList<>(permittedIds); |
| | | } |
| | | |
| | | /** |
| | | * è¿æ»¤æç¨æ·æ²¡ææéçå®¢æ· |
| | | * <p> |
| | | * æé夿é»è¾ï¼ |
| | | * 1. è¶
级管çåææææé |
| | | * 2. å
¬æµ·æ°æ®ï¼æ²¡æå¢éæåï¼ææäººé½æè¯»æé |
| | | * 3. ç¨æ·èªå·±å¨å¢éæåä¸ |
| | | * 4. ç¨æ·çä¸çº§å¨å¢éæåä¸ |
| | | * |
| | | * @param customers 客æ·å表 |
| | | * @return è¿æ»¤åç客æ·å表 |
| | | */ |
| | | private List<CrmCustomerDO> filterCustomersByPermission(List<CrmCustomerDO> customers) { |
| | | if (CollUtil.isEmpty(customers)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. è¶
级管çåææææé |
| | | if (CrmPermissionUtils.isCrmAdmin()) { |
| | | return customers; |
| | | } |
| | | |
| | | Long userId = WebFrameworkUtils.getLoginUserId(); |
| | | if (userId == null) { |
| | | // 没æç»å½ç¨æ·ï¼è¿å空å表 |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | // 2. è·åè¿äºå®¢æ·çæéé
ç½® |
| | | Set<Long> customerIds = convertSet(customers, CrmCustomerDO::getId); |
| | | List<CrmPermissionDO> permissionList = permissionService.getPermissionListByBiz( |
| | | CrmBizTypeEnum.CRM_CUSTOMER.getType(), customerIds); |
| | | Map<Long, List<CrmPermissionDO>> permissionMap = permissionList.stream() |
| | | .collect(Collectors.groupingBy(CrmPermissionDO::getBizId)); |
| | | |
| | | // 3. è·åç¨æ·çä¸çº§ç¨æ· |
| | | List<AdminUserRespDTO> subordinates = adminUserApi.getUserListBySubordinate(userId); |
| | | Set<Long> subordinateUserIds = convertSet(subordinates, AdminUserRespDTO::getId); |
| | | |
| | | // 4. è¿æ»¤ææéçå®¢æ· |
| | | return customers.stream() |
| | | .filter(customer -> hasCustomerPermission(customer.getId(), permissionMap, userId, subordinateUserIds)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * å¤æç¨æ·æ¯å¦æå®¢æ·æé |
| | | */ |
| | | private boolean hasCustomerPermission(Long customerId, |
| | | Map<Long, List<CrmPermissionDO>> permissionMap, |
| | | Long userId, |
| | | Set<Long> subordinateUserIds) { |
| | | List<CrmPermissionDO> permissions = permissionMap.get(customerId); |
| | | |
| | | // å
¬æµ·æ°æ®ï¼æ²¡æå¢éæåï¼ï¼ææäººé½æè¯»æé |
| | | if (CollUtil.isEmpty(permissions)) { |
| | | return true; |
| | | } |
| | | |
| | | // 没æè´è´£äººçæ
åµï¼ææäººé½æè¯»æé |
| | | if (!anyMatch(permissions, item -> item.getLevel() == 1)) { // 1 = è´è´£äºº |
| | | return true; |
| | | } |
| | | |
| | | // æ£æ¥ç¨æ·èªå·±å¨å¢éæåä¸ |
| | | if (anyMatch(permissions, item -> item.getUserId().equals(userId))) { |
| | | return true; |
| | | } |
| | | |
| | | // æ£æ¥ç¨æ·çä¸çº§å¨å¢éæåä¸ |
| | | for (Long subordinateId : subordinateUserIds) { |
| | | if (anyMatch(permissions, item -> item.getUserId().equals(subordinateId))) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.contract; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | |
| | | } |
| | | |
| | | default PageResult<CrmContractDO> selectPage(CrmContractPageReqVO pageReqVO, Long userId, CrmContractConfigDO config) { |
| | | return selectPage(pageReqVO, userId, config, null); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | * |
| | | * @param pageReqVO æ¥è¯¢æ¡ä»¶ |
| | | * @param userId ç¨æ·ID |
| | | * @param config ååé
ç½® |
| | | * @param permittedCustomerIds ææéç客æ·IDå表ï¼null表示ä¸éå¶ï¼ |
| | | */ |
| | | default PageResult<CrmContractDO> selectPage(CrmContractPageReqVO pageReqVO, Long userId, CrmContractConfigDO config, List<Long> permittedCustomerIds) { |
| | | MPJLambdaWrapperX<CrmContractDO> query = new MPJLambdaWrapperX<>(); |
| | | // æ¼æ¥æ°æ®æéçæ¥è¯¢æ¡ä»¶ |
| | | CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_CONTRACT.getType(), |
| | |
| | | .eqIfPresent(CrmContractDO::getAuditStatus, pageReqVO.getAuditStatus()) |
| | | .orderByDesc(CrmContractDO::getId); |
| | | |
| | | // å®¢æ·æéè¿æ»¤ |
| | | if (permittedCustomerIds != null) { |
| | | if (CollUtil.isEmpty(permittedCustomerIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | query.in(CrmContractDO::getCustomerId, permittedCustomerIds); |
| | | } |
| | | |
| | | // Backlog: å³å°å°æçåå |
| | | LocalDateTime beginOfToday = LocalDateTimeUtil.beginOfDay(LocalDateTime.now()); |
| | | LocalDateTime endOfToday = LocalDateTimeUtil.endOfDay(LocalDateTime.now()); |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.quotation; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | |
| | | } |
| | | |
| | | default PageResult<CrmSaleQuotationDO> selectPage(CrmSaleQuotationPageReqVO pageReqVO, Long userId) { |
| | | return selectPage(pageReqVO, userId, null); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | * |
| | | * @param pageReqVO æ¥è¯¢æ¡ä»¶ |
| | | * @param userId ç¨æ·ID |
| | | * @param permittedCustomerIds ææéç客æ·IDå表ï¼null表示ä¸éå¶ï¼ |
| | | */ |
| | | default PageResult<CrmSaleQuotationDO> selectPage(CrmSaleQuotationPageReqVO pageReqVO, Long userId, List<Long> permittedCustomerIds) { |
| | | MPJLambdaWrapperX<CrmSaleQuotationDO> query = new MPJLambdaWrapperX<>(); |
| | | // æ¼æ¥æ°æ®æéçæ¥è¯¢æ¡ä»¶ |
| | | CrmPermissionUtils.appendPermissionCondition(query, CrmBizTypeEnum.CRM_SALE_QUOTATION.getType(), |
| | |
| | | .eqIfPresent(CrmSaleQuotationDO::getBusinessId, pageReqVO.getBusinessId()) |
| | | .eqIfPresent(CrmSaleQuotationDO::getStatus, pageReqVO.getStatus()) |
| | | .orderByDesc(CrmSaleQuotationDO::getId); |
| | | |
| | | // å®¢æ·æéè¿æ»¤ |
| | | if (permittedCustomerIds != null) { |
| | | if (CollUtil.isEmpty(permittedCustomerIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | query.in(CrmSaleQuotationDO::getCustomerId, permittedCustomerIds); |
| | | } |
| | | |
| | | return selectJoinPage(pageReqVO, CrmSaleQuotationDO.class, query); |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; |
| | | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| | | import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| | |
| | | private CrmPermissionService crmPermissionService; |
| | | @Resource |
| | | private CrmCustomerService customerService; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private CrmBusinessService businessService; |
| | | @Resource |
| | |
| | | return PageResult.empty(); |
| | | } |
| | | } |
| | | // 2. æ¥è¯¢å页 |
| | | return contractMapper.selectPage(pageReqVO, userId, config); |
| | | // 2. è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | List<Long> permittedCustomerIds = customerApi.getPermittedCustomerIds(); |
| | | // 3. æ¥è¯¢å页 |
| | | return contractMapper.selectPage(pageReqVO, userId, config, permittedCustomerIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<CrmCustomerDO> getCustomerList(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾ææå®¢æ·å表 |
| | | * |
| | | * @return 客æ·å表 |
| | | */ |
| | | List<CrmCustomerDO> getCustomerList(); |
| | | |
| | | /** |
| | | * è·å¾å®¢æ· Map |
| | | * |
| | | * @param ids 客æ·ç¼å·æ°ç» |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CrmCustomerDO> getCustomerList() { |
| | | return customerMapper.selectList(); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO, Long userId) { |
| | | return customerMapper.selectPage(pageReqVO, userId); |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| | | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | |
| | | |
| | | @Resource |
| | | private CrmCustomerService customerService; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private CrmBusinessService businessService; |
| | | @Resource |
| | |
| | | |
| | | @Override |
| | | public PageResult<CrmSaleQuotationDO> getSaleQuotationPage(CrmSaleQuotationPageReqVO pageReqVO, Long userId) { |
| | | return saleQuotationMapper.selectPage(pageReqVO, userId); |
| | | // è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | List<Long> permittedCustomerIds = customerApi.getPermittedCustomerIds(); |
| | | return saleQuotationMapper.selectPage(pageReqVO, userId, permittedCustomerIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import cn.iocoder.yudao.module.erp.service.sale.ErpSaleOrderService; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.mes.api.salesnotice.MesWmSalesNoticeApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | private MdmItemApi mdmItemApi; |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private MesWmSalesNoticeApi salesNoticeApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建éå®è®¢å") |
| | |
| | | // 1.4 管çåä¿¡æ¯ |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| | | convertSet(pageResult.getList(), saleOrder -> Long.parseLong(saleOrder.getCreator()))); |
| | | // 1.5 åè´§éç¥åä¿¡æ¯ |
| | | Map<Long, Boolean> salesNoticeMap = salesNoticeApi.checkSalesNoticeBySaleOrderIds( |
| | | convertSet(pageResult.getList(), ErpSaleOrderDO::getId)); |
| | | // 2. å¼å§æ¼æ¥ |
| | | return BeanUtils.toBean(pageResult, ErpSaleOrderRespVO.class, saleOrder -> { |
| | | saleOrder.setItems(BeanUtils.toBean(saleOrderItemMap.get(saleOrder.getId()), ErpSaleOrderRespVO.Item.class, |
| | |
| | | saleOrder.setProductNames(CollUtil.join(saleOrder.getItems(), "ï¼", ErpSaleOrderRespVO.Item::getProductName)); |
| | | MapUtils.findAndThen(customerMap, saleOrder.getCustomerId(), supplier -> saleOrder.setCustomerName(supplier.getName())); |
| | | MapUtils.findAndThen(userMap, Long.parseLong(saleOrder.getCreator()), user -> saleOrder.setCreatorName(user.getNickname())); |
| | | // 设置æ¯å¦å·²çæåè´§éç¥å |
| | | saleOrder.setHasSalesNotice(salesNoticeMap.getOrDefault(saleOrder.getId(), false)); |
| | | }); |
| | | } |
| | | |
| | |
| | | @Schema(description = "åºåºç¶æ", example = "0") |
| | | private Integer outStatus; |
| | | |
| | | // ========== åè´§éç¥ ========== |
| | | |
| | | @Schema(description = "æ¯å¦å·²çæåè´§éç¥å", example = "false") |
| | | private Boolean hasSalesNotice; |
| | | |
| | | @Data |
| | | public static class Item { |
| | | |
| | |
| | | @Schema(description = "éå®åºåºæ°é", example = "100.00") |
| | | private BigDecimal outCount; |
| | | |
| | | // ========== ç产å
³è ========== |
| | | |
| | | @Schema(description = "æ¯å¦éè¦ç产ï¼0=å¦ 1=æ¯ï¼", example = "1") |
| | | private Integer needProduction; |
| | | |
| | | @Schema(description = "å
³èç MPS ç¼å·", example = "1024") |
| | | private Long mpsId; |
| | | |
| | | // ========== å
³èåæ®µ ========== |
| | | |
| | | @Schema(description = "产ååç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "å·§å
å") |
| | |
| | | @Schema(description = "ç¨çï¼ç¾åæ¯", example = "99.88") |
| | | private BigDecimal taxPercent; |
| | | |
| | | @Schema(description = "æ¯å¦éè¦ç产ï¼0=å¦ 1=æ¯ï¼", example = "1") |
| | | private Integer needProduction; |
| | | |
| | | @Schema(description = "夿³¨", example = "é便") |
| | | private String remark; |
| | | |
| | |
| | | */ |
| | | private BigDecimal outCount; |
| | | |
| | | // ========== ç产å
³è ========== |
| | | |
| | | /** |
| | | * æ¯å¦éè¦ç产ï¼0=å¦ 1=æ¯ï¼ |
| | | */ |
| | | private Integer needProduction; |
| | | |
| | | /** |
| | | * å
³èç MPS ç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsDO#getId()} |
| | | */ |
| | | private Long mpsId; |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.erp.dal.mysql.sale; |
| | | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; |
| | |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ERP éå®è®¢å Mapper |
| | |
| | | return selectJoinPage(reqVO, ErpSaleOrderDO.class, query); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<ErpSaleOrderDO> selectPage(ErpSaleOrderPageReqVO reqVO, List<Long> permittedCustomerIds) { |
| | | MPJLambdaWrapperX<ErpSaleOrderDO> query = new MPJLambdaWrapperX<ErpSaleOrderDO>() |
| | | .likeIfPresent(ErpSaleOrderDO::getNo, reqVO.getNo()) |
| | | .eqIfPresent(ErpSaleOrderDO::getCustomerId, reqVO.getCustomerId()) |
| | | .betweenIfPresent(ErpSaleOrderDO::getOrderTime, reqVO.getOrderTime()) |
| | | .eqIfPresent(ErpSaleOrderDO::getStatus, reqVO.getStatus()) |
| | | .likeIfPresent(ErpSaleOrderDO::getRemark, reqVO.getRemark()) |
| | | .eqIfPresent(ErpSaleOrderDO::getCreator, reqVO.getCreator()) |
| | | .orderByDesc(ErpSaleOrderDO::getId); |
| | | // å®¢æ·æéè¿æ»¤ |
| | | if (permittedCustomerIds != null) { |
| | | if (CollUtil.isEmpty(permittedCustomerIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | query.in(ErpSaleOrderDO::getCustomerId, permittedCustomerIds); |
| | | } |
| | | if (reqVO.getProductId() != null) { |
| | | query.leftJoin(ErpSaleOrderItemDO.class, ErpSaleOrderItemDO::getOrderId, ErpSaleOrderDO::getId) |
| | | .eq(reqVO.getProductId() != null, ErpSaleOrderItemDO::getProductId, reqVO.getProductId()) |
| | | .groupBy(ErpSaleOrderDO::getId); // é¿å
1 坹夿¥è¯¢ï¼äº§çç¸åç 1 |
| | | } |
| | | return selectJoinPage(reqVO, ErpSaleOrderDO.class, query); |
| | | } |
| | | |
| | | default int updateByIdAndStatus(Long id, Integer status, ErpSaleOrderDO updateObj) { |
| | | return update(updateObj, new LambdaUpdateWrapper<ErpSaleOrderDO>() |
| | | .eq(ErpSaleOrderDO::getId, id).eq(ErpSaleOrderDO::getStatus, status)); |
| | |
| | | |
| | | @Override |
| | | public PageResult<ErpSaleOrderDO> getSaleOrderPage(ErpSaleOrderPageReqVO pageReqVO) { |
| | | return saleOrderMapper.selectPage(pageReqVO); |
| | | List<Long> permittedCustomerIds = customerApi.getPermittedCustomerIds(); |
| | | return saleOrderMapper.selectPage(pageReqVO, permittedCustomerIds); |
| | | } |
| | | |
| | | // ==================== 订å项 ==================== |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.service.sale.listener; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOrderDO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.sale.ErpSaleOrderItemDO; |
| | | import cn.iocoder.yudao.module.erp.dal.mysql.sale.ErpSaleOrderItemMapper; |
| | | import cn.iocoder.yudao.module.erp.dal.mysql.sale.ErpSaleOrderMapper; |
| | | import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.mes.api.mps.MesProMpsApi; |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsCreateReqDTO; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * éå®è®¢å审æ¹ç¶æçå¬å¨ |
| | | * |
| | | * çå¬ BPM æµç¨å®ä¾ç¶æåæ´äºä»¶ï¼å®¡æ ¸éè¿æ¶èªå¨å建 MPS |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class ErpSaleOrderStatusListener extends cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener { |
| | | |
| | | /** |
| | | * éå®è®¢åå®¡æ¹æµç¨å®ä¹ Key |
| | | */ |
| | | private static final String PROCESS_DEFINITION_KEY = "sale_order_approve"; |
| | | |
| | | @Resource |
| | | private ErpSaleOrderMapper saleOrderMapper; |
| | | @Resource |
| | | private ErpSaleOrderItemMapper saleOrderItemMapper; |
| | | @Resource |
| | | private MesProMpsApi mpsApi; |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | | |
| | | @Override |
| | | protected String getProcessDefinitionKey() { |
| | | return PROCESS_DEFINITION_KEY; |
| | | } |
| | | |
| | | @Override |
| | | protected void onEvent(BpmProcessInstanceStatusEvent event) { |
| | | Long orderId; |
| | | try { |
| | | orderId = Long.parseLong(event.getBusinessKey()); |
| | | } catch (NumberFormatException e) { |
| | | log.warn("[onEvent] businessKey({}) 䏿¯ææçéå®è®¢åç¼å·", event.getBusinessKey()); |
| | | return; |
| | | } |
| | | |
| | | log.info("[onEvent] æ¶å° BPM 审æ¹äºä»¶ï¼orderId={}, status={}", orderId, event.getStatus()); |
| | | |
| | | // åªæå®¡æ¹éè¿æå建 MPS |
| | | if (!BpmTaskStatusEnum.APPROVE.getStatus().equals(event.getStatus())) { |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | // 1. è·åéå®è®¢å |
| | | ErpSaleOrderDO saleOrder = saleOrderMapper.selectById(orderId); |
| | | if (saleOrder == null) { |
| | | log.warn("[onEvent] éå®è®¢åä¸åå¨ï¼orderId={}", orderId); |
| | | return; |
| | | } |
| | | |
| | | // 2. è·åéå®è®¢åæç» |
| | | List<ErpSaleOrderItemDO> items = saleOrderItemMapper.selectListByOrderId(orderId); |
| | | if (CollUtil.isEmpty(items)) { |
| | | log.info("[onEvent] éå®è®¢å({}) 没ææç»ï¼æ éå建 MPS", orderId); |
| | | return; |
| | | } |
| | | |
| | | // 3. æ´æ°è®¢åç¶æä¸ºå·²å®¡æ ¸ |
| | | saleOrderMapper.updateById(new ErpSaleOrderDO() |
| | | .setId(orderId) |
| | | .setStatus(ErpAuditStatus.APPROVE.getStatus())); |
| | | |
| | | // 4. éåæç»ï¼ä¸ºéè¦ç产çæç»å建 MPS |
| | | int mpsCount = 0; |
| | | for (ErpSaleOrderItemDO item : items) { |
| | | if (item.getNeedProduction() == null || item.getNeedProduction() != 1) { |
| | | continue; |
| | | } |
| | | try { |
| | | Long mpsId = createMpsForSaleOrderItem(saleOrder, item); |
| | | if (mpsId != null) { |
| | | mpsCount++; |
| | | // æ´æ°éå®è®¢åæç»ç MPS å
³è |
| | | saleOrderItemMapper.updateById(new ErpSaleOrderItemDO() |
| | | .setId(item.getId()) |
| | | .setMpsId(mpsId)); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("[onEvent] å建 MPS 失败ï¼saleOrderItemId={}", item.getId(), e); |
| | | } |
| | | } |
| | | |
| | | log.info("[onEvent] éå®è®¢å({}) 审æ¹å®æï¼å建 MPS {} æ¡", orderId, mpsCount); |
| | | } catch (Exception e) { |
| | | log.error("[onEvent] å¤çéå®è®¢å审æ¹äºä»¶å¤±è´¥ï¼orderId={}", orderId, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 为éå®è®¢åæç»å建 MPS |
| | | * |
| | | * 注æï¼éå®è®¢åæç»ç productId æ¯ MDM ç©æ IDï¼éè¦æ å°å° MES 产å |
| | | */ |
| | | private Long createMpsForSaleOrderItem(ErpSaleOrderDO saleOrder, ErpSaleOrderItemDO item) { |
| | | // è·å MDM ç©æä¿¡æ¯ï¼ç¨äºè·å产ååç§°ï¼ |
| | | String productName = null; |
| | | try { |
| | | MdmItemRespDTO mdmItem = mdmItemApi.getItem(item.getProductId()).getCheckedData(); |
| | | if (mdmItem != null) { |
| | | productName = mdmItem.getName(); |
| | | } |
| | | } catch (Exception e) { |
| | | log.warn("[createMpsForSaleOrderItem] è·å MDM ç©æä¿¡æ¯å¤±è´¥ï¼productId={}", item.getProductId(), e); |
| | | } |
| | | |
| | | MesProMpsCreateReqDTO createReqDTO = new MesProMpsCreateReqDTO(); |
| | | createReqDTO.setSaleOrderId(saleOrder.getId()); |
| | | createReqDTO.setSaleOrderNo(saleOrder.getNo()); |
| | | createReqDTO.setSaleOrderItemId(item.getId()); |
| | | createReqDTO.setMdmItemId(item.getProductId()); // éå®è®¢åæç»ç productId æ¯ MDM ç©æ ID |
| | | createReqDTO.setProductName(productName); // 产ååç§°ç¨äºé误æç¤º |
| | | createReqDTO.setQuantity(item.getCount()); |
| | | createReqDTO.setClientId(saleOrder.getCustomerId()); |
| | | createReqDTO.setRequestDate(formatRequestDate(saleOrder.getOrderTime())); |
| | | createReqDTO.setRemark("èªå¨çæï¼æ¥èªéå®è®¢åï¼" + saleOrder.getNo()); |
| | | |
| | | Long mpsId = mpsApi.createMps(createReqDTO); |
| | | log.info("[createMpsForSaleOrderItem] MPS å建æåï¼mpsId={}, saleOrderItemId={}", mpsId, item.getId()); |
| | | return mpsId; |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åéæ±æ¥æ |
| | | */ |
| | | private String formatRequestDate(LocalDateTime dateTime) { |
| | | if (dateTime == null) { |
| | | return null; |
| | | } |
| | | return dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.mps; |
| | | |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsCreateReqDTO; |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsRespDTO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES ç产主计åï¼MPSï¼API æ¥å£ |
| | | * |
| | | * ä¾ ERP 模åè°ç¨ï¼å¨éå®è®¢åå®¡æ ¸éè¿æ¶å建 MPS |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesProMpsApi { |
| | | |
| | | /** |
| | | * å建 MPS |
| | | * |
| | | * @param createReqDTO åå»ºä¿¡æ¯ |
| | | * @return MPS ç¼å· |
| | | */ |
| | | Long createMps(MesProMpsCreateReqDTO createReqDTO); |
| | | |
| | | /** |
| | | * æ ¹æ® ID è·å MPS |
| | | * |
| | | * @param id MPS ç¼å· |
| | | * @return MPS ä¿¡æ¯ |
| | | */ |
| | | MesProMpsRespDTO getMps(Long id); |
| | | |
| | | /** |
| | | * æ ¹æ®éå®è®¢åæç»IDè·å MPS |
| | | * |
| | | * @param saleOrderItemId éå®è®¢åæç»ID |
| | | * @return MPS ä¿¡æ¯ |
| | | */ |
| | | MesProMpsRespDTO getMpsBySaleOrderItemId(Long saleOrderItemId); |
| | | |
| | | /** |
| | | * æ¹éè·å MPS |
| | | * |
| | | * @param saleOrderItemIds éå®è®¢åæç»IDå表 |
| | | * @return MPS å表 |
| | | */ |
| | | List<MesProMpsRespDTO> getMpsListBySaleOrderItemIds(List<Long> saleOrderItemIds); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.mps.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MPS åå»ºè¯·æ± DTO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Schema(description = "RPC æå¡ - MPS å建 Request DTO") |
| | | @Data |
| | | public class MesProMpsCreateReqDTO { |
| | | |
| | | @Schema(description = "éå®è®¢åID", example = "100") |
| | | private Long saleOrderId; |
| | | |
| | | @Schema(description = "éå®è®¢åå·", example = "SO-001") |
| | | private String saleOrderNo; |
| | | |
| | | @Schema(description = "éå®è®¢åæç»ID", example = "200") |
| | | private Long saleOrderItemId; |
| | | |
| | | @Schema(description = "MDM ç©æIDï¼éå®è®¢åæç»ç productIdï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| | | private Long mdmItemId; |
| | | |
| | | @Schema(description = "产ååç§°ï¼ç¨äºé误æç¤ºï¼", example = "çµè·¯æ¿A") |
| | | private String productName; |
| | | |
| | | @Schema(description = "计åç产æ°é", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") |
| | | private BigDecimal quantity; |
| | | |
| | | @Schema(description = "客æ·ID", example = "300") |
| | | private Long clientId; |
| | | |
| | | @Schema(description = "éæ±æ¥æ", example = "2024-01-01") |
| | | private String requestDate; |
| | | |
| | | @Schema(description = "夿³¨", example = "èªå¨çæ") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.mps.dto; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MPS ååº DTO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Schema(description = "RPC æå¡ - MPS Response DTO") |
| | | @Data |
| | | public class MesProMpsRespDTO { |
| | | |
| | | @Schema(description = "MPS ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "MPS ç¼ç ", example = "MPS-001") |
| | | private String code; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "éå®è®¢åID", example = "100") |
| | | private Long saleOrderId; |
| | | |
| | | @Schema(description = "éå®è®¢åå·", example = "SO-001") |
| | | private String saleOrderNo; |
| | | |
| | | @Schema(description = "éå®è®¢åæç»ID", example = "200") |
| | | private Long saleOrderItemId; |
| | | |
| | | @Schema(description = "产åID", example = "100") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "计åç产æ°é", example = "100.00") |
| | | private BigDecimal quantity; |
| | | |
| | | @Schema(description = "å·²ç产æ°é", example = "50.00") |
| | | private BigDecimal quantityProduced; |
| | | |
| | | @Schema(description = "客æ·ID", example = "300") |
| | | private Long clientId; |
| | | |
| | | @Schema(description = "éæ±æ¥æ") |
| | | private LocalDateTime requestDate; |
| | | |
| | | @Schema(description = "ä¸åæ¥æ") |
| | | private LocalDateTime issueDate; |
| | | |
| | | @Schema(description = "å®ææ¥æ") |
| | | private LocalDateTime finishDate; |
| | | |
| | | @Schema(description = "ç产工åID", example = "500") |
| | | private Long workOrderId; |
| | | |
| | | @Schema(description = "ç产工åç¼ç ", example = "WO-001") |
| | | private String workOrderCode; |
| | | |
| | | @Schema(description = "æ¯å¦åå¹¶ä¸å", example = "0") |
| | | private Integer mergeFlag; |
| | | |
| | | @Schema(description = "åå¹¶æ¹æ¬¡å·", example = "MERGE-001") |
| | | private String mergeBatchNo; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.salesnotice; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * MES åè´§éç¥å API æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesWmSalesNoticeApi { |
| | | |
| | | /** |
| | | * æ ¹æ®éå®è®¢å ID åè¡¨æ£æ¥æ¯å¦å·²çæåè´§éç¥å |
| | | * |
| | | * @param saleOrderIds éå®è®¢å ID å表 |
| | | * @return Map<éå®è®¢åID, æ¯å¦å·²çæåè´§éç¥å> |
| | | */ |
| | | Map<Long, Boolean> checkSalesNoticeBySaleOrderIds(Collection<Long> saleOrderIds); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.mps; |
| | | |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsCreateReqDTO; |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsDO; |
| | | import cn.iocoder.yudao.module.mes.service.pro.mps.MesProMpsService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MPS API å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesProMpsApiImpl implements MesProMpsApi { |
| | | |
| | | @Resource |
| | | private MesProMpsService mpsService; |
| | | |
| | | @Override |
| | | public Long createMps(MesProMpsCreateReqDTO createReqDTO) { |
| | | return mpsService.createMps( |
| | | createReqDTO.getSaleOrderId(), |
| | | createReqDTO.getSaleOrderNo(), |
| | | createReqDTO.getSaleOrderItemId(), |
| | | createReqDTO.getMdmItemId(), |
| | | createReqDTO.getProductName(), |
| | | createReqDTO.getQuantity(), |
| | | createReqDTO.getClientId(), |
| | | createReqDTO.getRequestDate(), |
| | | createReqDTO.getRemark() |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public MesProMpsRespDTO getMps(Long id) { |
| | | MesProMpsDO mps = mpsService.getMps(id); |
| | | return BeanUtils.toBean(mps, MesProMpsRespDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public MesProMpsRespDTO getMpsBySaleOrderItemId(Long saleOrderItemId) { |
| | | MesProMpsDO mps = mpsService.getMpsBySaleOrderItemId(saleOrderItemId); |
| | | return BeanUtils.toBean(mps, MesProMpsRespDTO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesProMpsRespDTO> getMpsListBySaleOrderItemIds(List<Long> saleOrderItemIds) { |
| | | if (saleOrderItemIds == null || saleOrderItemIds.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<MesProMpsDO> mpsList = mpsService.getMpsListBySaleOrderItemIds(saleOrderItemIds); |
| | | return BeanUtils.toBean(mpsList, MesProMpsRespDTO.class); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.salesnotice; |
| | | |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.salesnotice.MesWmSalesNoticeMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * MES åè´§éç¥å API å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesWmSalesNoticeApiImpl implements MesWmSalesNoticeApi { |
| | | |
| | | @Resource |
| | | private MesWmSalesNoticeMapper salesNoticeMapper; |
| | | |
| | | @Override |
| | | public Map<Long, Boolean> checkSalesNoticeBySaleOrderIds(Collection<Long> saleOrderIds) { |
| | | if (saleOrderIds == null || saleOrderIds.isEmpty()) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | // æ¥è¯¢å·²åå¨çéå®è®¢å ID |
| | | List<Long> existingSaleOrderIds = salesNoticeMapper.selectExistingSaleOrderIds(saleOrderIds); |
| | | // æå»ºè¿åç»æ |
| | | Map<Long, Boolean> result = new HashMap<>(); |
| | | for (Long saleOrderId : saleOrderIds) { |
| | | result.put(saleOrderId, existingSaleOrderIds.contains(saleOrderId)); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.mps; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.collection.ListUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.mps.MesProMpsService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - MES ç产主计å") |
| | | @RestController |
| | | @RequestMapping("/mes/pro-mps") |
| | | @Validated |
| | | public class MesProMpsController { |
| | | |
| | | @Resource |
| | | private MesProMpsService mpsService; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建ç产主计å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:create')") |
| | | public CommonResult<Long> createMps(@Valid @RequestBody MesProMpsSaveReqVO createReqVO) { |
| | | return success(mpsService.createMps(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°ç产主计å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:update')") |
| | | public CommonResult<Boolean> updateMps(@Valid @RequestBody MesProMpsSaveReqVO updateReqVO) { |
| | | mpsService.updateMps(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤ç产主计å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:delete')") |
| | | public CommonResult<Boolean> deleteMps(@RequestParam("id") Long id) { |
| | | mpsService.deleteMps(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾ç产主计å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:query')") |
| | | public CommonResult<MesProMpsRespVO> getMps(@RequestParam("id") Long id) { |
| | | MesProMpsDO mps = mpsService.getMps(id); |
| | | if (mps == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildMpsRespVOList(ListUtil.of(mps)).get(0)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾ç产主计åå页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:query')") |
| | | public CommonResult<PageResult<MesProMpsRespVO>> getMpsPage(@Valid MesProMpsPageReqVO pageReqVO) { |
| | | PageResult<MesProMpsDO> pageResult = mpsService.getMpsPage(pageReqVO); |
| | | return success(new PageResult<>(buildMpsRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºç产主计å Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportMpsExcel(@Valid MesProMpsPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<MesProMpsDO> list = mpsService.getMpsPage(pageReqVO).getList(); |
| | | List<MesProMpsRespVO> voList = buildMpsRespVOList(list); |
| | | ExcelUtils.write(response, "ç产主计å.xls", "æ°æ®", MesProMpsRespVO.class, voList); |
| | | } |
| | | |
| | | @PostMapping("/issue") |
| | | @Operation(summary = "ä¸åç产主计å") |
| | | @Parameter(name = "id", description = "MPS ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:issue')") |
| | | public CommonResult<Long> issueMps(@RequestParam("id") Long id) { |
| | | return success(mpsService.issueMps(id)); |
| | | } |
| | | |
| | | @PostMapping("/merge-issue") |
| | | @Operation(summary = "åå¹¶ä¸åç产主计å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:merge-issue')") |
| | | public CommonResult<Long> mergeAndIssueMps(@RequestBody List<Long> mpsIds) { |
| | | return success(mpsService.mergeAndIssueMps(mpsIds)); |
| | | } |
| | | |
| | | @PostMapping("/cancel") |
| | | @Operation(summary = "åæ¶ç产主计å") |
| | | @Parameter(name = "id", description = "MPS ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-mps:cancel')") |
| | | public CommonResult<Boolean> cancelMps(@RequestParam("id") Long id) { |
| | | mpsService.cancelMps(id); |
| | | return success(true); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<MesProMpsRespVO> buildMpsRespVOList(List<MesProMpsDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. æ¹éè·åå
³èæ°æ® |
| | | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( |
| | | convertSet(list, MesProMpsDO::getProductId)); |
| | | Map<Long, CrmCustomerRespDTO> clientMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesProMpsDO::getClientId)); |
| | | // 2. æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, MesProMpsRespVO.class, vo -> { |
| | | MapUtils.findAndThen(itemMap, vo.getProductId(), item -> { |
| | | vo.setProductName(item.getName()) |
| | | .setProductCode(item.getCode()) |
| | | .setProductSpecification(item.getSpecification()); |
| | | }); |
| | | MapUtils.findAndThen(clientMap, vo.getClientId(), |
| | | client -> vo.setClientName(client.getName())); |
| | | }); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| | | |
| | | @Schema(description = "管çåå° - MES ç产主计åå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesProMpsPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "MPS ç¼ç ", example = "MPS-001") |
| | | private String code; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "产åç¼å·", example = "100") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "客æ·ç¼å·", example = "300") |
| | | private Long clientId; |
| | | |
| | | @Schema(description = "éå®è®¢åå·", example = "SO-001") |
| | | private String saleOrderNo; |
| | | |
| | | @Schema(description = "ç产工åID", example = "500") |
| | | private Long workOrderId; |
| | | |
| | | @Schema(description = "éæ±æ¥æ") |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| | | private LocalDateTime[] requestDate; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| | | private LocalDateTime[] createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES ç产主计å Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesProMpsRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "MPS ç¼ç ", example = "MPS-001") |
| | | @ExcelProperty("MPS ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | @ExcelProperty(value = "ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PRO_MPS_STATUS) |
| | | private Integer status; |
| | | |
| | | // ========== æ¥æºä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "éå®è®¢åID", example = "100") |
| | | private Long saleOrderId; |
| | | |
| | | @Schema(description = "éå®è®¢åå·", example = "SO-001") |
| | | @ExcelProperty("éå®è®¢åå·") |
| | | private String saleOrderNo; |
| | | |
| | | @Schema(description = "éå®è®¢åæç»ID", example = "200") |
| | | private Long saleOrderItemId; |
| | | |
| | | // ========== 产åä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "产åç¼å·", example = "100") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "P-001") |
| | | @ExcelProperty("产åç¼ç ") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "çµè·¯æ¿ A") |
| | | @ExcelProperty("产ååç§°") |
| | | private String productName; |
| | | |
| | | @Schema(description = "è§æ ¼åå·", example = "100x200mm") |
| | | @ExcelProperty("è§æ ¼åå·") |
| | | private String productSpecification; |
| | | |
| | | @Schema(description = "åä½åç§°", example = "个") |
| | | @ExcelProperty("åä½") |
| | | private String unitMeasureName; |
| | | |
| | | @Schema(description = "计åç产æ°é", example = "100.00") |
| | | @ExcelProperty("计åç产æ°é") |
| | | private BigDecimal quantity; |
| | | |
| | | @Schema(description = "å·²ç产æ°é", example = "50.00") |
| | | @ExcelProperty("å·²ç产æ°é") |
| | | private BigDecimal quantityProduced; |
| | | |
| | | // ========== 客æ·ä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "客æ·ç¼å·", example = "300") |
| | | private Long clientId; |
| | | |
| | | @Schema(description = "客æ·ç¼ç ", example = "C-001") |
| | | @ExcelProperty("客æ·ç¼ç ") |
| | | private String clientCode; |
| | | |
| | | @Schema(description = "客æ·åç§°", example = "å®¢æ· A") |
| | | @ExcelProperty("客æ·åç§°") |
| | | private String clientName; |
| | | |
| | | // ========== æ¶é´ä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "éæ±æ¥æ") |
| | | @ExcelProperty("éæ±æ¥æ") |
| | | private LocalDateTime requestDate; |
| | | |
| | | @Schema(description = "ä¸åæ¥æ") |
| | | @ExcelProperty("ä¸åæ¥æ") |
| | | private LocalDateTime issueDate; |
| | | |
| | | @Schema(description = "å®ææ¥æ") |
| | | @ExcelProperty("å®ææ¥æ") |
| | | private LocalDateTime finishDate; |
| | | |
| | | // ========== ç产工åå
³è ========== |
| | | |
| | | @Schema(description = "ç产工åID", example = "500") |
| | | private Long workOrderId; |
| | | |
| | | @Schema(description = "ç产工åç¼ç ", example = "WO-001") |
| | | @ExcelProperty("ç产工åç¼ç ") |
| | | private String workOrderCode; |
| | | |
| | | // ========== åå¹¶ä¸åæ è¯ ========== |
| | | |
| | | @Schema(description = "æ¯å¦åå¹¶ä¸å", example = "0") |
| | | private Integer mergeFlag; |
| | | |
| | | @Schema(description = "åå¹¶æ¹æ¬¡å·", example = "MERGE-001") |
| | | private String mergeBatchNo; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES çäº§ä¸»è®¡åæ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesProMpsSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "MPS ç¼ç ï¼æ°å¢æ¶ä¸å¡«èªå¨çæï¼", example = "MPS-001") |
| | | private String code; |
| | | |
| | | // ========== æ¥æºä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "éå®è®¢åID", example = "100") |
| | | private Long saleOrderId; |
| | | |
| | | @Schema(description = "éå®è®¢åå·", example = "SO-001") |
| | | private String saleOrderNo; |
| | | |
| | | @Schema(description = "éå®è®¢åæç»ID", example = "200") |
| | | private Long saleOrderItemId; |
| | | |
| | | // ========== 产åä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "产åç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| | | @NotNull(message = "产åä¸è½ä¸ºç©º") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "计åç产æ°é", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") |
| | | @NotNull(message = "计åç产æ°éä¸è½ä¸ºç©º") |
| | | private BigDecimal quantity; |
| | | |
| | | @Schema(description = "计éåä½ID", example = "1") |
| | | private Long unitMeasureId; |
| | | |
| | | // ========== 客æ·ä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "客æ·ç¼å·", example = "300") |
| | | private Long clientId; |
| | | |
| | | // ========== æ¶é´ä¿¡æ¯ ========== |
| | | |
| | | @Schema(description = "éæ±æ¥æ") |
| | | private LocalDateTime requestDate; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.task.vo.MesProTaskRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.task.vo.MesProTaskSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.workorder.vo.MesProWorkOrderPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| | |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MesMdUnitMeasureService unitMeasureService; |
| | | @Resource |
| | |
| | | convertSet(list, MesProTaskDO::getItemId)); |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| | | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| | | Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( |
| | | Map<Long, CrmCustomerRespDTO> customerMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesProTaskDO::getClientId)); |
| | | // å·¥åºç checkFlagï¼æ¹éæ¥è¯¢åæå»º routeId -> processId -> checkFlag çåå± Map |
| | | Set<Long> routeIds = convertSet(list, MesProTaskDO::getRouteId); |
| | |
| | | findAndThen(unitMeasureMap, item.getUnitMeasureId(), unit -> |
| | | vo.setUnitMeasureName(unit.getName())); |
| | | }); |
| | | findAndThen(clientMap, task.getClientId(), c -> |
| | | vo.setClientName(c.getName())); |
| | | findAndThen(customerMap, task.getClientId(), customer -> |
| | | vo.setClientName(customer.getName())); |
| | | findAndThen(routeProcessCheckFlagMap, task.getRouteId(), processCheckMap -> |
| | | findAndThen(processCheckMap, task.getProcessId(), vo::setCheckFlag)); |
| | | return vo; |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.workorder.vo.MesProWorkOrderPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.workorder.vo.MesProWorkOrderRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.workorder.vo.MesProWorkOrderSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesMdUnitMeasureService unitMeasureService; |
| | | |
| | |
| | | // 1. æ¹éè·åå
³èæ°æ® |
| | | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( |
| | | convertSet(list, MesProWorkOrderDO::getProductId)); |
| | | Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( |
| | | Map<Long, CrmCustomerRespDTO> customerMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesProWorkOrderDO::getClientId)); |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesProWorkOrderDO::getVendorId)); |
| | | Map<Long, ErpSupplierRespDTO> supplierMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesProWorkOrderDO::getVendorId)).getCheckedData().stream() |
| | | .collect(java.util.stream.Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | // åä½ä»äº§åå
³èç item è·å¾ |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| | | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| | |
| | | MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), |
| | | unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())); |
| | | }); |
| | | MapUtils.findAndThen(clientMap, vo.getClientId(), |
| | | client -> vo.setClientName(client.getName()).setClientCode(client.getCode())); |
| | | MapUtils.findAndThen(vendorMap, vo.getVendorId(), |
| | | vendor -> vo.setVendorName(vendor.getName()).setVendorCode(vendor.getCode())); |
| | | MapUtils.findAndThen(customerMap, vo.getClientId(), |
| | | customer -> vo.setClientName(customer.getName())); |
| | | MapUtils.findAndThen(supplierMap, vo.getVendorId(), |
| | | supplier -> vo.setVendorName(supplier.getName())); |
| | | MapUtils.findAndThen(parentMap, vo.getParentId(), |
| | | parent -> vo.setParentCode(parent.getCode())); |
| | | }); |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.iqc.vo.MesQcIqcSaveReqVO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.iqc.MesQcIqcDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.iqc.MesQcIqcService; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | |
| | | @Resource |
| | | private MesQcIqcService iqcService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | // æ¹éæ¥è¯¢ä¾åºå |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesQcIqcDO::getVendorId)); |
| | | Map<Long, ErpSupplierRespDTO> vendorMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesQcIqcDO::getVendorId)).getCheckedData().stream() |
| | | .collect(java.util.stream.Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | // æ¹éæ¥è¯¢ç©æ |
| | | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( |
| | | convertSet(list, MesQcIqcDO::getItemId)); |
| | |
| | | // æ¼è£
VO |
| | | return BeanUtils.toBean(list, MesQcIqcRespVO.class, vo -> { |
| | | findAndThen(vendorMap, vo.getVendorId(), |
| | | vendor -> vo.setVendorNickname(vendor.getNickname())); |
| | | vendor -> vo.setVendorNickname(vendor.getName())); |
| | | findAndThen(itemMap, vo.getItemId(), item -> { |
| | | vo.setItemCode(item.getCode()); |
| | | vo.setItemName(item.getName()); |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.oqc.vo.MesQcOqcPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.oqc.vo.MesQcOqcRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.oqc.vo.MesQcOqcSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.oqc.MesQcOqcDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.oqc.MesQcOqcService; |
| | |
| | | @Resource |
| | | private MesQcOqcService oqcService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | // æ¹éæ¥è¯¢å®¢æ· |
| | | Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( |
| | | Map<Long, CrmCustomerRespDTO> clientMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesQcOqcDO::getClientId)); |
| | | // æ¹éæ¥è¯¢ç©æ |
| | | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( |
| | |
| | | // æ¼è£
VO |
| | | return BeanUtils.toBean(list, MesQcOqcRespVO.class, vo -> { |
| | | findAndThen(clientMap, vo.getClientId(), |
| | | client -> vo.setClientNickname(client.getNickname())); |
| | | client -> vo.setClientNickname(client.getName())); |
| | | findAndThen(itemMap, vo.getItemId(), item -> { |
| | | vo.setItemCode(item.getCode()).setItemName(item.getName()).setItemSpecification(item.getSpecification()); |
| | | findAndThen(unitMeasureMap, item.getUnitMeasureId(), |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.pendinginspect.vo.MesQcPendingInspectPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.pendinginspect.vo.MesQcPendingInspectRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.pendinginspect.MesQcPendingInspectService; |
| | |
| | | @Resource |
| | | private MesMdUnitMeasureService unitMeasureService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MesMdWorkstationService workstationService; |
| | | @Resource |
| | |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| | | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| | | // æ¹éæ¥è¯¢ä¾åºåï¼IQC åºæ¯ï¼ |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesQcPendingInspectRespVO::getVendorId)); |
| | | Map<Long, ErpSupplierRespDTO> vendorMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesQcPendingInspectRespVO::getVendorId)).getCheckedData().stream() |
| | | .collect(java.util.stream.Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | // æ¹éæ¥è¯¢å®¢æ·ï¼OQC/RQC åºæ¯ï¼ |
| | | Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( |
| | | Map<Long, CrmCustomerRespDTO> clientMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesQcPendingInspectRespVO::getClientId)); |
| | | // æ¹éæ¥è¯¢å·¥ä½ç«ï¼IPQC/RQC åºæ¯ï¼ |
| | | Map<Long, MesMdWorkstationDO> workstationMap = workstationService.getWorkstationMap( |
| | |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.tm.tool.MesTmToolDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.mdm.api.unit.MdmUnitMeasureApi; |
| | | import cn.iocoder.yudao.module.mdm.api.unit.dto.MdmUnitMeasureRespDTO; |
| | | |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | |
| | | @Resource |
| | | private MdmUnitMeasureApi mdmUnitMeasureApi; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MesProWorkOrderService workOrderService; |
| | | @Resource |
| | |
| | | // 1. è·å¾å
³èæ°æ® |
| | | Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap( |
| | | convertSet(list, MesWmBatchDO::getItemId)); |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesWmBatchDO::getVendorId)); |
| | | Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( |
| | | Map<Long, ErpSupplierRespDTO> vendorMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesWmBatchDO::getVendorId)).getCheckedData().stream() |
| | | .collect(Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | Map<Long, CrmCustomerRespDTO> clientMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesWmBatchDO::getClientId)); |
| | | Map<Long, MesProWorkOrderDO> workOrderMap = workOrderService.getWorkOrderMap( |
| | | convertSet(list, MesWmBatchDO::getWorkOrderId)); |
| | |
| | | unitMeasure -> vo.setUnitName(unitMeasure.getName())); |
| | | }); |
| | | MapUtils.findAndThen(vendorMap, vo.getVendorId(), |
| | | vendor -> vo.setVendorCode(vendor.getCode()).setVendorName(vendor.getName())); |
| | | vendor -> vo.setVendorName(vendor.getName())); |
| | | MapUtils.findAndThen(clientMap, vo.getClientId(), |
| | | client -> vo.setClientCode(client.getCode()).setClientName(client.getName())); |
| | | client -> vo.setClientName(client.getName())); |
| | | MapUtils.findAndThen(workOrderMap, vo.getWorkOrderId(), |
| | | workOrder -> vo.setWorkOrderCode(workOrder.getCode())); |
| | | MapUtils.findAndThen(taskMap, vo.getTaskId(), |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockFreezeReqVO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.materialstock.MesWmMaterialStockDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; |
| | |
| | | import cn.iocoder.yudao.module.mdm.api.unit.MdmUnitMeasureApi; |
| | | import cn.iocoder.yudao.module.mdm.api.unit.dto.MdmUnitMeasureRespDTO; |
| | | |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseLocationService; |
| | |
| | | @Resource |
| | | private MesWmWarehouseAreaService areaService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾åºåè®°å½") |
| | |
| | | convertSet(list, MesWmMaterialStockDO::getLocationId)); |
| | | Map<Long, MesWmWarehouseAreaDO> areaMap = areaService.getWarehouseAreaMap( |
| | | convertSet(list, MesWmMaterialStockDO::getAreaId)); |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesWmMaterialStockDO::getVendorId)); |
| | | Map<Long, ErpSupplierRespDTO> vendorMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesWmMaterialStockDO::getVendorId)).getCheckedData().stream() |
| | | .collect(Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | // 2. æå»ºç»æ |
| | | return BeanUtils.toBean(list, MesWmMaterialStockRespVO.class, vo -> { |
| | | MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.MesWmOutsourceIssuePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.MesWmOutsourceIssueRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.MesWmOutsourceIssueSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.outsourceissue.MesWmOutsourceIssueDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.outsourceissue.MesWmOutsourceIssueService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @Resource |
| | | private MesWmOutsourceIssueService outsourceIssueService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesProWorkOrderService workOrderService; |
| | | |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. è·å¾å
³èæ°æ® |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesWmOutsourceIssueDO::getVendorId)); |
| | | Map<Long, ErpSupplierRespDTO> vendorMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesWmOutsourceIssueDO::getVendorId)).getCheckedData().stream() |
| | | .collect(java.util.stream.Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | Map<Long, MesProWorkOrderDO> workOrderMap = workOrderService.getWorkOrderMap( |
| | | convertSet(list, MesWmOutsourceIssueDO::getWorkOrderId)); |
| | | // 2. æå»ºç»æ |
| | | return BeanUtils.toBean(list, MesWmOutsourceIssueRespVO.class, vo -> { |
| | | MapUtils.findAndThen(vendorMap, vo.getVendorId(), vendor -> |
| | | vo.setVendorCode(vendor.getCode()).setVendorName(vendor.getName())); |
| | | vo.setVendorName(vendor.getName())); |
| | | MapUtils.findAndThen(workOrderMap, vo.getWorkOrderId(), workOrder -> |
| | | vo.setWorkOrderCode(workOrder.getCode()).setWorkOrderName(workOrder.getName())); |
| | | }); |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo.MesWmOutsourceReceiptPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo.MesWmOutsourceReceiptRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo.MesWmOutsourceReceiptSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.outsourcereceipt.MesWmOutsourceReceiptDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.outsourcereceipt.MesWmOutsourceReceiptService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @Resource |
| | | private MesWmOutsourceReceiptService outsourceReceiptService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesProWorkOrderService workOrderService; |
| | | |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. è·å¾å
³èæ°æ® |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesWmOutsourceReceiptDO::getVendorId)); |
| | | Map<Long, ErpSupplierRespDTO> vendorMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesWmOutsourceReceiptDO::getVendorId)).getCheckedData().stream() |
| | | .collect(java.util.stream.Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | Map<Long, MesProWorkOrderDO> workOrderMap = workOrderService.getWorkOrderMap( |
| | | convertSet(list, MesWmOutsourceReceiptDO::getWorkOrderId)); |
| | | // 2. æå»ºç»æ |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.packages.vo.MesWmPackagePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.packages.vo.MesWmPackageRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.packages.vo.MesWmPackageSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.packages.MesWmPackageDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | |
| | | import cn.iocoder.yudao.module.mes.service.wm.packages.MesWmPackageService; |
| | | import cn.iocoder.yudao.module.mdm.api.unit.MdmUnitMeasureApi; |
| | |
| | | @Resource |
| | | private MesWmPackageService packageService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MdmUnitMeasureApi mdmUnitMeasureApi; |
| | | |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | // æ¹éæ¥è¯¢å®¢æ· |
| | | Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( |
| | | Map<Long, CrmCustomerRespDTO> clientMap = customerApi.getCustomerMap( |
| | | convertSet(list, MesWmPackageDO::getClientId)); |
| | | // æ¹éæ¥è¯¢è®¡éåä½ï¼å°ºå¯¸ + ééï¼ |
| | | Map<Long, MdmUnitMeasureRespDTO> unitMeasureMap = mdmUnitMeasureApi.getUnitMeasureList( |
| | |
| | | // æå»ºè¿åç»æ |
| | | return BeanUtils.toBean(list, MesWmPackageRespVO.class, vo -> { |
| | | MapUtils.findAndThen(clientMap, vo.getClientId(), |
| | | client -> vo.setClientCode(client.getCode()).setClientName(client.getName()) |
| | | .setClientNickname(client.getNickname())); |
| | | client -> vo.setClientName(client.getName())); |
| | | MapUtils.findAndThen(unitMeasureMap, vo.getSizeUnitId(), |
| | | unit -> vo.setSizeUnitName(unit.getName())); |
| | | MapUtils.findAndThen(unitMeasureMap, vo.getWeightUnitId(), |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.MesWmProductIssuePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.MesWmProductIssueRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.MesWmProductIssueSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productissue.MesWmProductIssueDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | |
| | | @Resource |
| | | private MesProTaskService taskService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºé¢æåºåºå") |
| | |
| | | convertSet(list, MesWmProductIssueDO::getWorkOrderId)); |
| | | Map<Long, MesProTaskDO> taskMap = taskService.getTaskMap( |
| | | convertSet(list, MesWmProductIssueDO::getTaskId)); |
| | | Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( |
| | | Map<Long, CrmCustomerRespDTO> clientMap = customerApi.getCustomerMap( |
| | | convertSet(workOrderMap.values(), MesProWorkOrderDO::getClientId)); |
| | | // 2. æå»ºç»æ |
| | | return BeanUtils.toBean(list, MesWmProductIssueRespVO.class, vo -> { |
| | |
| | | MapUtils.findAndThen(workOrderMap, vo.getWorkOrderId(), workOrder -> { |
| | | vo.setWorkOrderCode(workOrder.getCode()); |
| | | MapUtils.findAndThen(clientMap, workOrder.getClientId(), client -> |
| | | vo.setClientCode(client.getCode()).setClientName(client.getName())); |
| | | vo.setClientName(client.getName())); |
| | | }); |
| | | }); |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.MesWmReturnVendorPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.MesWmReturnVendorRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.MesWmReturnVendorSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnvendor.MesWmReturnVendorDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.returnvendor.MesWmReturnVendorService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | |
| | | @Resource |
| | | private MesWmReturnVendorService returnVendorService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建ä¾åºåéè´§å") |
| | |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. è·å¾å
³èæ°æ® |
| | | Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( |
| | | convertSet(list, MesWmReturnVendorDO::getVendorId)); |
| | | Map<Long, ErpSupplierRespDTO> vendorMap = supplierApi.getSupplierList( |
| | | convertSet(list, MesWmReturnVendorDO::getVendorId)).getCheckedData().stream() |
| | | .collect(java.util.stream.Collectors.toMap(ErpSupplierRespDTO::getId, s -> s)); |
| | | // 2. æå»ºç»æ |
| | | return BeanUtils.toBean(list, MesWmReturnVendorRespVO.class, vo -> |
| | | MapUtils.findAndThen(vendorMap, vo.getVendorId(), vendor -> |
| | | vo.setVendorCode(vendor.getCode()).setVendorName(vendor.getName()).setVendorNickname(vendor.getNickname()))); |
| | | vo.setVendorName(vendor.getName()))); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProMpsStatusEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES ç产主计åï¼MPSï¼DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pro_mps") |
| | | @KeySequence("mes_pro_mps_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesProMpsDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * MPS ç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * ç¶æ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PRO_MPS_STATUS} |
| | | * æä¸¾ {@link MesProMpsStatusEnum} |
| | | */ |
| | | private Integer status; |
| | | |
| | | // ========== æ¥æºä¿¡æ¯ï¼æ¥èªéå®è®¢åï¼ ========== |
| | | |
| | | /** |
| | | * éå®è®¢åID |
| | | */ |
| | | private Long saleOrderId; |
| | | |
| | | /** |
| | | * éå®è®¢åå· |
| | | */ |
| | | private String saleOrderNo; |
| | | |
| | | /** |
| | | * éå®è®¢åæç»ID |
| | | */ |
| | | private Long saleOrderItemId; |
| | | |
| | | // ========== 产åä¿¡æ¯ ========== |
| | | |
| | | /** |
| | | * 产åç¼å· |
| | | * |
| | | * å
³è {@link MesMdItemDO#getId()} |
| | | */ |
| | | private Long productId; |
| | | |
| | | /** |
| | | * 计åç产æ°é |
| | | */ |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * å·²ç产æ°é |
| | | */ |
| | | private BigDecimal quantityProduced; |
| | | |
| | | /** |
| | | * 计éåä½ID |
| | | */ |
| | | private Long unitMeasureId; |
| | | |
| | | // ========== 客æ·ä¿¡æ¯ ========== |
| | | |
| | | /** |
| | | * 客æ·ç¼å· |
| | | * |
| | | * å
³è CRM å®¢æ· {@link cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO#getId()} |
| | | */ |
| | | private Long clientId; |
| | | |
| | | // ========== æ¶é´ä¿¡æ¯ ========== |
| | | |
| | | /** |
| | | * éæ±æ¥æ |
| | | */ |
| | | private LocalDateTime requestDate; |
| | | |
| | | /** |
| | | * ä¸åæ¥æ |
| | | */ |
| | | private LocalDateTime issueDate; |
| | | |
| | | /** |
| | | * å®ææ¥æ |
| | | */ |
| | | private LocalDateTime finishDate; |
| | | |
| | | // ========== ç产工åå
³èï¼ä¸ååçæï¼ ========== |
| | | |
| | | /** |
| | | * ç产工åID |
| | | * |
| | | * å
³è {@link MesProWorkOrderDO#getId()} |
| | | */ |
| | | private Long workOrderId; |
| | | |
| | | /** |
| | | * ç产工åç¼ç |
| | | */ |
| | | private String workOrderCode; |
| | | |
| | | // ========== åå¹¶ä¸åæ è¯ ========== |
| | | |
| | | /** |
| | | * æ¯å¦åå¹¶ä¸åï¼0=å¦ 1=æ¯ï¼ |
| | | */ |
| | | private Integer mergeFlag; |
| | | |
| | | /** |
| | | * åå¹¶æ¹æ¬¡å· |
| | | */ |
| | | private String mergeBatchNo; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MPS åå¹¶ä¸åæç» DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pro_mps_merge_item") |
| | | @KeySequence("mes_pro_mps_merge_item_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesProMpsMergeItemDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * åå¹¶æ¹æ¬¡å· |
| | | */ |
| | | private String mergeBatchNo; |
| | | |
| | | /** |
| | | * MPS ç¼å· |
| | | * |
| | | * å
³è {@link MesProMpsDO#getId()} |
| | | */ |
| | | private Long mpsId; |
| | | |
| | | /** |
| | | * çæçç产工åID |
| | | * |
| | | * å
³è {@link MesProWorkOrderDO#getId()} |
| | | */ |
| | | private Long workOrderId; |
| | | |
| | | /** |
| | | * åé
æ°é |
| | | */ |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.task; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.process.MesProProcessDO; |
| | |
| | | /** |
| | | * 客æ·ç¼å· |
| | | * |
| | | * å
³è {@link MesMdClientDO#getId()} |
| | | * å
³è CRM å®¢æ· {@link cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO#getId()} |
| | | */ |
| | | private Long clientId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderSourceTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderTypeEnum; |
| | |
| | | /** |
| | | * 客æ·ç¼å· |
| | | * |
| | | * å
³è {@link MesMdClientDO#getId()} |
| | | * å
³è CRM å®¢æ· {@link cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO#getId()} |
| | | */ |
| | | private Long clientId; |
| | | /** |
| | | * ä¾åºåç¼å· |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.template.MesQcTemplateDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.arrivalnotice.MesWmArrivalNoticeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.arrivalnotice.MesWmArrivalNoticeLineDO; |
| | |
| | | /** |
| | | * ä¾åºå ID |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.qc.oqc; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.template.MesQcTemplateDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | |
| | | /** |
| | | * å®¢æ· ID |
| | | * |
| | | * å
³è {@link MesMdClientDO#getId()} |
| | | * å
³è CRM å®¢æ· {@link cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO#getId()} |
| | | */ |
| | | private Long clientId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.arrivalnotice; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmArrivalNoticeStatusEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | /** |
| | | * ä¾åºåç¼å· |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | |
| | | /** |
| | | * ä¾åºåID |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | | * 客æ·ID |
| | | * |
| | | * å
³è {@link MesMdClientDO#getId()} |
| | | * å
³è CRM å®¢æ· {@link cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO#getId()} |
| | | */ |
| | | private Long clientId; |
| | | |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemreceipt; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.iqc.MesQcIqcDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.arrivalnotice.MesWmArrivalNoticeDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmItemReceiptStatusEnum; |
| | |
| | | /** |
| | | * ä¾åºåç¼å· |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; |
| | |
| | | /** |
| | | * ä¾åºåç¼å· |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.outsourceissue; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmOutsourceIssueStatusEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | |
| | | /** |
| | | * ä¾åºåID |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.outsourcereceipt; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmOutsourceReceiptStatusEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | /** |
| | | * ä¾åºåç¼å· |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.packages; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | /** |
| | | * å®¢æ· ID |
| | | * |
| | | * å
³è {@link MesMdClientDO#getId()} |
| | | * å
³è CRM å®¢æ· {@link cn.iocoder.yudao.module.crm.api.customer.dto.CrmCustomerRespDTO#getId()} |
| | | */ |
| | | private Long clientId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.salesnotice.MesWmSalesNoticeDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductSalesStatusEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnvendor; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmReturnVendorStatusEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | /** |
| | | * ä¾åºå ID |
| | | * |
| | | * å
³è {@link MesMdVendorDO#getId()} |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| | | */ |
| | | private Long vendorId; |
| | | /** |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.salesnotice; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | return selectCount(MesMdItemDO::getUnitMeasureId, unitMeasureId); |
| | | } |
| | | |
| | | default MesMdItemDO selectByMdmItemId(Long mdmItemId) { |
| | | return selectOne(MesMdItemDO::getMdmItemId, mdmItemId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pro.mps; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsDO; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProMpsStatusEnum; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES ç产主计åï¼MPSï¼Mapper |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Mapper |
| | | public interface MesProMpsMapper extends BaseMapperX<MesProMpsDO> { |
| | | |
| | | default PageResult<MesProMpsDO> selectPage(MesProMpsPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesProMpsDO>() |
| | | .likeIfPresent(MesProMpsDO::getCode, reqVO.getCode()) |
| | | .eqIfPresent(MesProMpsDO::getStatus, reqVO.getStatus()) |
| | | .eqIfPresent(MesProMpsDO::getProductId, reqVO.getProductId()) |
| | | .eqIfPresent(MesProMpsDO::getClientId, reqVO.getClientId()) |
| | | .likeIfPresent(MesProMpsDO::getSaleOrderNo, reqVO.getSaleOrderNo()) |
| | | .eqIfPresent(MesProMpsDO::getWorkOrderId, reqVO.getWorkOrderId()) |
| | | .betweenIfPresent(MesProMpsDO::getRequestDate, reqVO.getRequestDate()) |
| | | .betweenIfPresent(MesProMpsDO::getCreateTime, reqVO.getCreateTime()) |
| | | .orderByDesc(MesProMpsDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<MesProMpsDO> selectPage(MesProMpsPageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesProMpsDO> wrapper = new LambdaQueryWrapperX<MesProMpsDO>() |
| | | .likeIfPresent(MesProMpsDO::getCode, reqVO.getCode()) |
| | | .eqIfPresent(MesProMpsDO::getStatus, reqVO.getStatus()) |
| | | .eqIfPresent(MesProMpsDO::getProductId, reqVO.getProductId()) |
| | | .eqIfPresent(MesProMpsDO::getClientId, reqVO.getClientId()) |
| | | .likeIfPresent(MesProMpsDO::getSaleOrderNo, reqVO.getSaleOrderNo()) |
| | | .eqIfPresent(MesProMpsDO::getWorkOrderId, reqVO.getWorkOrderId()) |
| | | .betweenIfPresent(MesProMpsDO::getRequestDate, reqVO.getRequestDate()) |
| | | .betweenIfPresent(MesProMpsDO::getCreateTime, reqVO.getCreateTime()) |
| | | .orderByDesc(MesProMpsDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesProMpsDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | default MesProMpsDO selectByCode(String code) { |
| | | return selectOne(MesProMpsDO::getCode, code); |
| | | } |
| | | |
| | | default MesProMpsDO selectBySaleOrderItemId(Long saleOrderItemId) { |
| | | return selectOne(MesProMpsDO::getSaleOrderItemId, saleOrderItemId); |
| | | } |
| | | |
| | | default List<MesProMpsDO> selectListBySaleOrderItemIds(Collection<Long> saleOrderItemIds) { |
| | | if (saleOrderItemIds == null || saleOrderItemIds.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return selectList(MesProMpsDO::getSaleOrderItemId, saleOrderItemIds); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¯åå¹¶ç MPS å表ï¼ç¸å产åãèç¨¿ç¶æï¼ |
| | | */ |
| | | default List<MesProMpsDO> selectMergeableList(Long productId) { |
| | | return selectList(new LambdaQueryWrapperX<MesProMpsDO>() |
| | | .eq(MesProMpsDO::getProductId, productId) |
| | | .eq(MesProMpsDO::getStatus, MesProMpsStatusEnum.DRAFT.getStatus()) |
| | | .orderByAsc(MesProMpsDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * æ´æ°å·²ç产æ°é |
| | | */ |
| | | default void updateProducedQuantity(Long id, BigDecimal incrQuantity) { |
| | | update(null, new LambdaUpdateWrapper<MesProMpsDO>() |
| | | .eq(MesProMpsDO::getId, id) |
| | | .setSql("quantity_produced = IFNULL(quantity_produced, 0) + " + incrQuantity)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pro.mps; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsMergeItemDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MPS åå¹¶ä¸åæç» Mapper |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Mapper |
| | | public interface MesProMpsMergeItemMapper extends BaseMapperX<MesProMpsMergeItemDO> { |
| | | |
| | | default List<MesProMpsMergeItemDO> selectListByMergeBatchNo(String mergeBatchNo) { |
| | | return selectList(MesProMpsMergeItemDO::getMergeBatchNo, mergeBatchNo); |
| | | } |
| | | |
| | | default List<MesProMpsMergeItemDO> selectListByMpsId(Long mpsId) { |
| | | return selectList(MesProMpsMergeItemDO::getMpsId, mpsId); |
| | | } |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pro.workorder; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES ç产工å Mapper |
| | |
| | | .orderByDesc(MesProWorkOrderDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<MesProWorkOrderDO> selectPage(MesProWorkOrderPageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesProWorkOrderDO> wrapper = new LambdaQueryWrapperX<MesProWorkOrderDO>() |
| | | .likeIfPresent(MesProWorkOrderDO::getCode, reqVO.getCode()) |
| | | .likeIfPresent(MesProWorkOrderDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesProWorkOrderDO::getType, reqVO.getType()) |
| | | .likeIfPresent(MesProWorkOrderDO::getOrderSourceCode, reqVO.getOrderSourceCode()) |
| | | .eqIfPresent(MesProWorkOrderDO::getProductId, reqVO.getProductId()) |
| | | .eqIfPresent(MesProWorkOrderDO::getClientId, reqVO.getClientId()) |
| | | .eqIfPresent(MesProWorkOrderDO::getStatus, reqVO.getStatus()) |
| | | .betweenIfPresent(MesProWorkOrderDO::getRequestDate, reqVO.getRequestDate()) |
| | | .orderByDesc(MesProWorkOrderDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesProWorkOrderDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | default MesProWorkOrderDO selectByCode(String code) { |
| | | return selectOne(MesProWorkOrderDO::getCode, code); |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.qc.oqc; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.oqc.vo.MesQcOqcPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.oqc.MesQcOqcDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES åºè´§æ£éªåï¼OQCï¼ Mapper |
| | |
| | | .orderByDesc(MesQcOqcDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<MesQcOqcDO> selectPage(MesQcOqcPageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesQcOqcDO> wrapper = new LambdaQueryWrapperX<MesQcOqcDO>() |
| | | .likeIfPresent(MesQcOqcDO::getCode, reqVO.getCode()) |
| | | .eqIfPresent(MesQcOqcDO::getClientId, reqVO.getClientId()) |
| | | .likeIfPresent(MesQcOqcDO::getBatchCode, reqVO.getBatchCode()) |
| | | .eqIfPresent(MesQcOqcDO::getItemId, reqVO.getItemId()) |
| | | .eqIfPresent(MesQcOqcDO::getCheckResult, reqVO.getCheckResult()) |
| | | .orderByDesc(MesQcOqcDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesQcOqcDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | default MesQcOqcDO selectByCode(String code) { |
| | | return selectOne(MesQcOqcDO::getCode, code); |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.wm.batch; |
| | | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<MesWmBatchDO> selectPage(MesWmBatchPageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesWmBatchDO> wrapper = new LambdaQueryWrapperX<MesWmBatchDO>() |
| | | .likeIfPresent(MesWmBatchDO::getCode, reqVO.getCode()) |
| | | .eqIfPresent(MesWmBatchDO::getItemId, reqVO.getItemId()) |
| | | .eqIfPresent(MesWmBatchDO::getVendorId, reqVO.getVendorId()) |
| | | .eqIfPresent(MesWmBatchDO::getClientId, reqVO.getClientId()) |
| | | .likeIfPresent(MesWmBatchDO::getSalesOrderCode, reqVO.getSalesOrderCode()) |
| | | .likeIfPresent(MesWmBatchDO::getPurchaseOrderCode, reqVO.getPurchaseOrderCode()) |
| | | .eqIfPresent(MesWmBatchDO::getWorkOrderId, reqVO.getWorkOrderId()) |
| | | .eqIfPresent(MesWmBatchDO::getTaskId, reqVO.getTaskId()) |
| | | .eqIfPresent(MesWmBatchDO::getWorkstationId, reqVO.getWorkstationId()) |
| | | .eqIfPresent(MesWmBatchDO::getToolId, reqVO.getToolId()) |
| | | .eqIfPresent(MesWmBatchDO::getMoldId, reqVO.getMoldId()) |
| | | .likeIfPresent(MesWmBatchDO::getLotNumber, reqVO.getLotNumber()) |
| | | .eqIfPresent(MesWmBatchDO::getQualityStatus, reqVO.getQualityStatus()) |
| | | .betweenIfPresent(MesWmBatchDO::getProduceDate, reqVO.getProduceDate()) |
| | | .betweenIfPresent(MesWmBatchDO::getExpireDate, reqVO.getExpireDate()) |
| | | .betweenIfPresent(MesWmBatchDO::getReceiptDate, reqVO.getReceiptDate()) |
| | | .orderByDesc(MesWmBatchDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesWmBatchDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åæ°æ¥è¯¢å¹é
çç¬¬ä¸æ¡æ¹æ¬¡è®°å½ |
| | | * <p> |
| | | * ä½¿ç¨ NULL å¼ç²¾ç¡®å¹é
ï¼è¿å ID æå°çæ¹æ¬¡ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.wm.packages; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | |
| | | .orderByDesc(MesWmPackageDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<MesWmPackageDO> selectPage(MesWmPackagePageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesWmPackageDO> wrapper = new LambdaQueryWrapperX<MesWmPackageDO>() |
| | | .likeIfPresent(MesWmPackageDO::getCode, reqVO.getCode()) |
| | | .likeIfPresent(MesWmPackageDO::getSalesOrderCode, reqVO.getSalesOrderCode()) |
| | | .eqIfPresent(MesWmPackageDO::getClientId, reqVO.getClientId()) |
| | | .eqIfPresent(MesWmPackageDO::getParentId, reqVO.getParentId()) |
| | | .eqIfPresent(MesWmPackageDO::getInspectorUserId, reqVO.getInspectorUserId()) |
| | | .eqIfPresent(MesWmPackageDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(MesWmPackageDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesWmPackageDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | default MesWmPackageDO selectByCode(String code) { |
| | | return selectOne(MesWmPackageDO::getCode, code); |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.wm.productsales; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | |
| | | .orderByDesc(MesWmProductSalesDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<MesWmProductSalesDO> selectPage(MesWmProductSalesPageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesWmProductSalesDO> wrapper = new LambdaQueryWrapperX<MesWmProductSalesDO>() |
| | | .likeIfPresent(MesWmProductSalesDO::getCode, reqVO.getCode()) |
| | | .likeIfPresent(MesWmProductSalesDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesWmProductSalesDO::getClientId, reqVO.getClientId()) |
| | | .eqIfPresent(MesWmProductSalesDO::getStatus, reqVO.getStatus()) |
| | | .betweenIfPresent(MesWmProductSalesDO::getSalesDate, reqVO.getShipmentDate()) |
| | | .orderByDesc(MesWmProductSalesDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesWmProductSalesDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | default MesWmProductSalesDO selectByCode(String code) { |
| | | return selectOne(MesWmProductSalesDO::getCode, code); |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.wm.returnsales; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.returnsales.vo.MesWmReturnSalesPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnsales.MesWmReturnSalesDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES éå®éè´§å Mapper |
| | |
| | | .orderByDesc(MesWmReturnSalesDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | */ |
| | | default PageResult<MesWmReturnSalesDO> selectPage(MesWmReturnSalesPageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesWmReturnSalesDO> wrapper = new LambdaQueryWrapperX<MesWmReturnSalesDO>() |
| | | .likeIfPresent(MesWmReturnSalesDO::getCode, reqVO.getCode()) |
| | | .likeIfPresent(MesWmReturnSalesDO::getName, reqVO.getName()) |
| | | .likeIfPresent(MesWmReturnSalesDO::getSalesOrderCode, reqVO.getSalesOrderCode()) |
| | | .eqIfPresent(MesWmReturnSalesDO::getClientId, reqVO.getClientId()) |
| | | .eqIfPresent(MesWmReturnSalesDO::getStatus, reqVO.getStatus()) |
| | | .betweenIfPresent(MesWmReturnSalesDO::getReturnDate, reqVO.getReturnDate()) |
| | | .orderByDesc(MesWmReturnSalesDO::getId); |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesWmReturnSalesDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | default MesWmReturnSalesDO selectByCode(String code) { |
| | | return selectOne(new LambdaQueryWrapperX<MesWmReturnSalesDO>() |
| | | .eq(MesWmReturnSalesDO::getCode, code)); |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.wm.salesnotice; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.salesnotice.vo.MesWmSalesNoticePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.salesnotice.MesWmSalesNoticeDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES åè´§éç¥å Mapper |
| | |
| | | .orderByDesc(MesWmSalesNoticeDO::getId)); |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ï¼å¸¦å®¢æ·æéè¿æ»¤ï¼ |
| | | * |
| | | * @param reqVO æ¥è¯¢æ¡ä»¶ |
| | | * @param permittedClientIds ææéçå®¢æ· ID å表ï¼null 表示ä¸éå¶ï¼ |
| | | * @return åé¡µç»æ |
| | | */ |
| | | default PageResult<MesWmSalesNoticeDO> selectPage(MesWmSalesNoticePageReqVO reqVO, List<Long> permittedClientIds) { |
| | | LambdaQueryWrapperX<MesWmSalesNoticeDO> wrapper = new LambdaQueryWrapperX<MesWmSalesNoticeDO>() |
| | | .likeIfPresent(MesWmSalesNoticeDO::getCode, reqVO.getCode()) |
| | | .likeIfPresent(MesWmSalesNoticeDO::getName, reqVO.getName()) |
| | | .likeIfPresent(MesWmSalesNoticeDO::getSaleOrderCode, reqVO.getSaleOrderCode()) |
| | | .eqIfPresent(MesWmSalesNoticeDO::getClientId, reqVO.getClientId()) |
| | | .eqIfPresent(MesWmSalesNoticeDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(MesWmSalesNoticeDO::getId); |
| | | // å®¢æ·æéè¿æ»¤ |
| | | if (permittedClientIds != null) { |
| | | if (CollUtil.isEmpty(permittedClientIds)) { |
| | | // 空å表表示没æä»»ä½æéï¼è¿åç©ºç»æ |
| | | return PageResult.empty(); |
| | | } |
| | | wrapper.in(MesWmSalesNoticeDO::getClientId, permittedClientIds); |
| | | } |
| | | return selectPage(reqVO, wrapper); |
| | | } |
| | | |
| | | default MesWmSalesNoticeDO selectByCode(String code) { |
| | | return selectOne(MesWmSalesNoticeDO::getCode, code); |
| | | } |
| | |
| | | return selectOne(MesWmSalesNoticeDO::getSaleOrderId, saleOrderId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢å·²åå¨åè´§éç¥åçéå®è®¢å ID å表 |
| | | */ |
| | | default List<Long> selectExistingSaleOrderIds(Collection<Long> saleOrderIds) { |
| | | return selectObjs(new LambdaQueryWrapperX<MesWmSalesNoticeDO>() |
| | | .select(MesWmSalesNoticeDO::getSaleOrderId) |
| | | .in(MesWmSalesNoticeDO::getSaleOrderId, saleOrderIds)); |
| | | } |
| | | |
| | | } |
| | |
| | | String MES_PRO_WORK_ORDER_STATUS = "mes_pro_work_order_status"; // MES ç产工åç¶æ |
| | | String MES_PRO_WORK_ORDER_SOURCE_TYPE = "mes_pro_work_order_source_type"; // MES 工忥æºç±»å |
| | | String MES_PRO_WORK_ORDER_TYPE = "mes_pro_work_order_type"; // MES å·¥åç±»å |
| | | String MES_PRO_MPS_STATUS = "mes_pro_mps_status"; // MES ç产主计åç¶æ |
| | | String MES_PRO_LINK_TYPE = "mes_pro_link_type"; // MES å·¥åºå
³ç³»ç±»å |
| | | String MES_TIME_UNIT_TYPE = "mes_time_unit_type"; // MES æ¶é´åä½ |
| | | String MES_PRO_ANDON_STATUS = "mes_pro_andon_status"; // MES å®ç¯å¤ç½®ç¶æ |
| | |
| | | ErrorCode WORK_RECORD_NOT_CLOCK_IN = new ErrorCode(1_040_508_001, "å½åç¨æ·æªä¸å·¥ï¼æ æ³ä¸å·¥"); |
| | | ErrorCode WORK_RECORD_ALREADY_CLOCK_IN = new ErrorCode(1_040_508_002, "å½åç¨æ·å·²ä¸å·¥ï¼è¯·å
ä¸å·¥åæä½"); |
| | | |
| | | // ========== MES ç产管ç-ç产主计å MPSï¼1-040-509-000ï¼ ========== |
| | | ErrorCode PRO_MPS_NOT_EXISTS = new ErrorCode(1_040_509_000, "MPS ä¸åå¨"); |
| | | ErrorCode PRO_MPS_NOT_DRAFT = new ErrorCode(1_040_509_001, "åªæèç¨¿ç¶æç MPS æè½æ§è¡æ¤æä½"); |
| | | ErrorCode PRO_MPS_NOT_ISSUED = new ErrorCode(1_040_509_002, "åªæå·²ä¸åç¶æç MPS æè½æ§è¡æ¤æä½"); |
| | | ErrorCode PRO_MPS_ALREADY_ISSUED = new ErrorCode(1_040_509_003, "MPS å·²ä¸åï¼æ æ³ä¿®æ¹"); |
| | | ErrorCode PRO_MPS_MERGE_AT_LEAST_TWO = new ErrorCode(1_040_509_004, "åå¹¶ä¸åè³å°éè¦éæ©ä¸¤æ¡ MPS"); |
| | | ErrorCode PRO_MPS_MERGE_PRODUCT_MISMATCH = new ErrorCode(1_040_509_005, "åå¹¶ä¸åç MPS å¿
é¡»æ¯ç¸å产å"); |
| | | ErrorCode PRO_MPS_CODE_DUPLICATE = new ErrorCode(1_040_509_006, "MPS ç¼ç å·²åå¨"); |
| | | ErrorCode PRO_MPS_HAS_WORK_ORDER = new ErrorCode(1_040_509_007, "MPS å·²å
³èç产工åï¼æ æ³å é¤"); |
| | | ErrorCode PRO_MPS_MES_PRODUCT_NOT_EXISTS = new ErrorCode(1_040_509_008, "MES 产åä¸åå¨ï¼æ æ³å建 MPSï¼äº§åï¼{}"); |
| | | |
| | | // ========== MES è´¨é管ç-è´¨æ£æ¹æ¡ï¼1-040-600-000ï¼ ========== |
| | | ErrorCode QC_TEMPLATE_NOT_EXISTS = new ErrorCode(1_040_600_000, "è´¨æ£æ¹æ¡ä¸åå¨"); |
| | | ErrorCode QC_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_040_600_001, "è´¨æ£æ¹æ¡ç¼å·å·²åå¨"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums.pro; |
| | | |
| | | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * MES ç产主计åï¼MPSï¼ç¶ææä¸¾ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum MesProMpsStatusEnum implements ArrayValuable<Integer> { |
| | | |
| | | /** |
| | | * è稿 |
| | | */ |
| | | DRAFT(0, "è稿"), |
| | | /** |
| | | * å·²ä¸å |
| | | */ |
| | | ISSUED(1, "å·²ä¸å"), |
| | | /** |
| | | * 已宿 |
| | | */ |
| | | FINISHED(2, "已宿"), |
| | | /** |
| | | * 已忶 |
| | | */ |
| | | CANCELED(3, "已忶"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()) |
| | | .map(MesProMpsStatusEnum::getStatus).toArray(Integer[]::new); |
| | | |
| | | /** |
| | | * ç¶æå¼ |
| | | */ |
| | | private final Integer status; |
| | | /** |
| | | * ç¶æå |
| | | */ |
| | | private final String name; |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | Long getItemCountByUnitMeasureId(Long unitMeasureId); |
| | | |
| | | /** |
| | | * æ ¹æ® MDM ç©æ ID è·å MES 产å |
| | | * |
| | | * @param mdmItemId MDM ç©æ ID |
| | | * @return MES 产åï¼ä¸åå¨è¿å null |
| | | */ |
| | | MesMdItemDO getItemByMdmItemId(Long mdmItemId); |
| | | |
| | | /** |
| | | * æ ¹æ® MDM ç©æ ID æ ¡éª MES 产ååå¨ |
| | | * |
| | | * @param mdmItemId MDM ç©æ ID |
| | | * @return MES 产å |
| | | * @throws cn.iocoder.yudao.framework.common.exception.ServiceException å¦æäº§åä¸åå¨ |
| | | */ |
| | | MesMdItemDO validateItemExistsByMdmItemId(Long mdmItemId); |
| | | |
| | | } |
| | |
| | | return 1; // é»è®¤åæ |
| | | } |
| | | |
| | | @Override |
| | | public MesMdItemDO getItemByMdmItemId(Long mdmItemId) { |
| | | if (mdmItemId == null) { |
| | | return null; |
| | | } |
| | | return itemMapper.selectByMdmItemId(mdmItemId); |
| | | } |
| | | |
| | | @Override |
| | | public MesMdItemDO validateItemExistsByMdmItemId(Long mdmItemId) { |
| | | MesMdItemDO item = getItemByMdmItemId(mdmItemId); |
| | | if (item == null) { |
| | | throw exception(MD_ITEM_NOT_EXISTS); |
| | | } |
| | | return item; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pro.mps; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES ç产主计åï¼MPSï¼Service æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesProMpsService { |
| | | |
| | | /** |
| | | * å建 MPSï¼ä¾ API è°ç¨ï¼èªå¨æ å°ç©æï¼ |
| | | * |
| | | * @param saleOrderId éå®è®¢åID |
| | | * @param saleOrderNo éå®è®¢åå· |
| | | * @param saleOrderItemId éå®è®¢åæç»ID |
| | | * @param mdmItemId MDM ç©æID |
| | | * @param productName 产ååç§°ï¼ç¨äºé误æç¤ºï¼ |
| | | * @param quantity è®¡åæ°é |
| | | * @param clientId 客æ·ID |
| | | * @param requestDate éæ±æ¥æ |
| | | * @param remark 夿³¨ |
| | | * @return MPS ç¼å·ï¼å¦æ MES 产åä¸åå¨è¿å null |
| | | * @throws cn.iocoder.yudao.framework.common.exception.ServiceException 妿 MES 产åä¸åå¨ |
| | | */ |
| | | Long createMps(Long saleOrderId, String saleOrderNo, Long saleOrderItemId, |
| | | Long mdmItemId, String productName, BigDecimal quantity, Long clientId, |
| | | String requestDate, String remark); |
| | | |
| | | /** |
| | | * å建 MPS |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return MPS ç¼å· |
| | | */ |
| | | Long createMps(@Valid MesProMpsSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ° MPS |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateMps(@Valid MesProMpsSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤ MPSï¼ä»
èç¨¿ç¶æï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void deleteMps(Long id); |
| | | |
| | | /** |
| | | * ä¸ååæ¡ MPS |
| | | * |
| | | * @param id MPS ç¼å· |
| | | * @return çæçå·¥å ID |
| | | */ |
| | | Long issueMps(Long id); |
| | | |
| | | /** |
| | | * åå¹¶ä¸å夿¡ MPS |
| | | * å°å¤æ¡ç¸å产åç MPS åå¹¶çæä¸æ¡ç产工å |
| | | * |
| | | * @param mpsIds MPS ç¼å·å表 |
| | | * @return çæçå·¥å ID |
| | | */ |
| | | Long mergeAndIssueMps(List<Long> mpsIds); |
| | | |
| | | /** |
| | | * åæ¶ MPS |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void cancelMps(Long id); |
| | | |
| | | /** |
| | | * 宿 MPSï¼ç±ç产工å宿æ¶è§¦åï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void finishMps(Long id); |
| | | |
| | | /** |
| | | * æ ¹æ®éå®è®¢åæç»è·å MPS |
| | | * |
| | | * @param saleOrderItemId éå®è®¢åæç»ID |
| | | * @return MPS |
| | | */ |
| | | MesProMpsDO getMpsBySaleOrderItemId(Long saleOrderItemId); |
| | | |
| | | /** |
| | | * è·å MPS |
| | | * |
| | | * @param id ç¼å· |
| | | * @return MPS |
| | | */ |
| | | MesProMpsDO getMps(Long id); |
| | | |
| | | /** |
| | | * è·å MPS å页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return åé¡µç»æ |
| | | */ |
| | | PageResult<MesProMpsDO> getMpsPage(MesProMpsPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * è·å MPS å表 |
| | | * |
| | | * @param ids ç¼å·å表 |
| | | * @return MPS å表 |
| | | */ |
| | | List<MesProMpsDO> getMpsList(Collection<Long> ids); |
| | | |
| | | /** |
| | | * æ ¹æ®éå®è®¢åæç»IDå表è·å MPS å表 |
| | | * |
| | | * @param saleOrderItemIds éå®è®¢åæç»IDå表 |
| | | * @return MPS å表 |
| | | */ |
| | | List<MesProMpsDO> getMpsListBySaleOrderItemIds(Collection<Long> saleOrderItemIds); |
| | | |
| | | /** |
| | | * è·åå¯åå¹¶ç MPS å表ï¼ç¸å产åãèç¨¿ç¶æï¼ |
| | | * |
| | | * @param productId 产åID |
| | | * @return MPS å表 |
| | | */ |
| | | List<MesProMpsDO> getMergeableMpsList(Long productId); |
| | | |
| | | /** |
| | | * æ´æ°å·²ç产æ°é |
| | | * |
| | | * @param id MPS ç¼å· |
| | | * @param incrQuantity å¢é |
| | | */ |
| | | void updateProducedQuantity(Long id, BigDecimal incrQuantity); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pro.mps; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.mps.vo.MesProMpsSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.workorder.vo.MesProWorkOrderSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.mps.MesProMpsMergeItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pro.mps.MesProMpsMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pro.mps.MesProMpsMergeItemMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProMpsStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderSourceTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES ç产主计åï¼MPSï¼Service å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class MesProMpsServiceImpl implements MesProMpsService { |
| | | |
| | | /** |
| | | * MPS ç¼ç è§å |
| | | */ |
| | | private static final String MPS_CODE_RULE = "MPS"; |
| | | |
| | | @Resource |
| | | private MesProMpsMapper mpsMapper; |
| | | @Resource |
| | | private MesProMpsMergeItemMapper mergeItemMapper; |
| | | @Resource |
| | | private MesProWorkOrderService workOrderService; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createMps(Long saleOrderId, String saleOrderNo, Long saleOrderItemId, |
| | | Long mdmItemId, String productName, BigDecimal quantity, Long clientId, |
| | | String requestDate, String remark) { |
| | | // 1. æ ¹æ® MDM ç©æ ID æ¥æ¾ MES 产å |
| | | cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO mesItem = itemService.getItemByMdmItemId(mdmItemId); |
| | | if (mesItem == null) { |
| | | // MES 产åä¸åå¨ï¼æåºå¼å¸¸å¹¶å
å«äº§ååç§°æç¤º |
| | | throw exception(PRO_MPS_MES_PRODUCT_NOT_EXISTS, productName != null ? productName : mdmItemId); |
| | | } |
| | | |
| | | // 2. çæ MPS ç¼ç |
| | | String code = generateMpsCode(); |
| | | |
| | | // 3. è§£æéæ±æ¥æ |
| | | LocalDateTime requestDateTime = null; |
| | | if (StrUtil.isNotBlank(requestDate)) { |
| | | try { |
| | | requestDateTime = LocalDateTime.parse(requestDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | } catch (Exception e) { |
| | | requestDateTime = LocalDateTime.parse(requestDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | } |
| | | } |
| | | |
| | | // 4. å建 MPSï¼ä½¿ç¨ MES 产å IDï¼ |
| | | MesProMpsDO mps = new MesProMpsDO(); |
| | | mps.setCode(code); |
| | | mps.setStatus(MesProMpsStatusEnum.DRAFT.getStatus()); |
| | | mps.setSaleOrderId(saleOrderId); |
| | | mps.setSaleOrderNo(saleOrderNo); |
| | | mps.setSaleOrderItemId(saleOrderItemId); |
| | | mps.setProductId(mesItem.getId()); // ä½¿ç¨ MES 产å ID |
| | | mps.setQuantity(quantity); |
| | | mps.setQuantityProduced(BigDecimal.ZERO); |
| | | mps.setUnitMeasureId(mesItem.getUnitMeasureId()); // ä» MES 产åè·å计éåä½ |
| | | mps.setClientId(clientId); |
| | | mps.setRequestDate(requestDateTime); |
| | | mps.setMergeFlag(0); |
| | | mps.setRemark(remark); |
| | | |
| | | mpsMapper.insert(mps); |
| | | log.info("[createMps] å建 MPS æåï¼id={}, code={}, saleOrderItemId={}, mdmItemId={}, productId={}", |
| | | mps.getId(), mps.getCode(), mps.getSaleOrderItemId(), mdmItemId, mesItem.getId()); |
| | | return mps.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createMps(MesProMpsSaveReqVO createReqVO) { |
| | | // æ ¡éªäº§ååå¨ |
| | | itemService.validateItemExists(createReqVO.getProductId()); |
| | | |
| | | // 妿æªå¡«åç¼ç ï¼èªå¨çæ |
| | | if (StrUtil.isBlank(createReqVO.getCode())) { |
| | | createReqVO.setCode(generateMpsCode()); |
| | | } else { |
| | | // æ ¡éªç¼ç å¯ä¸ |
| | | validateMpsCodeUnique(null, createReqVO.getCode()); |
| | | } |
| | | |
| | | // æå
¥ |
| | | MesProMpsDO mps = BeanUtils.toBean(createReqVO, MesProMpsDO.class); |
| | | mps.setStatus(MesProMpsStatusEnum.DRAFT.getStatus()); |
| | | mps.setQuantityProduced(BigDecimal.ZERO); |
| | | mps.setMergeFlag(0); |
| | | mpsMapper.insert(mps); |
| | | |
| | | log.info("[createMps] æå¨å建 MPS æåï¼id={}, code={}", mps.getId(), mps.getCode()); |
| | | return mps.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateMps(MesProMpsSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ + èç¨¿ç¶æ |
| | | validateMpsExistsAndDraft(updateReqVO.getId()); |
| | | |
| | | // æ ¡éªç¼ç å¯ä¸ |
| | | validateMpsCodeUnique(updateReqVO.getId(), updateReqVO.getCode()); |
| | | |
| | | // æ´æ° |
| | | MesProMpsDO updateObj = BeanUtils.toBean(updateReqVO, MesProMpsDO.class); |
| | | mpsMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteMps(Long id) { |
| | | // æ ¡éªåå¨ + èç¨¿ç¶æ |
| | | MesProMpsDO mps = validateMpsExistsAndDraft(id); |
| | | |
| | | // æ ¡éªæ¯å¦å·²å
³èå·¥å |
| | | if (mps.getWorkOrderId() != null) { |
| | | throw exception(PRO_MPS_HAS_WORK_ORDER); |
| | | } |
| | | |
| | | // å é¤ |
| | | mpsMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long issueMps(Long id) { |
| | | // æ ¡éªåå¨ + èç¨¿ç¶æ |
| | | MesProMpsDO mps = validateMpsExistsAndDraft(id); |
| | | |
| | | // å建ç产工å |
| | | Long workOrderId = createWorkOrderFromMps(mps, mps.getQuantity()); |
| | | |
| | | // æ´æ° MPS ç¶æ |
| | | mpsMapper.updateById(new MesProMpsDO() |
| | | .setId(id) |
| | | .setStatus(MesProMpsStatusEnum.ISSUED.getStatus()) |
| | | .setWorkOrderId(workOrderId) |
| | | .setIssueDate(LocalDateTime.now())); |
| | | |
| | | log.info("[issueMps] MPS ä¸åæåï¼mpsId={}, workOrderId={}", id, workOrderId); |
| | | return workOrderId; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long mergeAndIssueMps(List<Long> mpsIds) { |
| | | // æ ¡éª MPS å表 |
| | | if (CollUtil.isEmpty(mpsIds) || mpsIds.size() < 2) { |
| | | throw exception(PRO_MPS_MERGE_AT_LEAST_TWO); |
| | | } |
| | | |
| | | List<MesProMpsDO> mpsList = mpsMapper.selectBatchIds(mpsIds); |
| | | if (mpsList.size() != mpsIds.size()) { |
| | | throw exception(PRO_MPS_NOT_EXISTS); |
| | | } |
| | | |
| | | // æ ¡éªï¼å¿
é¡»æ¯ç¸å产åãèç¨¿ç¶æ |
| | | Long productId = null; |
| | | for (MesProMpsDO mps : mpsList) { |
| | | if (!MesProMpsStatusEnum.DRAFT.getStatus().equals(mps.getStatus())) { |
| | | throw exception(PRO_MPS_NOT_DRAFT); |
| | | } |
| | | if (productId == null) { |
| | | productId = mps.getProductId(); |
| | | } else if (!productId.equals(mps.getProductId())) { |
| | | throw exception(PRO_MPS_MERGE_PRODUCT_MISMATCH); |
| | | } |
| | | } |
| | | |
| | | // 计ç®åå¹¶æ°é |
| | | BigDecimal totalQuantity = mpsList.stream() |
| | | .map(MesProMpsDO::getQuantity) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | // åç¬¬ä¸æ¡ MPS ä½ä¸ºä¸»è®°å½ï¼å建ç产工å |
| | | MesProMpsDO firstMps = mpsList.get(0); |
| | | Long workOrderId = createWorkOrderFromMps(firstMps, totalQuantity); |
| | | |
| | | // çæåå¹¶æ¹æ¬¡å· |
| | | String mergeBatchNo = generateMergeBatchNo(); |
| | | |
| | | // æ´æ°ææ MPS ç¶æï¼è®°å½åå¹¶å
³ç³» |
| | | for (MesProMpsDO mps : mpsList) { |
| | | mpsMapper.updateById(new MesProMpsDO() |
| | | .setId(mps.getId()) |
| | | .setStatus(MesProMpsStatusEnum.ISSUED.getStatus()) |
| | | .setWorkOrderId(workOrderId) |
| | | .setMergeFlag(1) |
| | | .setMergeBatchNo(mergeBatchNo) |
| | | .setIssueDate(LocalDateTime.now())); |
| | | |
| | | // è®°å½åå¹¶æç» |
| | | MesProMpsMergeItemDO mergeItem = new MesProMpsMergeItemDO(); |
| | | mergeItem.setMergeBatchNo(mergeBatchNo); |
| | | mergeItem.setMpsId(mps.getId()); |
| | | mergeItem.setWorkOrderId(workOrderId); |
| | | mergeItem.setQuantity(mps.getQuantity()); |
| | | mergeItemMapper.insert(mergeItem); |
| | | } |
| | | |
| | | log.info("[mergeAndIssueMps] MPS åå¹¶ä¸åæåï¼mpsIds={}, workOrderId={}, totalQuantity={}", |
| | | mpsIds, workOrderId, totalQuantity); |
| | | return workOrderId; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void cancelMps(Long id) { |
| | | // æ ¡éªåå¨ |
| | | MesProMpsDO mps = validateMpsExists(id); |
| | | |
| | | // æ ¡éªç¶æï¼åªæå·²ä¸åç¶ææè½åæ¶ |
| | | if (!MesProMpsStatusEnum.ISSUED.getStatus().equals(mps.getStatus())) { |
| | | throw exception(PRO_MPS_NOT_ISSUED); |
| | | } |
| | | |
| | | // 级èåæ¶å
³èçç产工å |
| | | if (mps.getWorkOrderId() != null) { |
| | | try { |
| | | workOrderService.cancelWorkOrder(mps.getWorkOrderId()); |
| | | log.info("[cancelMps] 级èåæ¶ç产工åï¼workOrderId={}", mps.getWorkOrderId()); |
| | | } catch (Exception e) { |
| | | // å·¥åå¯è½å·²å®ææå·²åæ¶ï¼è®°å½æ¥å¿ä½ä¸é»æ¢ MPS åæ¶ |
| | | log.warn("[cancelMps] åæ¶ç产工å失败ï¼workOrderId={}ï¼åå ï¼{}", mps.getWorkOrderId(), e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | // æ´æ° MPS ç¶æ |
| | | mpsMapper.updateById(new MesProMpsDO() |
| | | .setId(id) |
| | | .setStatus(MesProMpsStatusEnum.CANCELED.getStatus())); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void finishMps(Long id) { |
| | | // æ ¡éªåå¨ |
| | | MesProMpsDO mps = validateMpsExists(id); |
| | | |
| | | // æ ¡éªç¶æï¼åªæå·²ä¸åç¶ææè½å®æ |
| | | if (!MesProMpsStatusEnum.ISSUED.getStatus().equals(mps.getStatus())) { |
| | | throw exception(PRO_MPS_NOT_ISSUED); |
| | | } |
| | | |
| | | // æ´æ°ç¶æ |
| | | mpsMapper.updateById(new MesProMpsDO() |
| | | .setId(id) |
| | | .setStatus(MesProMpsStatusEnum.FINISHED.getStatus()) |
| | | .setFinishDate(LocalDateTime.now())); |
| | | } |
| | | |
| | | @Override |
| | | public MesProMpsDO getMpsBySaleOrderItemId(Long saleOrderItemId) { |
| | | return mpsMapper.selectBySaleOrderItemId(saleOrderItemId); |
| | | } |
| | | |
| | | @Override |
| | | public MesProMpsDO getMps(Long id) { |
| | | return mpsMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesProMpsDO> getMpsPage(MesProMpsPageReqVO pageReqVO) { |
| | | // è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return mpsMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesProMpsDO> getMpsList(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return mpsMapper.selectBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesProMpsDO> getMpsListBySaleOrderItemIds(Collection<Long> saleOrderItemIds) { |
| | | return mpsMapper.selectListBySaleOrderItemIds(saleOrderItemIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesProMpsDO> getMergeableMpsList(Long productId) { |
| | | return mpsMapper.selectMergeableList(productId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateProducedQuantity(Long id, BigDecimal incrQuantity) { |
| | | mpsMapper.updateProducedQuantity(id, incrQuantity); |
| | | } |
| | | |
| | | // ========== ç§ææ¹æ³ ========== |
| | | |
| | | /** |
| | | * çæ MPS ç¼ç |
| | | */ |
| | | private String generateMpsCode() { |
| | | try { |
| | | return autoCodeRecordService.generateAutoCode(MPS_CODE_RULE); |
| | | } catch (Exception e) { |
| | | // 妿ç¼ç è§åä¸åå¨ï¼ä½¿ç¨æ¶é´æ³çæ |
| | | log.warn("[generateMpsCode] ç¼ç è§å {} ä¸åå¨ï¼ä½¿ç¨æ¶é´æ³çæ", MPS_CODE_RULE); |
| | | return "MPS" + System.currentTimeMillis(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * çæåå¹¶æ¹æ¬¡å· |
| | | */ |
| | | private String generateMergeBatchNo() { |
| | | return "MERGE" + System.currentTimeMillis(); |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éª MPS åå¨ |
| | | */ |
| | | private MesProMpsDO validateMpsExists(Long id) { |
| | | MesProMpsDO mps = mpsMapper.selectById(id); |
| | | if (mps == null) { |
| | | throw exception(PRO_MPS_NOT_EXISTS); |
| | | } |
| | | return mps; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éª MPS åå¨ + èç¨¿ç¶æ |
| | | */ |
| | | private MesProMpsDO validateMpsExistsAndDraft(Long id) { |
| | | MesProMpsDO mps = validateMpsExists(id); |
| | | if (!MesProMpsStatusEnum.DRAFT.getStatus().equals(mps.getStatus())) { |
| | | throw exception(PRO_MPS_NOT_DRAFT); |
| | | } |
| | | return mps; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éª MPS ç¼ç å¯ä¸ |
| | | */ |
| | | private void validateMpsCodeUnique(Long id, String code) { |
| | | if (StrUtil.isBlank(code)) { |
| | | return; |
| | | } |
| | | MesProMpsDO mps = mpsMapper.selectByCode(code); |
| | | if (mps == null) { |
| | | return; |
| | | } |
| | | if (id == null) { |
| | | throw exception(PRO_MPS_CODE_DUPLICATE); |
| | | } |
| | | if (!id.equals(mps.getId())) { |
| | | throw exception(PRO_MPS_CODE_DUPLICATE); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ® MPS å建ç产工å |
| | | */ |
| | | private Long createWorkOrderFromMps(MesProMpsDO mps, BigDecimal quantity) { |
| | | MesProWorkOrderSaveReqVO workOrderReq = new MesProWorkOrderSaveReqVO(); |
| | | workOrderReq.setCode(generateWorkOrderCode()); |
| | | workOrderReq.setName("ç产工å-" + mps.getCode()); |
| | | workOrderReq.setType(1); // èªè¡ç产 |
| | | workOrderReq.setOrderSourceType(MesProWorkOrderSourceTypeEnum.ORDER.getType()); |
| | | workOrderReq.setOrderSourceCode(mps.getSaleOrderNo()); |
| | | workOrderReq.setProductId(mps.getProductId()); |
| | | workOrderReq.setQuantity(quantity); |
| | | workOrderReq.setClientId(mps.getClientId()); |
| | | workOrderReq.setRequestDate(mps.getRequestDate() != null ? mps.getRequestDate() : LocalDateTime.now()); |
| | | workOrderReq.setRemark("æ¥èª MPS: " + mps.getCode()); |
| | | |
| | | Long workOrderId = workOrderService.createWorkOrder(workOrderReq); |
| | | |
| | | // å·¥åç´æ¥ç¡®è®¤ä¸ºå·²ç¡®è®¤ç¶æï¼è·³è¿èç¨¿ï¼ |
| | | workOrderService.confirmWorkOrder(workOrderId); |
| | | |
| | | return workOrderId; |
| | | } |
| | | |
| | | /** |
| | | * çæç产工åç¼ç |
| | | */ |
| | | private String generateWorkOrderCode() { |
| | | try { |
| | | return autoCodeRecordService.generateAutoCode("WO"); |
| | | } catch (Exception e) { |
| | | log.warn("[generateWorkOrderCode] ç¼ç è§å WO ä¸åå¨ï¼ä½¿ç¨æ¶é´æ³çæ"); |
| | | return "WO" + System.currentTimeMillis(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private MesWmBarcodeService barcodeService; |
| | | @Resource |
| | | private MesProTaskService taskService; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | @Override |
| | | public PageResult<MesProWorkOrderDO> getWorkOrderPage(MesProWorkOrderPageReqVO pageReqVO) { |
| | | return workOrderMapper.selectPage(pageReqVO); |
| | | // è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return workOrderMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.qc.MesQcStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.qc.MesQcTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.defectrecord.MesQcDefectRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.indicatorresult.MesQcIndicatorResultService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.template.MesQcTemplateItemService; |
| | |
| | | @Resource |
| | | private MesWmOutsourceReceiptService outsourceReceiptService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private ErpSupplierApi supplierApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | private void validateIqcSaveData(MesQcIqcSaveReqVO reqVO) { |
| | | // æ ¡éªç¼å·å¯ä¸ |
| | | validateIqcCodeUnique(reqVO.getId(), reqVO.getCode()); |
| | | // æ ¡éªä¾åºååå¨ï¼ä¼å
æ ¡éª ERP ä¾åºåï¼å¤±è´¥åæ ¡éª MDM ä¾åºåï¼ |
| | | // æ ¡éªä¾åºååå¨ |
| | | if (reqVO.getVendorId() != null) { |
| | | try { |
| | | supplierApi.validateSupplier(reqVO.getVendorId()); |
| | | } catch (Exception e) { |
| | | // ERP ä¾åºåæ ¡éªå¤±è´¥ï¼å°è¯ MDM ä¾åºå |
| | | vendorService.validateVendorExists(reqVO.getVendorId()); |
| | | } |
| | | supplierApi.validateSupplier(reqVO.getVendorId()); |
| | | } |
| | | // æ ¡éªç©æåå¨ï¼ä½¿ç¨ MDM ç©æï¼ |
| | | if (reqVO.getItemId() != null) { |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.oqc.vo.MesQcOqcSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.defectrecord.MesQcDefectRecordDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.oqc.MesQcOqcDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesLineDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | void recalculateDefectStats(Long oqcId, List<MesQcDefectRecordDO> records); |
| | | |
| | | /** |
| | | * æ ¹æ®éå®åºåºåæç»èªå¨å建 OQC æ£éªå |
| | | * |
| | | * @param salesId éå®åºåºå ID |
| | | * @param line éå®åºåºåæç» |
| | | * @param salesCode éå®åºåºåç¼ç |
| | | * @param clientId å®¢æ· ID |
| | | * @return OQC æ£éªå ID |
| | | */ |
| | | Long createOqcFromProductSales(Long salesId, MesWmProductSalesLineDO line, String salesCode, Long clientId); |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.qc.MesQcStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.qc.MesQcTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.defectrecord.MesQcDefectRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.indicatorresult.MesQcIndicatorResultService; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.wm.productsales.MesWmProductSalesService; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesLineDO; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | |
| | | private MesQcDefectRecordService defectRecordService; |
| | | @Resource |
| | | @Lazy |
| | | private MesMdClientService clientService; |
| | | @Resource |
| | | @Lazy |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | | @Lazy |
| | |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | private void validateOqcSaveData(MesQcOqcSaveReqVO reqVO) { |
| | | // æ ¡éªç¼å·å¯ä¸ |
| | | validateOqcCodeUnique(reqVO.getId(), reqVO.getCode()); |
| | | // æ ¡éªå®¢æ·ãç©æãæ£æµäººååå¨ |
| | | clientService.validateClientExists(reqVO.getClientId()); |
| | | // æ ¡éªç©æãæ£æµäººååå¨ |
| | | // 注ï¼å®¢æ· ID æ¥èª CRMï¼ä¸éè¦å¨ MES 䏿 ¡éª |
| | | itemService.validateItemExists(reqVO.getItemId()); |
| | | adminUserApi.validateUser(reqVO.getInspectorUserId()); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public PageResult<MesQcOqcDO> getOqcPage(MesQcOqcPageReqVO pageReqVO) { |
| | | return oqcMapper.selectPage(pageReqVO); |
| | | // è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return oqcMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | oqcMapper.updateById(updateOqc); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createOqcFromProductSales(Long salesId, MesWmProductSalesLineDO line, String salesCode, Long clientId) { |
| | | // 1. æ ¡éªç©ææ¯å¦é
ç½®äº OQC æ£éªæ¨¡æ¿ |
| | | MesQcTemplateItemDO templateItem; |
| | | try { |
| | | templateItem = templateItemService.getRequiredTemplateByItemIdAndType( |
| | | line.getItemId(), MesQcTypeEnum.OQC.getType()); |
| | | } catch (Exception e) { |
| | | // è·åç©æä¿¡æ¯ï¼æä¾æ´æç¡®çé误æç¤º |
| | | String itemInfo = getItemInfo(line.getItemId()); |
| | | throw exception(QC_NO_TEMPLATE_FOR_ITEM, itemInfo); |
| | | } |
| | | Long templateId = templateItem.getTemplateId(); |
| | | |
| | | // 2. çææ£éªåç¼ç |
| | | String code = "OQC" + System.currentTimeMillis(); |
| | | |
| | | // 3. å建 OQC 主表ï¼å¾
æ£éªç¶æï¼åå§æ°é为 0ï¼ |
| | | MesQcOqcDO oqc = new MesQcOqcDO(); |
| | | oqc.setCode(code); |
| | | oqc.setName(salesCode + "-åºè´§æ£éª"); |
| | | oqc.setTemplateId(templateId); |
| | | oqc.setSourceDocType(MesBizTypeConstants.WM_PRODUCT_SALES); |
| | | oqc.setSourceDocId(salesId); |
| | | oqc.setSourceLineId(line.getId()); |
| | | oqc.setSourceDocCode(salesCode); |
| | | oqc.setClientId(clientId); |
| | | oqc.setItemId(line.getItemId()); |
| | | oqc.setBatchCode(line.getBatchCode()); |
| | | oqc.setOutQuantity(line.getQuantity()); |
| | | oqc.setCheckQuantity(BigDecimal.ZERO); // å¾
å¡«å |
| | | oqc.setQualifiedQuantity(BigDecimal.ZERO); // å¾
å¡«å |
| | | oqc.setUnqualifiedQuantity(BigDecimal.ZERO); // å¾
å¡«å |
| | | oqc.setOutDate(java.time.LocalDateTime.now()); |
| | | oqc.setStatus(MesQcStatusEnum.DRAFT.getStatus()); |
| | | oqcMapper.insert(oqc); |
| | | |
| | | // 4. 仿¨¡æ¿ææ èªå¨çææ£éªè¡ |
| | | oqcLineService.createLinesFromTemplate(oqc.getId(), templateId); |
| | | |
| | | return oqc.getId(); |
| | | } |
| | | |
| | | /** |
| | | * è·åç©æä¿¡æ¯ï¼ç¼ç +åç§°ï¼ |
| | | */ |
| | | private String getItemInfo(Long itemId) { |
| | | if (itemId == null) { |
| | | return "æªç¥ç©æ"; |
| | | } |
| | | try { |
| | | cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO item = mdmItemApi.getItem(itemId).getCheckedData(); |
| | | if (item != null) { |
| | | return item.getCode() + "-" + item.getName(); |
| | | } |
| | | } catch (Exception e) { |
| | | // 忽ç¥å¼å¸¸ |
| | | } |
| | | return "ç©æID:" + itemId; |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemBatchConfigApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemBatchConfigRespDTO; |
| | | import jakarta.annotation.Resource; |
| | |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | @Resource |
| | | private MesWmBarcodeService barcodeService; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Override |
| | | public PageResult<MesWmBatchDO> getBatchPage(MesWmBatchPageReqVO pageReqVO) { |
| | | return batchMapper.selectPage(pageReqVO); |
| | | // è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return batchMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmOutsourceIssueStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.MesWmTransactionService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.dto.MesWmTransactionSaveReqDTO; |
| | |
| | | @Resource |
| | | private MesWmOutsourceIssueDetailService outsourceIssueDetailService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesProWorkOrderService workOrderService; |
| | | @Resource |
| | |
| | | validateCodeUnique(saveReqVO.getId(), saveReqVO.getCode()); |
| | | // æ ¡éªä¾åºååå¨ |
| | | if (saveReqVO.getVendorId() != null) { |
| | | vendorService.validateVendorExistsAndEnable(saveReqVO.getVendorId()); |
| | | supplierApi.validateSupplier(saveReqVO.getVendorId()); |
| | | } |
| | | // æ ¡éªå·¥ååå¨ä¸ç±»å为å¤åï¼ä»£å·¥ï¼ |
| | | MesProWorkOrderDO workOrder = workOrderService.validateWorkOrderConfirmed(saveReqVO.getWorkOrderId()); |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.MesWmTransactionService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.dto.MesWmTransactionSaveReqDTO; |
| | |
| | | @Resource |
| | | private MesWmTransactionService wmTransactionService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesMdmItemService mdmItemService; |
| | | @Resource |
| | |
| | | // æ ¡éªç¼ç å¯ä¸ |
| | | validateCodeUnique(id, reqVO.getCode()); |
| | | // æ ¡éªä¾åºååå¨ |
| | | vendorService.validateVendorExistsAndEnable(reqVO.getVendorId()); |
| | | supplierApi.validateSupplier(reqVO.getVendorId()); |
| | | // æ ¡éªå¤åå·¥ååå¨ |
| | | if (reqVO.getWorkOrderId() != null) { |
| | | workOrderService.validateWorkOrderConfirmed(reqVO.getWorkOrderId()); |
| | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.packages.vo.MesWmPackagePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.packages.vo.MesWmPackageSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.packages.MesWmPackageDO; |
| | |
| | | private MesWmPackageLineService packageLineService; |
| | | @Resource |
| | | private MesWmBarcodeService barcodeService; |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Override |
| | | public Long createPackage(MesWmPackageSaveReqVO createReqVO) { |
| | |
| | | |
| | | @Override |
| | | public PageResult<MesWmPackageDO> getPackagePage(MesWmPackagePageReqVO pageReqVO) { |
| | | return packageMapper.selectPage(pageReqVO); |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return packageMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.salesnotice.MesWmSalesNoticeLineDO; |
| | | import cn.iocoder.yudao.module.mes.service.wm.salesnotice.MesWmSalesNoticeLineService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.oqc.MesQcOqcService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | |
| | | @Resource |
| | | @Lazy |
| | | private MesWmSalesNoticeLineService salesNoticeLineService; |
| | | @Resource |
| | | @Lazy |
| | | private MesQcOqcService oqcService; |
| | | |
| | | @Override |
| | | public Long createProductSalesLine(MesWmProductSalesLineSaveReqVO createReqVO) { |
| | |
| | | // æ´æ° |
| | | MesWmProductSalesLineDO updateObj = BeanUtils.toBean(updateReqVO, MesWmProductSalesLineDO.class); |
| | | productSalesLineMapper.updateById(updateObj); |
| | | |
| | | // æ£æ¥æ¯å¦éè¦å建 OQC æ£éªåï¼ä»ä¸éè¦æ£éªå为éè¦æ£éª |
| | | if (Boolean.TRUE.equals(updateReqVO.getOqcCheckFlag()) |
| | | && !Boolean.TRUE.equals(oldLine.getOqcCheckFlag())) { |
| | | // è·ååºåºåä¿¡æ¯ |
| | | MesWmProductSalesDO sales = productSalesService.getProductSales(updateReqVO.getSalesId()); |
| | | if (sales == null) { |
| | | log.warn("[updateProductSalesLine] åºåºåä¸åå¨ï¼salesId={}", updateReqVO.getSalesId()); |
| | | return; |
| | | } |
| | | |
| | | // æå»ºåºåºæç» DO |
| | | MesWmProductSalesLineDO line = new MesWmProductSalesLineDO(); |
| | | line.setId(updateReqVO.getId()); |
| | | line.setItemId(updateReqVO.getItemId()); |
| | | line.setBatchCode(updateReqVO.getBatchCode()); |
| | | line.setQuantity(updateReqVO.getQuantity()); |
| | | |
| | | // å建 OQC æ£éªåï¼è®©å¼å¸¸æåº |
| | | Long oqcId = oqcService.createOqcFromProductSales( |
| | | sales.getId(), line, sales.getCode(), sales.getClientId()); |
| | | |
| | | // æ´æ°åºåºæç»ç oqcId åè´¨éç¶æ |
| | | productSalesLineMapper.updateById(new MesWmProductSalesLineDO() |
| | | .setId(updateReqVO.getId()) |
| | | .setOqcId(oqcId) |
| | | .setQualityStatus(MesWmQualityStatusEnum.PENDING.getStatus())); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | MesWmSalesNoticeLineDO noticeLine = salesNoticeLineService.validateSalesNoticeLineExists( |
| | | noticeLineId, sales.getNoticeId()); |
| | | // æ ¡éªå
³é®å段ä¸è´æ§ï¼ç©æãæ°éãæ¹æ¬¡å·ãOQC æ£éªæ è¯ |
| | | // æ ¡éªå
³é®å段ä¸è´æ§ï¼ç©æãæ°éãæ¹æ¬¡å· |
| | | // 注ï¼OQC æ£éªæ è¯å
许å¨åºåºæ¶ç¬ç«è®¾ç½®ï¼ä¸å¼ºå¶ä¸éç¥åä¸è´ |
| | | if (ObjUtil.notEqual(reqVO.getItemId(), noticeLine.getItemId())) { |
| | | throw exception(WM_PRODUCT_SALES_LINE_NOTICE_LINE_ITEM_MISMATCH); |
| | | } |
| | |
| | | if (StrUtil.isNotBlank(noticeLine.getBatchCode()) |
| | | && ObjUtil.notEqual(reqVO.getBatchCode(), noticeLine.getBatchCode())) { |
| | | throw exception(WM_PRODUCT_SALES_LINE_NOTICE_LINE_BATCH_MISMATCH); |
| | | } |
| | | if (noticeLine.getOqcCheckFlag() != null |
| | | && ObjUtil.notEqual(reqVO.getOqcCheckFlag(), noticeLine.getOqcCheckFlag())) { |
| | | throw exception(WM_PRODUCT_SALES_LINE_NOTICE_LINE_OQC_MISMATCH); |
| | | } |
| | | return; |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesDetailDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productsales.MesWmProductSalesLineDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.productsales.MesWmProductSalesMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.productsales.MesWmProductSalesLineMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductSalesStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmSalesNoticeStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmStockReserveBizTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.salesnotice.MesWmSalesNoticeService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.stockreserve.MesWmStockReserveService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.MesWmTransactionService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.dto.MesWmTransactionSaveReqDTO; |
| | | import cn.iocoder.yudao.module.mes.service.qc.oqc.MesQcOqcService; |
| | | import cn.iocoder.yudao.module.erp.api.sale.ErpSaleOrderApi; |
| | | import cn.iocoder.yudao.module.erp.api.sale.enums.ErpSaleOrderOutStatusEnum; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class MesWmProductSalesServiceImpl implements MesWmProductSalesService { |
| | | |
| | | @Resource |
| | | private MesWmProductSalesMapper productSalesMapper; |
| | | @Resource |
| | | private MesWmProductSalesLineMapper productSalesLineMapper; |
| | | |
| | | @Resource |
| | | private MesWmProductSalesLineService productSalesLineService; |
| | | @Resource |
| | | private MesWmProductSalesDetailService productSalesDetailService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MesWmSalesNoticeService salesNoticeService; |
| | | @Resource |
| | |
| | | private MesWmMaterialStockService materialStockService; |
| | | @Resource |
| | | private MesWmStockReserveService stockReserveService; |
| | | @Resource |
| | | @Lazy |
| | | private MesQcOqcService oqcService; |
| | | |
| | | @Resource |
| | | private ErpSaleOrderApi saleOrderApi; |
| | |
| | | |
| | | @Override |
| | | public PageResult<MesWmProductSalesDO> getProductSalesPage(MesWmProductSalesPageReqVO pageReqVO) { |
| | | return productSalesMapper.selectPage(pageReqVO); |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return productSalesMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | |
| | | // è·ååºåºåä¿¡æ¯ |
| | | MesWmProductSalesDO sales = productSalesMapper.selectById(id); |
| | | |
| | | // æ£æ¥ææè¡ç oqcCheckFlagï¼å¦ææéè¦ OQC æ£éªçè¡ï¼è¿å
¥å¾
æ£æµç¶æ |
| | | boolean needOqc = CollectionUtils.anyMatch(lines, |
| | | line -> Boolean.TRUE.equals(line.getOqcCheckFlag())); |
| | | if (needOqc) { |
| | | // 为éè¦ OQC æ£éªä¸å°æªå建æ£éªåçæç»å建 OQC æ£éªå |
| | | List<MesWmProductSalesLineDO> oqcLines = CollectionUtils.filterList(lines, |
| | | line -> Boolean.TRUE.equals(line.getOqcCheckFlag()) && line.getOqcId() == null); |
| | | for (MesWmProductSalesLineDO line : oqcLines) { |
| | | // ç´æ¥è°ç¨ï¼è®©å¼å¸¸æåºï¼ä¿è¯æ°æ®ä¸è´æ§ |
| | | Long oqcId = oqcService.createOqcFromProductSales( |
| | | sales.getId(), line, sales.getCode(), sales.getClientId()); |
| | | // æ´æ°åºåºæç»ç oqcId |
| | | productSalesLineMapper.updateById(new MesWmProductSalesLineDO() |
| | | .setId(line.getId()) |
| | | .setOqcId(oqcId)); |
| | | } |
| | | |
| | | // æ¹éåå§å OQC è¡çè´¨éç¶æä¸º"å¾
æ£éª" |
| | | List<Long> oqcLineIds = convertList( |
| | | CollectionUtils.filterList(lines, line -> Boolean.TRUE.equals(line.getOqcCheckFlag())), |
| | |
| | | // æ ¡éªç¼ç å¯ä¸ |
| | | validateCodeUnique(id, reqVO.getCode()); |
| | | // æ ¡éªå®¢æ·åå¨ |
| | | clientService.validateClientExistsAndEnable(reqVO.getClientId()); |
| | | customerApi.validateCustomer(reqVO.getClientId()); |
| | | // æ ¡éªåè´§éç¥å |
| | | if (reqVO.getNoticeId() != null) { |
| | | MesWmSalesNoticeDO notice = salesNoticeService.validateSalesNoticeExists(reqVO.getNoticeId()); |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmReturnSalesStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.MesWmTransactionService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.dto.MesWmTransactionSaveReqDTO; |
| | |
| | | @Resource |
| | | private MesWmReturnSalesDetailService returnSalesDetailService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | @Resource |
| | | private MesMdmItemService mdmItemService; |
| | | @Resource |
| | |
| | | |
| | | @Override |
| | | public PageResult<MesWmReturnSalesDO> getReturnSalesPage(MesWmReturnSalesPageReqVO pageReqVO) { |
| | | return returnSalesMapper.selectPage(pageReqVO); |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return returnSalesMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | */ |
| | | private void validateSaveData(MesWmReturnSalesSaveReqVO reqVO) { |
| | | validateCodeUnique(reqVO.getId(), reqVO.getCode()); |
| | | clientService.validateClientExistsAndEnable(reqVO.getClientId()); |
| | | customerApi.validateCustomer(reqVO.getClientId()); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmReturnVendorStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpSupplierApi; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.MesWmTransactionService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.transaction.dto.MesWmTransactionSaveReqDTO; |
| | | import jakarta.annotation.Resource; |
| | |
| | | @Resource |
| | | private MesWmReturnVendorDetailService returnVendorDetailService; |
| | | @Resource |
| | | private MesMdVendorService vendorService; |
| | | private ErpSupplierApi supplierApi; |
| | | @Resource |
| | | private MesWmTransactionService wmTransactionService; |
| | | |
| | |
| | | validateReturnVendorExistsAndPrepare(reqVO.getId()); |
| | | } |
| | | // æ ¡éªä¾åºååå¨ |
| | | vendorService.validateVendorExistsAndEnable(reqVO.getVendorId()); |
| | | supplierApi.validateSupplier(reqVO.getVendorId()); |
| | | // æ ¡éªç¼ç å¯ä¸ |
| | | validateCodeUnique(reqVO.getId(), reqVO.getCode()); |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmOutStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductSalesStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.erp.api.sale.ErpSaleOrderApi; |
| | | import cn.iocoder.yudao.module.erp.api.sale.dto.ErpSaleOrderItemRespDTO; |
| | | import cn.iocoder.yudao.module.erp.api.sale.dto.ErpSaleOrderRespDTO; |
| | |
| | | @Resource |
| | | private MesWmSalesNoticeLineService salesNoticeLineService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Resource |
| | | private ErpSaleOrderApi saleOrderApi; |
| | |
| | | |
| | | @Override |
| | | public MesWmSalesNoticeDO getSalesNotice(Long id) { |
| | | return salesNoticeMapper.selectById(id); |
| | | MesWmSalesNoticeDO notice = salesNoticeMapper.selectById(id); |
| | | // æ ¡éªå®¢æ·æé |
| | | if (notice != null && notice.getClientId() != null) { |
| | | List<Long> permittedIds = customerApi.getPermittedCustomerIds(); |
| | | if (permittedIds != null && !permittedIds.contains(notice.getClientId())) { |
| | | return null; // æ æéåè¿å null |
| | | } |
| | | } |
| | | return notice; |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesWmSalesNoticeDO> getSalesNoticePage(MesWmSalesNoticePageReqVO pageReqVO) { |
| | | return salesNoticeMapper.selectPage(pageReqVO); |
| | | // è·åç¨æ·ææéçå®¢æ· ID å表 |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return salesNoticeMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | validateNoticeCodeUnique(saveReqVO.getId(), saveReqVO.getCode()); |
| | | // æ ¡éªå®¢æ·åå¨ |
| | | if (saveReqVO.getClientId() != null) { |
| | | clientService.validateClientExistsAndEnable(saveReqVO.getClientId()); |
| | | customerApi.validateCustomer(saveReqVO.getClientId()); |
| | | } |
| | | } |
| | | |