已修改90个文件
已添加25个文件
已删除19个文件
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # 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 䏿¯æ |
| | |
| | | |
| | | /yudao-ui-app/unpackage/ |
| | | .DS_Store |
| | | **/.DS_Store |
| | | **/.DS_Store |
| | | |
| | | ### Claude Code ### |
| | | .claude/settings.local.json |
| | | .claude/worktrees/ |
| | | .claude/scheduled_tasks.json |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # å é¤ 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 çå·²ç产æ°éç±çäº§å·¥åæ¥å·¥æ¶èªå¨æ´æ° |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # çäº§éæ - å端èè°æ¹æ¡ |
| | | |
| | | ## é®é¢èæ¯ |
| | | |
| | | éææç»ï¼detailï¼ç `warehouseId`/`locationId`/`areaId` è¯ä¹åæ´ï¼ |
| | | - **åæ´å**ï¼æ¥æºä»åºï¼ä»åºåè®°å½å¸¦å
¥ï¼å³èæçº¿è¾¹åºï¼ |
| | | - **åæ´å**ï¼ä¸æ¶ç®æ ä»åºï¼éæè¦æ¾åçå®é
ä»åºï¼ |
| | | |
| | | åç«¯ä¼ èæçº¿è¾¹åºä¿¡æ¯ â å端å
¥åºä¹å
¥èæåº â å®é
ä»åºåºå没æ¢å¤ã |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - ç产éæå - æç»æ°å¢/ç¼è¾å¼¹çª |
| | | - ç产éæå - 䏿¶æä½é¡µé¢ |
| | | |
| | | ## æ ¸å¿åæ´ |
| | | |
| | | ### éææç»çä»åºå段è¯ä¹ |
| | | |
| | | | åæ®µ | åæ´åè¯ä¹ | åæ´åè¯ä¹ | 说æ | |
| | | |------|-----------|-----------|------| |
| | | | `materialStockId` | èæçº¿è¾¹åºåºåè®°å½ ID | ä¸å | ç¨äºä»èæçº¿è¾¹åºåºåº | |
| | | | `warehouseId` | æ¥æºä»åºï¼èæåºï¼ | **䏿¶ç®æ ä»åºï¼å®é
ä»åºï¼** | éæå
¥åºçç®æ ä»åº | |
| | | | `locationId` | æ¥æºåºåº | **䏿¶ç®æ åºåº** | éæå
¥åºçç®æ åºåº | |
| | | | `areaId` | æ¥æºåºä½ | **䏿¶ç®æ åºä½** | éæå
¥åºçç®æ åºä½ | |
| | | |
| | | ### å端已åçå
¼å®¹ |
| | | |
| | | å端 `createTransactionList` å·²åå
åºï¼ |
| | | - 妿 detail ç `warehouseId` 仿¯èæçº¿è¾¹åºï¼æ§æ°æ®/åç«¯æªæ¹ï¼ï¼ä¼èªå¨éè¿äºå¡æµæ°´åæ¥åå§ä»åº |
| | | - å端æ¹å®åï¼ç´æ¥ä½¿ç¨ detail çä»åºä¿¡æ¯ä½ä¸ºå
¥åºç®æ ï¼ä¸åèµ°åæ¥ |
| | | |
| | | ## å端修æ¹ç¹ |
| | | |
| | | ### 1. æç»æ°å¢/ç¼è¾å¼¹çª - ä»åºéæ©é»è¾ |
| | | |
| | | **å½åé»è¾**ï¼éæ©èæçº¿è¾¹åºåºåè®°å½åï¼èªå¨å¸¦å
¥è¯¥åºåè®°å½ç warehouseId/locationId/areaIdï¼èæåºï¼ |
| | | |
| | | **æ¹ä¸º**ï¼ |
| | | - `materialStockId`ï¼ä»ä»èæçº¿è¾¹åºåºåè®°å½è·åï¼ç¨äºæ è¯ä»åªä¸ªåºååºï¼ |
| | | - `warehouseId`/`locationId`/`areaId`ï¼**æ¹ä¸ºè®©ç¨æ·éæ©ä¸æ¶ç®æ åºä½**ï¼å®é
ä»åºçåºä½ï¼ï¼ä¸åèªå¨ä»åºåè®°å½å¸¦å
¥ |
| | | |
| | | #### éæ©åºåè®°å½æ¶ |
| | | |
| | | ``` |
| | | éæ©åºåè®°å½ â èªå¨å¸¦å
¥ï¼itemId, batchId, batchCode, materialStockId |
| | | ä¸å带å
¥ï¼warehouseId, locationId, areaId |
| | | ``` |
| | | |
| | | #### 䏿¶ç®æ åºä½éæ© |
| | | |
| | | æ°å¢ä¸ä¸ªåºä½éæ©å¨ï¼è®©ç¨æ·éæ©éæè¦æ¾åçå®é
ä»åºåºä½ï¼ |
| | | - ä»åºä¸æï¼è¿æ»¤æèæçº¿è¾¹ä»åºï¼code = `WIP_VIRTUAL_WAREHOUSE`ï¼ |
| | | - åºåºä¸æï¼èå¨ä»åº |
| | | - åºä½ä¸æï¼èå¨åºåº |
| | | |
| | | ### 2. æ°æ®å¸¦å
¥è¯´æ |
| | | |
| | | | åºæ¯ | ä»åªå¸¦å
¥ | åæ®µ | |
| | | |------|---------|------| |
| | | | éæ©åºåè®°å½ | èæçº¿è¾¹åºåºå | materialStockId, itemId, batchId, batchCode | |
| | | | 鿩䏿¶åºä½ | ç¨æ·æå¨éæ© | warehouseId, locationId, areaId | |
| | | | é»è®¤ä¸æ¶åºä½ | 颿åºåºæ¶çåå§ä»åº | warehouseId, locationId, areaId | |
| | | |
| | | **建议**ï¼éæ©åºåè®°å½åï¼èªå¨æ¥è¯¢è¯¥ç©æç颿åºåºè®°å½ï¼å°åå§åºåºä»åºä½ä¸ºé»è®¤ä¸æ¶ç®æ åºä½ï¼ç¨æ·å¯ä¿®æ¹ã |
| | | |
| | | ### 3. API 说æ |
| | | |
| | | ä¿åæç»çæ¥å£ä¸åï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/wm-return-issue-detail/create | æ°å¢æç» | |
| | | | PUT | /mes/wm-return-issue-detail/update | ä¿®æ¹æç» | |
| | | |
| | | **请æ±åæ°ï¼åä¹åï¼ä½è¯ä¹åæ´ï¼ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | materialStockId | Long | å¦ | èæçº¿è¾¹åºåºåè®°å½ IDï¼æ¥æºï¼ | |
| | | | warehouseId | Long | æ¯ | **䏿¶ç®æ ä»åº ID**ï¼ä¸åæ¯æ¥æºä»åºï¼ | |
| | | | locationId | Long | æ¯ | **䏿¶ç®æ åºåº ID** | |
| | | | areaId | Long | æ¯ | **䏿¶ç®æ åºä½ ID** | |
| | | |
| | | ### 4. åç«¯æ ¡éªåæ´ |
| | | |
| | | åç«¯æ ¡éªå·²è°æ´ï¼ |
| | | - â
æ ¡éª `materialStockId` 对åºçåºåè®°å½åå¨ãç©æä¸è´ãåºåå
è¶³ |
| | | - â ä¸åæ ¡éª `materialStockId` çä»åºä¸ `warehouseId` ä¸è´ï¼å ä¸ºæ¥æºæ¯èæåºï¼ç®æ æ¯å®é
åºï¼ |
| | | - â
æ ¡éªä¸æ¶ç®æ åºä½çæ··æ¾è§å |
| | | |
| | | ## ä¸å¡è§å说æ |
| | | |
| | | | åºæ¯ | è§å | |
| | | |------|------| |
| | | | éæåºåº | ä»èæçº¿è¾¹åºæ£åï¼checkFlag=falseï¼å
许è´åºåï¼ | |
| | | | éæå
¥åº | å
¥å°ç¨æ·éæ©çå®é
ä»åºåºä½ | |
| | | | é»è®¤ä¸æ¶åºä½ | 建议é»è®¤å¡«å
¥é¢æåºåºæ¶çåå§ä»åºåºä½ | |
| | | | ä»åºè¿æ»¤ | 䏿¶ç®æ ä»åºä¸æåºæé¤èæçº¿è¾¹ä»åº | |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - å端已åå
¼å®¹ï¼å¦æåç«¯ææ¶ä¸æ¹ï¼æ§æ°æ®ï¼warehouseId=èæåºï¼ä»è½éè¿äºå¡æµæ°´åæ¥åå§ä»åºï¼ä¸ä¼æ¥é |
| | | - å端æ¹å®åï¼æ°çéæå detail åºä¼ å®é
ä»åºçåºä½ï¼é»è¾æ´æ¸
æ° |
| | | - å·²åå¨çæ§éææ°æ®ä¸åå½±åï¼åæ¥å
åºï¼ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # å·¥èºè·¯çº¿å·¥åº - 产åºäº§ååæ®µ - å端èè°æ¹æ¡ |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - å·¥èºè·¯çº¿ - å·¥åºé
ç½®é¡µï¼æ°å¢/ç¼è¾å·¥åºæ¶éæ©äº§åºäº§åï¼ |
| | | - æäº§ - 任塿°å¢é¡µï¼èªå¨å¸¦å
¥äº§åºäº§åï¼ |
| | | - BOM é
置页ï¼å·¥åºäº§åºäº§ååæ´åï¼BOM ç产ååæ®µèå¨ï¼ |
| | | |
| | | ## ä¸å¡èæ¯ |
| | | |
| | | **é®é¢**ï¼å½åææå·¥åºç产åºé½æ¯æç»æåï¼æ æ³åºåä¸é´å·¥åºçåæå产åºãä¾å¦ï¼ |
| | | - å·¥åº1ï¼æä¸ â 产åº"éæ"ï¼åæåï¼ï¼ä¸æ¯"é¢è¯éç»çº¿" |
| | | - å·¥åº2ï¼ç»çº¿ â 产åº"é¢è¯éç»çº¿"ï¼æç»æåï¼ |
| | | |
| | | **è§£å³**ï¼å·¥èºè·¯çº¿å·¥åºæ°å¢"产åºäº§å"åæ®µï¼æäº§æ¶èªå¨å¸¦å
¥ä»»å¡çç©æã |
| | | |
| | | ## ä¸å¡æµç¨ä¸æ°æ®å¸¦å
¥ |
| | | |
| | | 1. **å·¥èºè·¯çº¿é
ç½®** â æ¯éå·¥åºéæ©äº§åºäº§åï¼åæå/æåï¼ |
| | | 2. **æäº§** â 鿩工åºåï¼èªå¨ä»å·¥åºå¸¦åº `outputItemId` ä½ä¸ºä»»å¡ç `itemId` |
| | | 3. **æ¥å·¥äº§åº** â ä»ä»»å¡åä½ `itemId`ï¼å¯è½æ¯åæåï¼ï¼äº§åºåååºåèªå¨æ£ç¡® |
| | | 4. **å岿£æ** â BOM æ¥è¯¢æå·¥åº+产åºäº§åå¹é
ï¼èªå¨æ£ç¡® |
| | | |
| | | ## API |
| | | |
| | | ### å·¥åºä¿åæ¥å£ï¼åæ´ï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pro/route-process/create | åå»ºå·¥åº | |
| | | | PUT | /mes/pro/route-process/update | æ´æ°å·¥åº | |
| | | |
| | | **请æ±åæ°æ°å¢ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | outputItemId | Long | å¦ | 产åºäº§åç©æç¼å·ï¼ä¸ºç©ºæ¶é»è®¤ç¨å·¥åæåï¼ | |
| | | |
| | | **请æ±ç¤ºä¾ï¼æ°å¢å段ï¼ï¼** |
| | | |
| | | ```json |
| | | { |
| | | "routeId": 7, |
| | | "processId": 10, |
| | | "sort": 1, |
| | | "keyFlag": false, |
| | | "checkFlag": false, |
| | | "backflushFlag": true, |
| | | "outputItemId": 31 |
| | | } |
| | | ``` |
| | | |
| | | ### å·¥åºæ¥è¯¢æ¥å£ï¼åæ´ï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | GET | /mes/pro/route-process/list-by-route | æå·¥èºè·¯çº¿æ¥å·¥åºå表 | |
| | | | GET | /mes/pro/route-process/get-by-route-and-process | æè·¯çº¿+å·¥åºæ¥é
ç½® | |
| | | | GET | /mes/pro/route-process/get | è·ååä¸ªå·¥åº | |
| | | |
| | | **ååºå段æ°å¢ï¼** |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | outputItemId | Long | 产åºäº§åç©æç¼å· | |
| | | | outputItemCode | String | 产åºäº§åç©æç¼ç | |
| | | | outputItemName | String | 产åºäº§åç©æåç§° | |
| | | |
| | | **ååºç¤ºä¾ï¼æ°å¢å段ï¼ï¼** |
| | | |
| | | ```json |
| | | { |
| | | "code": 0, |
| | | "data": { |
| | | "id": 1, |
| | | "routeId": 7, |
| | | "processId": 10, |
| | | "processCode": "PROC_001", |
| | | "processName": "æä¸", |
| | | "sort": 1, |
| | | "keyFlag": false, |
| | | "checkFlag": false, |
| | | "backflushFlag": true, |
| | | "outputItemId": 31, |
| | | "outputItemCode": "ITEM_20260716004", |
| | | "outputItemName": "éæ" |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ## åæ®µå±ç¤ºè§å |
| | | |
| | | | åæ®µ | å±ç¤ºä½ç½® | 说æ | |
| | | |------|----------|------| |
| | | | outputItemId | å·¥åºé
置表å | ç©æéæ©å¨ï¼å¯éåæåææå | |
| | | | outputItemCode | å·¥åºå表ãå·¥åºè¯¦æ
| åªè¯»å±ç¤º | |
| | | | outputItemName | å·¥åºå表ãå·¥åºè¯¦æ
| åªè¯»å±ç¤º | |
| | | |
| | | ## å端修æ¹ç¹ |
| | | |
| | | ### 1. å·¥èºè·¯çº¿ - å·¥åºé
ç½® |
| | | |
| | | å¨"æ¯å¦åå²"å¼å
³ä¹åï¼æ°å¢"产åºäº§å"éæ©å¨ï¼ |
| | | |
| | | - 使ç¨ç©æéæ©ç»ä»¶ï¼çéèå´ä¸å·¥å产åéæ©å¨ä¸è´ |
| | | - éæåå·¥åºï¼éæ©è¯¥å·¥åºäº§åºçåæå |
| | | - æåä¸éå·¥åºï¼å¯ç空ï¼é»è®¤ä¸ºå·¥åæåï¼ï¼ä¹å¯æ¾å¼éæ©æç»æå |
| | | - ä¿åæ¶å° `outputItemId` æäº¤å°å端 |
| | | |
| | | ### 2. æäº§ - 任塿°å¢ |
| | | |
| | | - å½ç¨æ·éæ©å·¥å + å·¥èºè·¯çº¿ + å·¥åºåï¼è°ç¨ `/mes/pro/route-process/get-by-route-and-process` è·åå·¥åºé
ç½® |
| | | - 妿工åºé
ç½®äº `outputItemId`ï¼èªå¨å¡«å
¥ä»»å¡çç©æåæ®µï¼å±ç¤º `outputItemName`ï¼ |
| | | - å¦æå·¥åºæªé
ç½® `outputItemId`ï¼èªå¨åéå·¥åçæå |
| | | - ç¨æ·å¯ä»¥æå¨ä¿®æ¹ä»»å¡çç©æï¼è¦çèªå¨å¡«å
¥å¼ï¼ |
| | | |
| | | ### 3. BOM é
ç½® |
| | | |
| | | å½å·¥åºé
ç½®äº `outputItemId` åï¼ |
| | | - 该工åºç BOM è®°å½ç"产å"åæ®µåºèªå¨å
³èå° `outputItemId` |
| | | - å³ BOM 表 `mes_pro_route_product_bom.product_id` åºä¸å·¥åºç `outputItemId` ä¸è´ |
| | | - **注æ**ï¼ç°æ BOM æ°æ®ç `product_id` å
¨é¨æ¯æç»æå IDï¼é
置工åºäº§åºäº§ååééæ°è°æ´ BOM |
| | | |
| | | ### 4. å·¥åºå表å±ç¤º |
| | | |
| | | å·¥åºåè¡¨ä¸æ°å¢"产åºäº§å"åï¼å±ç¤º `outputItemName`ï¼æªé
ç½®æ¶æ¾ç¤º"é»è®¤ï¼å·¥åæåï¼"ã |
| | | |
| | | ## ä¸å¡è§å说æ |
| | | |
| | | | åºæ¯ | è§å | |
| | | |------|------| |
| | | | outputItemId 为空 | æäº§æ¶ä»»å¡ç itemId é»è®¤ç¨å·¥åç productIdï¼ååå
¼å®¹ï¼ | |
| | | | outputItemId ä¸ä¸ºç©º | æäº§æ¶ä»»å¡ç itemId èªå¨ç¨å·¥åºç outputItemId | |
| | | | æåä¸éå·¥åº | 建议ä¸å¡« outputItemIdï¼æå¡«æç»æåï¼ææä¸æ · | |
| | | | éæåå·¥åº | 建议填ååæåï¼è¿æ ·æ¥å·¥äº§åºæ¶å
¥çº¿è¾¹åºçæ¯åæå | |
| | | | å端æ¾å¼ä¼ itemId | å端ä¼å
使ç¨åç«¯ä¼ å
¥å¼ï¼ååå
¼å®¹ç°ææäº§é»è¾ï¼ | |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - ç°æå·¥èºæ¯çº¿æ°æ®ä¸éè¦è¿ç§»ï¼`outputItemId` 为空æ¶è¡ä¸ºä¸ä¹åå®å
¨ä¸è´ |
| | | - é
ç½®äº `outputItemId` åï¼éåæ¥è°æ´è¯¥å·¥åºç BOM é
ç½®ï¼`product_id` æ¹ä¸ºåæå IDï¼ |
| | | - åæå产åºåä¼å
¥çº¿è¾¹åºï¼WIPï¼ï¼ä¸ä¸éå·¥åºæ¶èæ¶éè¿ BOM å岿æå·¥æææ£å |
| | | - æ¥å·¥é¡µé¢ç"产åç©æ"åæ®µå¯è½æ¾ç¤ºåæåï¼è¿æ¯æ£ç¡®çï¼ä¸è¦è¯¯ä»¥ä¸ºæ¯æ°æ®é误 |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ============================================= |
| | | -- 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.mps.MesProMpsApi; |
| | | 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; |
| | | @Resource |
| | | private MesProMpsApi mpsApi; |
| | | |
| | | @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)); |
| | | // 1.6 æ£æ¥æ¯å¦å¯ä»¥çæåè´§éç¥åï¼éè¦ç产çæç»å¯¹åºç MPS æ¯å¦å·²å®æï¼ |
| | | // çéåºéè¦ç产çæç»ID |
| | | List<Long> needProductionItemIds = saleOrderItemList.stream() |
| | | .filter(item -> item.getNeedProduction() != null && item.getNeedProduction() == 1) |
| | | .map(ErpSaleOrderItemDO::getId) |
| | | .toList(); |
| | | Map<Long, Boolean> canCreateSalesNoticeMap = new java.util.HashMap<>(); |
| | | if (!needProductionItemIds.isEmpty()) { |
| | | // æè®¢ååç»æç»ID |
| | | Map<Long, List<Long>> orderItemIdsMap = new java.util.HashMap<>(); |
| | | for (ErpSaleOrderItemDO item : saleOrderItemList) { |
| | | orderItemIdsMap.computeIfAbsent(item.getOrderId(), k -> new java.util.ArrayList<>()) |
| | | .add(item.getId()); |
| | | } |
| | | // æ£æ¥æ¯ä¸ªè®¢å |
| | | for (Map.Entry<Long, List<Long>> entry : orderItemIdsMap.entrySet()) { |
| | | List<Long> itemIds = entry.getValue().stream() |
| | | .filter(id -> { |
| | | ErpSaleOrderItemDO item = saleOrderItemList.stream() |
| | | .filter(i -> i.getId().equals(id)) |
| | | .findFirst().orElse(null); |
| | | return item != null && item.getNeedProduction() != null && item.getNeedProduction() == 1; |
| | | } |
| | | ).toList(); |
| | | if (itemIds.isEmpty()) { |
| | | canCreateSalesNoticeMap.put(entry.getKey(), true); |
| | | } else { |
| | | canCreateSalesNoticeMap.put(entry.getKey(), mpsApi.checkCanCreateSalesNotice(itemIds)); |
| | | } |
| | | } |
| | | } else { |
| | | // 没æéè¦ç产çæç»ï¼é½å¯ä»¥çæåè´§éç¥å |
| | | pageResult.getList().forEach(order -> canCreateSalesNoticeMap.put(order.getId(), true)); |
| | | } |
| | | // 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)); |
| | | // 设置æ¯å¦å¯ä»¥çæåè´§éç¥å |
| | | saleOrder.setCanCreateSalesNotice(canCreateSalesNoticeMap.getOrDefault(saleOrder.getId(), true)); |
| | | // 设置æ¯å¦æéè¦ç产çæç» |
| | | boolean hasNeedProduction = saleOrder.getItems().stream() |
| | | .anyMatch(item -> item.getNeedProduction() != null && item.getNeedProduction() == 1); |
| | | saleOrder.setNeedProduction(hasNeedProduction ? 1 : 0); |
| | | }); |
| | | } |
| | | |
| | |
| | | @Schema(description = "åºåºç¶æ", example = "0") |
| | | private Integer outStatus; |
| | | |
| | | // ========== åè´§éç¥ ========== |
| | | |
| | | @Schema(description = "æ¯å¦å·²çæåè´§éç¥å", example = "false") |
| | | private Boolean hasSalesNotice; |
| | | |
| | | @Schema(description = "æ¯å¦å¯ä»¥çæåè´§éç¥åï¼æéè¦çäº§ä¸æªå®æçæç»æ¶ä¸º falseï¼", example = "true") |
| | | private Boolean canCreateSalesNotice; |
| | | |
| | | @Schema(description = "æ¯å¦æéè¦ç产çæç»ï¼0=å¦ 1=æ¯ï¼", example = "1") |
| | | private Integer needProduction; |
| | | |
| | | @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)); |
| | |
| | | package cn.iocoder.yudao.module.erp.service.purchase; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | |
| | | |
| | | @Override |
| | | public List<ErpSupplierDO> getSupplierList(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return CollUtil.newArrayList(); |
| | | } |
| | | return supplierMapper.selectByIds(ids); |
| | | } |
| | | |
| | |
| | | import cn.iocoder.yudao.module.erp.enums.ErpAuditStatus; |
| | | import cn.iocoder.yudao.module.erp.api.sale.enums.ErpSaleOrderOutStatusEnum; |
| | | import cn.iocoder.yudao.module.erp.service.finance.ErpAccountService; |
| | | 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 cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | 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; |
| | |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class ErpSaleOrderServiceImpl implements ErpSaleOrderService { |
| | | |
| | | @Resource |
| | |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | | @Resource |
| | | private MesProMpsApi mpsApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | if (updateCount == 0) { |
| | | throw exception(approve ? SALE_ORDER_APPROVE_FAIL : SALE_ORDER_PROCESS_FAIL); |
| | | } |
| | | |
| | | // 3. å®¡æ ¸éè¿æ¶ï¼ä¸ºéè¦ç产çæç»å建 MPS |
| | | if (approve) { |
| | | createMpsForSaleOrder(id, saleOrder); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 为éå®è®¢åä¸éè¦ç产çæç»å建 MPS |
| | | * |
| | | * @param orderId éå®è®¢åç¼å· |
| | | * @param saleOrder éå®è®¢å |
| | | */ |
| | | private void createMpsForSaleOrder(Long orderId, ErpSaleOrderDO saleOrder) { |
| | | List<ErpSaleOrderItemDO> items = saleOrderItemMapper.selectListByOrderId(orderId); |
| | | if (CollUtil.isEmpty(items)) { |
| | | return; |
| | | } |
| | | |
| | | 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("[createMpsForSaleOrder] å建 MPS 失败ï¼saleOrderItemId={}", item.getId(), e); |
| | | } |
| | | } |
| | | log.info("[createMpsForSaleOrder] éå®è®¢å({}) å®¡æ ¸å®æï¼å建 MPS {} æ¡", orderId, mpsCount); |
| | | } |
| | | |
| | | /** |
| | | * 为éå®è®¢åæç»å建 MPS |
| | | */ |
| | | 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()); |
| | | 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")); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @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.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); |
| | | |
| | | /** |
| | | * æ£æ¥éå®è®¢åæ¯å¦å¯ä»¥çæåè´§éç¥å |
| | | * |
| | | * è§åï¼å¦ææéè¦ç产çæç»ï¼å¯¹åºç MPS å¿
须已宿ï¼status=2ï¼æå·²åæ¶ï¼status=3ï¼ |
| | | * |
| | | * @param saleOrderItemIds éå®è®¢åæç»IDå表 |
| | | * @return true=å¯ä»¥çæåè´§éç¥åï¼false=ä¸å¯ä»¥ |
| | | */ |
| | | Boolean checkCanCreateSalesNotice(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.hutool.core.collection.CollUtil; |
| | | 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.enums.pro.MesProMpsStatusEnum; |
| | | 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; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 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); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkCanCreateSalesNotice(List<Long> saleOrderItemIds) { |
| | | if (CollUtil.isEmpty(saleOrderItemIds)) { |
| | | return true; |
| | | } |
| | | List<MesProMpsDO> mpsList = mpsService.getMpsListBySaleOrderItemIds(saleOrderItemIds); |
| | | // æå»º saleOrderItemId -> MPS çæ å° |
| | | Map<Long, MesProMpsDO> mpsMap = new java.util.HashMap<>(); |
| | | for (MesProMpsDO mps : mpsList) { |
| | | if (mps.getSaleOrderItemId() != null) { |
| | | mpsMap.put(mps.getSaleOrderItemId(), mps); |
| | | } |
| | | } |
| | | // æ£æ¥æ¯ä¸ªéå®è®¢åæç»ï¼ |
| | | // - 妿 MPS ä¸åå¨ï¼ä¸è½çæåè´§éç¥å |
| | | // - 妿 MPS åå¨ä¸ç¶æä¸ºè稿/å·²ä¸åï¼ä¸è½çæåè´§éç¥å |
| | | // - 妿 MPS åå¨ä¸ç¶æä¸ºå·²å®æ/已忶ï¼å¯ä»¥çæåè´§éç¥å |
| | | for (Long itemId : saleOrderItemIds) { |
| | | MesProMpsDO mps = mpsMap.get(itemId); |
| | | if (mps == null) { |
| | | // MPS ä¸åå¨ï¼ä¸è½çæåè´§éç¥å |
| | | return false; |
| | | } |
| | | if (mps.getStatus().equals(MesProMpsStatusEnum.DRAFT.getStatus()) |
| | | || mps.getStatus().equals(MesProMpsStatusEnum.ISSUED.getStatus())) { |
| | | // MPS æªå®æï¼ä¸è½çæåè´§éç¥å |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.route.vo.process.MesProRouteProcessRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.route.vo.process.MesProRouteProcessSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.process.MesProProcessDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProcessDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.route.MesProRouteProcessService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | private MesProRouteProcessService routeProcessService; |
| | | @Resource |
| | | private MesProProcessService processService; |
| | | @Resource |
| | | private MesMdItemService mdItemService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建工èºè·¯çº¿å·¥åº") |
| | |
| | | list.forEach(item -> { if (item.getNextProcessId() != null) processIds.add(item.getNextProcessId()); }); |
| | | Map<Long, MesProProcessDO> processMap = convertMap( |
| | | processService.getProcessList(new ArrayList<>(processIds)), MesProProcessDO::getId); |
| | | // 2. æ¼æ¥ VO |
| | | // 2. æ¹éè·å产åºäº§åç©æä¿¡æ¯ |
| | | Set<Long> outputItemIds = convertSet(list, MesProRouteProcessDO::getOutputItemId); |
| | | outputItemIds.remove(null); |
| | | Map<Long, MesMdItemDO> outputItemMap = outputItemIds.isEmpty() |
| | | ? Collections.emptyMap() |
| | | : mdItemService.getItemMap(outputItemIds); |
| | | // 3. æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, MesProRouteProcessRespVO.class, vo -> { |
| | | MapUtils.findAndThen(processMap, vo.getProcessId(), |
| | | process -> vo.setProcessCode(process.getCode()).setProcessName(process.getName())); |
| | | MapUtils.findAndThen(processMap, vo.getNextProcessId(), |
| | | nextProcess -> vo.setNextProcessName(nextProcess.getName())); |
| | | MapUtils.findAndThen(outputItemMap, vo.getOutputItemId(), |
| | | item -> vo.setOutputItemCode(item.getCode()).setOutputItemName(item.getName())); |
| | | }); |
| | | } |
| | | |
| | |
| | | @Schema(description = "æ¯å¦åå²ï¼true=æ¥å·¥æ¶æBOMèªå¨æ£æï¼false=ä¸èªå¨æ£æï¼", example = "true") |
| | | private Boolean backflushFlag; |
| | | |
| | | @Schema(description = "产åºäº§åç©æç¼å·", example = "100") |
| | | private Long outputItemId; |
| | | |
| | | @Schema(description = "产åºäº§åç©æç¼ç ") |
| | | private String outputItemCode; |
| | | |
| | | @Schema(description = "产åºäº§åç©æåç§°") |
| | | private String outputItemName; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | |
| | | @Schema(description = "æ¯å¦åå²ï¼true=æ¥å·¥æ¶æBOMèªå¨æ£æï¼false=ä¸èªå¨æ£æï¼", example = "true") |
| | | private Boolean backflushFlag; |
| | | |
| | | @Schema(description = "产åºäº§åç©æç¼å·ï¼ä¸ºç©ºæ¶é»è®¤ç¨å·¥åæåï¼", example = "100") |
| | | private Long outputItemId; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | 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.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.mdm.MesMdmItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.template.MesQcTemplateItemDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.template.MesQcTemplateItemService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | @Resource |
| | | private MesQcTemplateItemService templateItemService; |
| | | @Resource |
| | | private MesMdItemService mdItemService; |
| | | private MesMdmItemService mdmItemService; |
| | | @Resource |
| | | private MesMdUnitMeasureService unitMeasureService; |
| | | |
| | |
| | | if (list.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // æ¹éæ¥è¯¢ç©æ |
| | | Map<Long, MesMdItemDO> itemMap = mdItemService.getItemMap( |
| | | // æ¹éæ¥è¯¢ç©æï¼itemId åçæ¯ mdm_item_idï¼å
³è mdm_item è¡¨ï¼ |
| | | Map<Long, MesMdmItemDO> itemMap = mdmItemService.getItemMap( |
| | | convertSet(list, MesQcTemplateItemDO::getItemId)); |
| | | // æ¹éæ¥è¯¢è®¡éåä½ |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| | | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| | | convertSet(itemMap.values(), MesMdmItemDO::getUnitMeasureId)); |
| | | // æ¼è£
VO |
| | | return BeanUtils.toBean(list, MesQcTemplateItemRespVO.class, vo -> { |
| | | findAndThen(itemMap, vo.getItemId(), item -> { |
| | |
| | | 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.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLinePageVO; |
| | | 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.pro.task.MesProTaskService; |
| | |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") |
| | | public CommonResult<PageResult<MesWmReturnIssueLineRespVO>> getReturnIssueLinePage( |
| | | @Valid MesWmReturnIssueLinePageReqVO pageReqVO) { |
| | | PageResult<MesWmReturnIssueLineDO> pageResult = issueLineService.getReturnIssueLinePage(pageReqVO); |
| | | return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | PageResult<MesWmReturnIssueLinePageVO> pageResult = issueLineService.getReturnIssueLinePage(pageReqVO); |
| | | return success(new PageResult<>(buildRespVOListFromPageVO(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/list-by-issue") |
| | |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ç»ææå»º RespVOï¼SQL å·²å
³è mdm_itemï¼code/name/specification ç´æ¥ä» PageVO åï¼ |
| | | */ |
| | | private List<MesWmReturnIssueLineRespVO> buildRespVOListFromPageVO(List<MesWmReturnIssueLinePageVO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. è·å¾å
³èæ°æ®ï¼è®¡éåä½ãç产任å¡ï¼ |
| | | Map<Long, MesMdItemDO> itemMap = mdmItemService.getItemMap( |
| | | convertSet(list, MesWmReturnIssueLinePageVO::getItemId)); |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| | | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| | | Map<Long, MesProTaskDO> taskMap = taskService.getTaskMap( |
| | | convertSet(list, MesWmReturnIssueLinePageVO::getTaskId)); |
| | | // 2. æå»ºç»æ |
| | | return BeanUtils.toBean(list, MesWmReturnIssueLineRespVO.class, vo -> { |
| | | // code/name/specification ä» PageVO ç´æ¥æ å°ï¼å段åä¸åéæå¨èµå¼ï¼ |
| | | list.stream() |
| | | .filter(v -> java.util.Objects.equals(v.getId(), vo.getId())) |
| | | .findFirst() |
| | | .ifPresent(pageVO -> { |
| | | vo.setItemCode(pageVO.getCode()); |
| | | vo.setItemName(pageVO.getName()); |
| | | vo.setSpecification(pageVO.getSpecification()); |
| | | }); |
| | | // 计éåä½ä»éä» itemMap è·å |
| | | MapUtils.findAndThen(itemMap, vo.getItemId(), item -> |
| | | MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), |
| | | unit -> vo.setUnitMeasureName(unit.getName()))); |
| | | MapUtils.findAndThen(taskMap, vo.getTaskId(), task -> |
| | | vo.setTaskCode(task.getCode()).setTaskName(task.getName())); |
| | | }); |
| | | } |
| | | |
| | | private List<MesWmReturnIssueLineRespVO> buildRespVOList(List<MesWmReturnIssueLineDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | |
| | | @NotBlank(message = "éæååç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "çäº§ä»»å¡ ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "çäº§ä»»å¡ ID ä¸è½ä¸ºç©º") |
| | | @Schema(description = "çäº§ä»»å¡ IDï¼éå¿
å¡«ï¼ä¸å
³è任塿¶ä¼ 空ï¼", example = "1") |
| | | private Long taskId; |
| | | |
| | | @Schema(description = "ç产工å ID", example = "1") |
| | |
| | | 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; |
| | | |
| | | } |
| | |
| | | */ |
| | | private Boolean backflushFlag; |
| | | /** |
| | | * 产åºäº§åç©æç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO#getId()} |
| | | * 为空æ¶é»è®¤ç¨å·¥åçæå |
| | | */ |
| | | private Long outputItemId; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | 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.returnissue; |
| | | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES ç产éæåè¡ å页æ¥è¯¢ VOï¼å
³è mdm_item ç code/name/specificationï¼ |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesWmReturnIssueLinePageVO extends MesWmReturnIssueLineDO { |
| | | |
| | | /** |
| | | * ç©æç¼ç |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.mdm.MesMdmItemDO#getCode()} |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * ç©æåç§° |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.mdm.MesMdmItemDO#getName()} |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * è§æ ¼åå· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.mdm.MesMdmItemDO#getSpecification()} |
| | | */ |
| | | private String specification; |
| | | |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | |
| | | 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.returnissue.vo.line.MesWmReturnIssueLinePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLinePageVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @Mapper |
| | | public interface MesWmReturnIssueLineMapper extends BaseMapperX<MesWmReturnIssueLineDO> { |
| | | |
| | | default PageResult<MesWmReturnIssueLineDO> selectPage(MesWmReturnIssueLinePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesWmReturnIssueLineDO>() |
| | | .eqIfPresent(MesWmReturnIssueLineDO::getIssueId, reqVO.getIssueId()) |
| | | .orderByDesc(MesWmReturnIssueLineDO::getId)); |
| | | IPage<MesWmReturnIssueLinePageVO> selectPageByReqVO(Page<MesWmReturnIssueLinePageVO> page, |
| | | @Param("reqVO") MesWmReturnIssueLinePageReqVO reqVO); |
| | | |
| | | default PageResult<MesWmReturnIssueLinePageVO> selectPage(MesWmReturnIssueLinePageReqVO reqVO) { |
| | | Page<MesWmReturnIssueLinePageVO> mpPage = new Page<>(reqVO.getPageNo(), reqVO.getPageSize()); |
| | | IPage<MesWmReturnIssueLinePageVO> result = selectPageByReqVO(mpPage, reqVO); |
| | | return new PageResult<>(result.getRecords(), result.getTotal()); |
| | | } |
| | | |
| | | default List<MesWmReturnIssueLineDO> selectListByIssueId(Long issueId) { |
| | |
| | | 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)); |
| | | } |
| | | |
| | | } |
| | |
| | | .orderByDesc(MesWmTransactionDO::getTransactionTime)); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾èæçº¿è¾¹åºåºåè®°å½å¯¹åºçåå§åºåºä»åºä¿¡æ¯ |
| | | * <p> |
| | | * éè¿èæçº¿è¾¹åºç materialStockIdï¼æ¾å°é¦æ¬¡å
¥åºäºå¡ï¼INï¼ï¼ |
| | | * åéè¿ relatedTransactionId æ¾å°å
³èçåºåºäºå¡ï¼OUTï¼ï¼ |
| | | * è·åç©æä»åªä¸ªå®é
ä»åºåºåºè¿å
¥èæçº¿è¾¹åºçã |
| | | * |
| | | * @param materialStockId èæçº¿è¾¹åºåºåè®°å½ ID |
| | | * @return åå§åºåºäºå¡ï¼å
å« warehouseId/locationId/areaIdï¼ï¼ä¸åå¨è¿å null |
| | | */ |
| | | default MesWmTransactionDO selectOriginalOutTransaction(Long materialStockId) { |
| | | // 1. æ¾å°è¯¥åºåè®°å½ç馿¬¡å
¥åºäºå¡ |
| | | MesWmTransactionDO firstInTransaction = selectOne(new LambdaQueryWrapperX<MesWmTransactionDO>() |
| | | .eq(MesWmTransactionDO::getMaterialStockId, materialStockId) |
| | | .eq(MesWmTransactionDO::getType, 1) // IN |
| | | .orderByAsc(MesWmTransactionDO::getId) |
| | | .last("LIMIT 1")); |
| | | if (firstInTransaction == null || firstInTransaction.getRelatedTransactionId() == null) { |
| | | return null; |
| | | } |
| | | // 2. éè¿ relatedTransactionId æ¾å°åå§åºåºäºå¡ |
| | | return selectById(firstInTransaction.getRelatedTransactionId()); |
| | | } |
| | | |
| | | } |
| | |
| | | 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.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProcessDO; |
| | | import cn.iocoder.yudao.module.mes.service.pro.route.MesProRouteProcessService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.route.MesProRouteService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import jakarta.annotation.Resource; |
| | |
| | | @Resource |
| | | private MesProRouteService routeService; |
| | | @Resource |
| | | @Lazy |
| | | private MesProRouteProcessService routeProcessService; |
| | | @Resource |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | |
| | | @Override |
| | |
| | | workstationService.validateWorkstationExists(createReqVO.getWorkstationId()); |
| | | routeService.validateRouteExists(createReqVO.getRouteId()); |
| | | processService.validateProcessExistsAndEnable(createReqVO.getProcessId()); |
| | | MesMdItemDO item = itemService.validateItemExists(createReqVO.getItemId()); |
| | | |
| | | // 2.1 æå»ºä»»å¡ DOï¼èªå¨å¡«å
客æ·ä¿¡æ¯ |
| | | // 2. èªå¨ç¡®å® itemIdï¼ä¼å
åç«¯ä¼ å
¥ â å·¥èºè·¯çº¿å·¥åºç产åºäº§å â å·¥åæå |
| | | Long itemId = createReqVO.getItemId(); |
| | | if (itemId == null) { |
| | | MesProRouteProcessDO routeProcess = routeProcessService |
| | | .getRouteProcessByRouteIdAndProcessId(createReqVO.getRouteId(), createReqVO.getProcessId()); |
| | | if (routeProcess != null && routeProcess.getOutputItemId() != null) { |
| | | itemId = routeProcess.getOutputItemId(); |
| | | } else { |
| | | itemId = workOrder.getProductId(); |
| | | } |
| | | } |
| | | MesMdItemDO item = itemService.validateItemExists(itemId); |
| | | |
| | | // 3.1 æå»ºä»»å¡ DOï¼èªå¨å¡«å
客æ·ä¿¡æ¯ |
| | | MesProTaskDO task = BeanUtils.toBean(createReqVO, MesProTaskDO.class) |
| | | .setItemId(itemId) // ç¡®ä¿ä½¿ç¨è®¡ç®åç itemId |
| | | .setName(buildTaskName(item, createReqVO.getQuantity())) |
| | | .setCode(autoCodeRecordService.generateAutoCode(MesMdAutoCodeRuleCodeEnum.PRO_TASK_CODE.getCode())) |
| | | .setStatus(MesProTaskStatusEnum.PREPARE.getStatus()); |
| | |
| | | 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.qc.template.MesQcTemplateItemService; |
| | |
| | | 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 |
| | | private MesWmProductSalesLineService productSalesLineService; |
| | | @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()); |
| | | itemService.validateItemExists(reqVO.getItemId()); |
| | | // æ ¡éªç©æãæ£æµäººååå¨ |
| | | // 注ï¼ç©æ ID æ¥èª MDMï¼å®¢æ· ID æ¥èª CRM |
| | | mdmItemApi.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.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.template.vo.item.MesQcTemplateItemSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.template.MesQcTemplateDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.template.MesQcTemplateItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.qc.template.MesQcTemplateItemMapper; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | @Lazy |
| | | private MesQcTemplateService templateService; |
| | | @Resource |
| | | private MesMdItemService mesMdItemService; |
| | | |
| | | @Override |
| | | public Long createTemplateItem(MesQcTemplateItemSaveReqVO createReqVO) { |
| | |
| | | @Override |
| | | public MesQcTemplateItemDO getRequiredTemplateByItemIdAndType(Long itemId, Integer qcType) { |
| | | // 1. æ¥åº itemId å
³èçææ templateItem |
| | | List<MesQcTemplateItemDO> templateItems = templateItemMapper.selectListByItemId(itemId); |
| | | MesMdItemDO item1 = mesMdItemService.getItem(itemId); |
| | | List<MesQcTemplateItemDO> templateItems = templateItemMapper.selectListByItemId(item1.getMdmItemId()); |
| | | if (CollUtil.isEmpty(templateItems)) { |
| | | throw exception(QC_NO_TEMPLATE); |
| | | } |
| | |
| | | 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.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockListReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.mdm.MesMdmItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProductBomDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.itemconsume.MesWmItemConsumeDO; |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmItemConsumeStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.route.MesProRouteProductBomService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.route.MesProRouteService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| | |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseLocationService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | |
| | | private MesWmWarehouseAreaService areaService; |
| | | @Resource |
| | | private MesWmMaterialStockService materialStockService; |
| | | @Autowired |
| | | private MesMdItemService mesMdItemService; |
| | | |
| | | @Override |
| | | public MesWmItemConsumeDO generateItemConsume(MesProFeedbackDO feedback) { |
| | |
| | | |
| | | // 2. éåæç»ï¼å建åºåäºå¡ï¼ææ¹æ¬¡ç²¾ç¡®æ£å线边åºï¼ |
| | | for (MesWmItemConsumeDetailDO detail : details) { |
| | | MesMdItemDO item = mesMdItemService.getItem(detail.getItemId()); |
| | | wmTransactionService.createTransaction(new MesWmTransactionSaveReqDTO() |
| | | .setType(MesWmTransactionTypeEnum.OUT.getType()) |
| | | .setItemId(detail.getItemId()) |
| | | .setItemId(item.getMdmItemId()) |
| | | .setQuantity(detail.getQuantity().negate()) |
| | | .setBatchId(detail.getBatchId()).setBatchCode(detail.getBatchCode()) |
| | | .setWarehouseId(detail.getWarehouseId()) |
| | |
| | | Long batchId, String batchCode, Long vendorId, LocalDateTime receiptTime); |
| | | |
| | | /** |
| | | * æç»å鮿¥æ¾åºåè®°å½ï¼åªæ¥ä¸åå»ºï¼ |
| | | * |
| | | * @param itemId ç©æç¼å· |
| | | * @param warehouseId ä»åºç¼å· |
| | | * @param locationId åºåºç¼å· |
| | | * @param areaId åºä½ç¼å· |
| | | * @param batchId æ¹æ¬¡ç¼å· |
| | | * @param vendorId ä¾åºåç¼å· |
| | | * @return åºåè®°å½ï¼ä¸åå¨è¿å nullï¼ |
| | | */ |
| | | MesWmMaterialStockDO getMaterialStockByCompositeKey(Long itemId, Long warehouseId, Long locationId, Long areaId, |
| | | Long batchId, Long vendorId); |
| | | |
| | | /** |
| | | * æ´æ°åºåæ°é |
| | | * |
| | | * @param id åºåè®°å½ç¼å· |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockFreezeReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockListReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.mdm.MesMdmItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.materialstock.MesWmMaterialStockDO; |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.materialstock.MesWmMaterialStockMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemTypeService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.batch.MesWmBatchService; |
| | |
| | | |
| | | @Resource |
| | | private MesMdmItemService mdmItemService; |
| | | @Resource |
| | | private MesMdItemService mdItemService; |
| | | @Resource |
| | | private MesMdItemTypeService itemTypeService; |
| | | @Resource |
| | |
| | | List<MesMdItemTypeDO> children = itemTypeService.getItemTypeChildrenList(pageReqVO.getItemTypeId()); |
| | | itemTypeIds.addAll(convertSet(children, MesMdItemTypeDO::getId)); |
| | | } |
| | | // 1.2 è§£æ itemId |
| | | // 1.2 è§£æ itemIdï¼åç«¯ä¼ çæ¯ mes_md_item.idï¼åºå表åçæ¯ mdm_item_idï¼éè¦è½¬æ¢ |
| | | Set<Long> itemIds = null; |
| | | if (pageReqVO.getItemId() != null) { |
| | | itemIds = SetUtils.asSet(pageReqVO.getItemId()); |
| | | MesMdItemDO item = mdItemService.getItem(pageReqVO.getItemId()); |
| | | if (item != null && item.getMdmItemId() != null) { |
| | | itemIds = SetUtils.asSet(item.getMdmItemId()); |
| | | } |
| | | } |
| | | // 1.3 è§£æ virtualFilterï¼è½¬æ¢ä¸ºèæä» warehouseId |
| | | Long virtualWarehouseId = null; |
| | |
| | | .frozen(false) |
| | | .build(); |
| | | materialStockMapper.insert(newStock); |
| | | return newStock; |
| | | // 3. éæ°æ¥è¯¢ï¼ç¡®ä¿æ¿å°æ°æ®åºçæç宿´è®°å½ï¼idãcreateTime çï¼ |
| | | MesWmMaterialStockDO inserted = materialStockMapper.selectById(newStock.getId()); |
| | | return inserted != null ? inserted : newStock; |
| | | } |
| | | |
| | | @Override |
| | | public MesWmMaterialStockDO getMaterialStockByCompositeKey(Long itemId, Long warehouseId, Long locationId, Long areaId, |
| | | Long batchId, Long vendorId) { |
| | | return materialStockMapper.selectByCompositeKey(itemId, warehouseId, locationId, areaId, batchId, vendorId); |
| | | } |
| | | |
| | | @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.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.detail.MesWmProductIssueDetailSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productissue.MesWmProductIssueDetailDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productissue.MesWmProductIssueDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productissue.MesWmProductIssueLineDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.productissue.MesWmProductIssueDetailMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductIssueStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.mdm.MesMdmItemService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | private MesWmWarehouseAreaService warehouseAreaService; |
| | | @Resource |
| | | private MesWmMaterialStockService materialStockService; |
| | | @Resource |
| | | private MesMdItemService mesMdItemService; |
| | | |
| | | @Override |
| | | public Long createProductIssueDetail(MesWmProductIssueDetailSaveReqVO createReqVO) { |
| | |
| | | private void validateProductIssueDetailSaveData(MesWmProductIssueDetailSaveReqVO reqVO) { |
| | | // æ ¡éªç¶æ°æ®åå¨ |
| | | MesWmProductIssueLineDO line = issueLineService.validateProductIssueLineExists(reqVO.getLineId()); |
| | | MesMdItemDO item = mesMdItemService.getItem(line.getItemId()); |
| | | if (ObjUtil.notEqual(line.getIssueId(), reqVO.getIssueId())) { |
| | | throw exception(WM_PRODUCT_ISSUE_DETAIL_LINE_NOT_MATCH); |
| | | } |
| | |
| | | throw exception(WM_PRODUCT_ISSUE_STATUS_INVALID); |
| | | } |
| | | // æ ¡éªç©æå¹é
ï¼æç» itemId å¿
é¡»ä¸è¡ itemId ä¸è´ï¼ |
| | | validateDetailItemMatch(reqVO.getItemId(), line.getItemId()); |
| | | validateDetailItemMatch(reqVO.getItemId(), item.getMdmItemId()); |
| | | // æ ¡éªä»åºãåºåºãåºä½çå
³èå
³ç³» |
| | | warehouseAreaService.validateWarehouseAreaExists( |
| | | reqVO.getWarehouseId(), reqVO.getLocationId(), reqVO.getAreaId()); |
| | |
| | | Long outTransactionId = wmTransactionService.createTransaction(new MesWmTransactionSaveReqDTO() |
| | | .setType(MesWmTransactionTypeEnum.OUT.getType()).setItemId(detail.getItemId()) |
| | | .setQuantity(detail.getQuantity().negate()) // åºååå° |
| | | .setBatchId(detail.getBatchId()).setBatchCode(detail.getBatchCode()) |
| | | .setBatchId(detail.getBatchId()).setBatchCode(detail.getBatchCode()).setMaterialStockId(detail.getMaterialStockId()) |
| | | .setWarehouseId(detail.getWarehouseId()).setLocationId(detail.getLocationId()).setAreaId(detail.getAreaId()) |
| | | .setBizType(MesBizTypeConstants.WM_ISSUE).setBizId(issue.getId()) |
| | | .setBizCode(issue.getCode()).setBizLineId(detail.getLineId())); |
| | |
| | | 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.controller.admin.wm.returnissue.vo.detail.MesWmReturnIssueDetailSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDetailDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.materialstock.MesWmMaterialStockDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue.MesWmReturnIssueDetailMapper; |
| | | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; |
| | |
| | | if (ObjUtil.notEqual(line.getItemId(), reqVO.getItemId())) { |
| | | throw exception(WM_RETURN_ISSUE_DETAIL_ITEM_MISMATCH); |
| | | } |
| | | // æ ¡éªä»åºãåºåºãåºä½çå
³èå
³ç³» |
| | | // æ ¡éªä¸æ¶ç®æ ä»åºãåºåºãåºä½çå
³èå
³ç³» |
| | | warehouseAreaService.validateWarehouseAreaExists( |
| | | reqVO.getWarehouseId(), reqVO.getLocationId(), reqVO.getAreaId()); |
| | | // æ ¡éªåºä½ç©æ/æ¹æ¬¡æ··æ¾è§å |
| | | // æ ¡éªä¸æ¶ç®æ åºä½çç©æ/æ¹æ¬¡æ··æ¾è§å |
| | | materialStockService.checkAreaMixingRule(reqVO.getAreaId(), reqVO.getItemId(), reqVO.getBatchId()); |
| | | // æ ¡éªåºåè®°å½ |
| | | materialStockService.validateSelectedStock( |
| | | reqVO.getMaterialStockId(), reqVO.getItemId(), reqVO.getBatchId(), reqVO.getBatchCode(), |
| | | reqVO.getWarehouseId(), reqVO.getLocationId(), reqVO.getAreaId(), reqVO.getQuantity()); |
| | | // æ ¡éªæ¥æºåºåè®°å½ï¼materialStockId æåèæçº¿è¾¹åºï¼warehouseId æ¯ä¸æ¶ç®æ ä»åºï¼ä¸¤è
ä»åºä¸åæ¯æ£å¸¸çï¼ |
| | | if (reqVO.getMaterialStockId() != null) { |
| | | MesWmMaterialStockDO stock = materialStockService.getMaterialStock(reqVO.getMaterialStockId()); |
| | | if (stock == null) { |
| | | throw exception(WM_MATERIAL_STOCK_NOT_EXISTS); |
| | | } |
| | | // æ ¡éªç©æåæ¹æ¬¡ä¸è´ |
| | | if (ObjUtil.notEqual(stock.getItemId(), reqVO.getItemId())) { |
| | | throw exception(WM_MATERIAL_STOCK_SELECTION_MISMATCH); |
| | | } |
| | | // æ ¡éªåºåæ°éå
è¶³ |
| | | if (reqVO.getQuantity() != null && stock.getQuantity() != null |
| | | && stock.getQuantity().compareTo(reqVO.getQuantity()) < 0) { |
| | | throw exception(WM_MATERIAL_STOCK_INSUFFICIENT); |
| | | } |
| | | } |
| | | // æ ¡éªæç»æ»æ°éä¸è¶
è¿è¡æ°éï¼æé¤èªèº«ï¼ |
| | | validateDetailQuantityNotExceed(reqVO.getLineId(), reqVO.getQuantity(), reqVO.getId(), line); |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLinePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLineSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLinePageVO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return ç产éæåè¡å页 |
| | | */ |
| | | PageResult<MesWmReturnIssueLineDO> getReturnIssueLinePage(MesWmReturnIssueLinePageReqVO pageReqVO); |
| | | PageResult<MesWmReturnIssueLinePageVO> getReturnIssueLinePage(MesWmReturnIssueLinePageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * æ ¹æ®éæå ID è·åè¡å表 |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLineSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLinePageVO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue.MesWmReturnIssueLineMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmReturnIssueStatusEnum; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesWmReturnIssueLineDO> getReturnIssueLinePage(MesWmReturnIssueLinePageReqVO pageReqVO) { |
| | | public PageResult<MesWmReturnIssueLinePageVO> getReturnIssueLinePage(MesWmReturnIssueLinePageReqVO pageReqVO) { |
| | | return issueLineMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | |
| | | 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.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.transaction.MesWmTransactionDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.transaction.MesWmTransactionMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private MesWmWarehouseLocationService locationService; |
| | | @Resource |
| | | private MesWmWarehouseAreaService areaService; |
| | | @Resource |
| | | private MesWmTransactionMapper transactionMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | // 1. æ ¡éªå
³èæ°æ® |
| | | validateReturnIssueSaveData(createReqVO); |
| | | |
| | | // 2. ä» task èªå¨å¸¦å
¥ workOrderId å workstationId |
| | | MesProTaskDO task = taskService.validateTaskExists(createReqVO.getTaskId()); |
| | | if (createReqVO.getWorkOrderId() == null) { |
| | | createReqVO.setWorkOrderId(task.getWorkOrderId()); |
| | | } |
| | | if (createReqVO.getWorkstationId() == null) { |
| | | createReqVO.setWorkstationId(task.getWorkstationId()); |
| | | // 2. ä» task èªå¨å¸¦å
¥ workOrderId å workstationIdï¼taskId éå¿
å¡«ï¼ |
| | | if (createReqVO.getTaskId() != null) { |
| | | MesProTaskDO task = taskService.validateTaskExists(createReqVO.getTaskId()); |
| | | if (createReqVO.getWorkOrderId() == null) { |
| | | createReqVO.setWorkOrderId(task.getWorkOrderId()); |
| | | } |
| | | if (createReqVO.getWorkstationId() == null) { |
| | | createReqVO.setWorkstationId(task.getWorkstationId()); |
| | | } |
| | | } |
| | | |
| | | // 3. æå
¥ä¸»è¡¨ |
| | |
| | | // 1.2 æ ¡éªå
³èæ°æ® |
| | | validateReturnIssueSaveData(updateReqVO); |
| | | |
| | | // 2. ä» task èªå¨å¸¦å
¥ workOrderId å workstationId |
| | | MesProTaskDO task = taskService.validateTaskExists(updateReqVO.getTaskId()); |
| | | if (updateReqVO.getWorkOrderId() == null) { |
| | | updateReqVO.setWorkOrderId(task.getWorkOrderId()); |
| | | } |
| | | if (updateReqVO.getWorkstationId() == null) { |
| | | updateReqVO.setWorkstationId(task.getWorkstationId()); |
| | | // 2. ä» task èªå¨å¸¦å
¥ workOrderId å workstationIdï¼taskId éå¿
å¡«ï¼ |
| | | if (updateReqVO.getTaskId() != null) { |
| | | MesProTaskDO task = taskService.validateTaskExists(updateReqVO.getTaskId()); |
| | | if (updateReqVO.getWorkOrderId() == null) { |
| | | updateReqVO.setWorkOrderId(task.getWorkOrderId()); |
| | | } |
| | | if (updateReqVO.getWorkstationId() == null) { |
| | | updateReqVO.setWorkstationId(task.getWorkstationId()); |
| | | } |
| | | } |
| | | |
| | | // 3. æ´æ°ä¸»è¡¨ |
| | |
| | | MesWmWarehouseLocationDO virtualLocation = locationService.getWarehouseLocationByCode(MesWmWarehouseLocationDO.WIP_VIRTUAL_LOCATION); |
| | | MesWmWarehouseAreaDO virtualArea = areaService.getWarehouseAreaByCode(MesWmWarehouseAreaDO.WIP_VIRTUAL_AREA); |
| | | |
| | | // 2. éåæç»ï¼æ¯æ¡æç»äº§ç OUTï¼èæçº¿è¾¹åºæ£åï¼+ INï¼å®é
ä»åºå¢å ï¼ |
| | | // 2. éåæç»ï¼æ¯æ¡æç»äº§ç OUTï¼èæçº¿è¾¹åºæ£åï¼+ INï¼ä¸æ¶ç®æ ä»åºå¢å ï¼ |
| | | List<MesWmReturnIssueDetailDO> details = issueDetailService.getReturnIssueDetailListByIssueId(issue.getId()); |
| | | for (MesWmReturnIssueDetailDO detail : details) { |
| | | // 2.1 å
ä»èæçº¿è¾¹åºåºåºï¼åºååå°ï¼ |
| | |
| | | .setQuantity(detail.getQuantity().negate()) // åºååå° |
| | | .setBatchId(detail.getBatchId()).setBatchCode(detail.getBatchCode()) |
| | | .setWarehouseId(virtualWarehouse.getId()).setLocationId(virtualLocation.getId()).setAreaId(virtualArea.getId()) |
| | | .setMaterialStockId(detail.getMaterialStockId()) // æå®èæçº¿è¾¹åºåºåè®°å½ |
| | | .setCheckFlag(false) // 线边åºå
许è´åºå |
| | | .setBizType(MesBizTypeConstants.WM_RETURN_ISSUE).setBizId(issue.getId()) |
| | | .setBizCode(issue.getCode()).setBizLineId(detail.getLineId())); |
| | | // 2.2 åå
¥å®é
ä»åºï¼åºåå¢å ï¼ |
| | | |
| | | // 2.2 ç¡®å®ä¸æ¶ç®æ ä»åºï¼detail ç warehouseId/locationId/areaId æ¯ä¸æ¶ç®æ ï¼å®é
ä»åºï¼ |
| | | // 妿å端ä»ä¼ äºèæçº¿è¾¹åºï¼å
¼å®¹æ§æ°æ®ï¼ï¼åéè¿äºå¡æµæ°´åæ¥åå§ä»åº |
| | | Long targetWarehouseId = detail.getWarehouseId(); |
| | | Long targetLocationId = detail.getLocationId(); |
| | | Long targetAreaId = detail.getAreaId(); |
| | | if (virtualWarehouse.getId().equals(targetWarehouseId) && detail.getMaterialStockId() != null) { |
| | | MesWmTransactionDO originalOutTx = transactionMapper.selectOriginalOutTransaction(detail.getMaterialStockId()); |
| | | if (originalOutTx != null) { |
| | | targetWarehouseId = originalOutTx.getWarehouseId(); |
| | | targetLocationId = originalOutTx.getLocationId(); |
| | | targetAreaId = originalOutTx.getAreaId(); |
| | | } |
| | | } |
| | | |
| | | // 2.3 å
¥ä¸æ¶ç®æ ä»åºï¼åºåå¢å ï¼ |
| | | wmTransactionService.createTransaction(new MesWmTransactionSaveReqDTO() |
| | | .setType(MesWmTransactionTypeEnum.IN.getType()).setItemId(detail.getItemId()) |
| | | .setQuantity(detail.getQuantity()) // åºåå¢å ï¼éæåä»ï¼ |
| | | .setBatchId(detail.getBatchId()).setBatchCode(detail.getBatchCode()) |
| | | .setWarehouseId(detail.getWarehouseId()).setLocationId(detail.getLocationId()).setAreaId(detail.getAreaId()) |
| | | .setWarehouseId(targetWarehouseId).setLocationId(targetLocationId).setAreaId(targetAreaId) |
| | | .setBizType(MesBizTypeConstants.WM_RETURN_ISSUE).setBizId(issue.getId()) |
| | | .setBizCode(issue.getCode()).setBizLineId(detail.getLineId()) |
| | | .setRelatedTransactionId(outTransactionId)); // å
³èåºåºäºå¡ |
| | |
| | | */ |
| | | private void validateReturnIssueSaveData(MesWmReturnIssueSaveReqVO reqVO) { |
| | | validateCodeUnique(reqVO.getId(), reqVO.getCode()); |
| | | // æ ¡éª task åå¨ |
| | | MesProTaskDO task = taskService.validateTaskExists(reqVO.getTaskId()); |
| | | // æ ¡éª task å
³èçå·¥å已确认 |
| | | Long workOrderId = reqVO.getWorkOrderId() != null ? reqVO.getWorkOrderId() : task.getWorkOrderId(); |
| | | if (workOrderId != null) { |
| | | workOrderService.validateWorkOrderConfirmed(workOrderId); |
| | | // æ ¡éª task åå¨ï¼taskId éå¿
å¡«ï¼ä¼ äºææ ¡éªï¼ |
| | | if (reqVO.getTaskId() != null) { |
| | | MesProTaskDO task = taskService.validateTaskExists(reqVO.getTaskId()); |
| | | // æ ¡éª task å
³èçå·¥å已确认 |
| | | Long workOrderId = reqVO.getWorkOrderId() != null ? reqVO.getWorkOrderId() : task.getWorkOrderId(); |
| | | if (workOrderId != null) { |
| | | workOrderService.validateWorkOrderConfirmed(workOrderId); |
| | | } |
| | | } else if (reqVO.getWorkOrderId() != null) { |
| | | // æ²¡ä¼ taskId ä½ä¼ äº workOrderIdï¼æ ¡éªå·¥å已确认 |
| | | workOrderService.validateWorkOrderConfirmed(reqVO.getWorkOrderId()); |
| | | } |
| | | if (reqVO.getWorkstationId() != null) { |
| | | workstationService.validateWorkstationExistsAndEnable(reqVO.getWorkstationId()); |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | |
| | |
| | | // 1.5 å
³èäºå¡æ ¡éª |
| | | checkRelatedTransaction(reqDTO); |
| | | |
| | | // 2.1 è·åæå建åºåè®°å½ï¼å¦æä¼ å
¥äº materialStockId åç´æ¥ä½¿ç¨ï¼é¿å
éæ°å¹é
ï¼ |
| | | // 2.1 è·ååºåè®°å½ |
| | | MesWmMaterialStockDO materialStock; |
| | | MesWmTransactionTypeEnum transactionType = MesWmTransactionTypeEnum.valueOf(reqDTO.getType()); |
| | | boolean isInbound = transactionType != null && transactionType.isInbound(); |
| | | if (reqDTO.getMaterialStockId() != null) { |
| | | // ä¼ å
¥äº materialStockIdï¼ç´æ¥ä½¿ç¨ |
| | | materialStock = materialStockService.getMaterialStock(reqDTO.getMaterialStockId()); |
| | | if (materialStock == null) { |
| | | throw exception(WM_MATERIAL_STOCK_NOT_EXISTS); |
| | |
| | | || ObjUtil.notEqual(materialStock.getAreaId(), reqDTO.getAreaId())) { |
| | | throw exception(WM_MATERIAL_STOCK_SELECTION_MISMATCH); |
| | | } |
| | | } else { |
| | | } else if (isInbound) { |
| | | // å
¥åºäºå¡ï¼æ¾ä¸å°åèªå¨å建åºåè®°å½ |
| | | materialStock = materialStockService.getOrCreateMaterialStock( |
| | | reqDTO.getItemId(), reqDTO.getWarehouseId(), reqDTO.getLocationId(), reqDTO.getAreaId(), |
| | | reqDTO.getBatchId(), reqDTO.getBatchCode(), reqDTO.getVendorId(), reqDTO.getReceiptTime()); |
| | | } else { |
| | | // åºåºäºå¡ï¼åºåè®°å½å¿
须已åå¨ï¼ä¸å
许èªå¨å建ï¼é¤é checkFlag=false å
许è´åºåï¼ |
| | | materialStock = materialStockService.getMaterialStockByCompositeKey( |
| | | reqDTO.getItemId(), reqDTO.getWarehouseId(), reqDTO.getLocationId(), reqDTO.getAreaId(), |
| | | reqDTO.getBatchId(), reqDTO.getVendorId()); |
| | | if (materialStock == null) { |
| | | // checkFlag=false æ¶å
许è´åºåï¼èªå¨å建åºåè®°å½ï¼æ°éå°ä» 0 æ£åä¸ºè´æ°ï¼ |
| | | boolean allowNegative = !ObjUtil.defaultIfNull(reqDTO.getCheckFlag(), true); |
| | | if (allowNegative) { |
| | | materialStock = materialStockService.getOrCreateMaterialStock( |
| | | reqDTO.getItemId(), reqDTO.getWarehouseId(), reqDTO.getLocationId(), reqDTO.getAreaId(), |
| | | reqDTO.getBatchId(), reqDTO.getBatchCode(), reqDTO.getVendorId(), reqDTO.getReceiptTime()); |
| | | } else { |
| | | throw exception(WM_MATERIAL_STOCK_NOT_EXISTS); |
| | | } |
| | | } |
| | | } |
| | | if (materialStock == null || materialStock.getId() == null) { |
| | | throw exception(WM_MATERIAL_STOCK_NOT_EXISTS); |
| | | } |
| | | // 2.2 å»ç»æ ¡éªï¼ä»åºãåºåºãåºä½ãåºåè®°å½ï¼ |
| | | checkFrozen(reqDTO, materialStock); |
| | |
| | | ppl.item_id AS itemId, |
| | | ppl.quantity AS quantity, |
| | | NULL AS vendorId, |
| | | pp.work_order_id AS workOrderId, |
| | | pp.workstation_id AS workstationId, |
| | | pp.task_id AS taskId, |
| | | pf.work_order_id AS workOrderId, |
| | | pf.workstation_id AS workstationId, |
| | | pf.task_id AS taskId, |
| | | NULL AS clientId |
| | | FROM mes_wm_product_produce_line ppl |
| | | JOIN mes_wm_product_produce pp ON ppl.produce_id = pp.id |
| | |
| | | NULL AS vendorId, |
| | | ri.work_order_id AS workOrderId, |
| | | ri.workstation_id AS workstationId, |
| | | NULL AS taskId, |
| | | ri.task_id AS taskId, |
| | | NULL AS clientId |
| | | FROM mes_wm_return_issue ri |
| | | JOIN mes_wm_return_issue_line ril ON ri.id = ril.issue_id |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue.MesWmReturnIssueLineMapper"> |
| | | |
| | | <select id="selectPageByReqVO" resultType="cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLinePageVO"> |
| | | SELECT t1.*, t2.code, t2.name, t2.specification |
| | | FROM mes_wm_return_issue_line t1 |
| | | LEFT JOIN mdm_item t2 ON t1.item_id = t2.id AND t2.deleted = 0 |
| | | WHERE t1.deleted = 0 |
| | | <if test="reqVO.issueId != null"> |
| | | AND t1.issue_id = #{reqVO.issueId} |
| | | </if> |
| | | ORDER BY t1.id DESC |
| | | </select> |
| | | |
| | | </mapper> |