Compare commits
21 Commits
1fe6e030d4
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5736cd5f8 | ||
|
|
9ff6a57544 | ||
|
|
2ca6a271db | ||
|
|
323da20f2a | ||
|
|
9f4e1c39ad | ||
|
|
303092e637 | ||
|
|
ae586d1fc2 | ||
|
|
a44497f92c | ||
|
|
4408e80e1c | ||
|
|
7686d70e59 | ||
|
|
264ca0e407 | ||
|
|
f94ddb433d | ||
|
|
d1aab9dba1 | ||
|
|
b5f5815c71 | ||
|
|
22ace156f9 | ||
|
|
3d386ff650 | ||
|
|
fe13e952f2 | ||
| 539889a346 | |||
| 6eca9768cc | |||
| 6d9f24bfd4 | |||
|
|
1ce1ffad5a |
194
.cursor/skills/ruoyi-industrial-dashboard-style/SKILL.md
Normal file
194
.cursor/skills/ruoyi-industrial-dashboard-style/SKILL.md
Normal file
@@ -0,0 +1,194 @@
|
||||
---
|
||||
name: ruoyi-industrial-dashboard-style
|
||||
description: Recreate the industrial dashboard style from `ruoyi-ui/src/views/index.vue` and apply it consistently across the UI, especially buttons, inputs, tables, cards, tags, and other Element-UI components. Use when the user asks for an industrial monitoring layout, blue-themed controls, or a RuoYi UI style based on `ruoyi-ui/src/views/index.vue`.
|
||||
---
|
||||
|
||||
# RuoYi Industrial Dashboard Style
|
||||
|
||||
## Goal
|
||||
|
||||
Produce UI that matches the look and feel of `ruoyi-ui/src/views/index.vue` and extends it into the global component system:
|
||||
|
||||
- Compact, information-dense layout
|
||||
- Industrial control-room aesthetic
|
||||
- Dark top status bar
|
||||
- White cards with subtle borders and soft shadows
|
||||
- Small typography and tight spacing
|
||||
- Strong blue accents across all controls, not green
|
||||
- Table-first monitoring views with status badges and communication indicators
|
||||
|
||||
## Core color direction
|
||||
|
||||
- Primary actions, links, active states, and focused controls should use blue shades.
|
||||
- Use deep navy and steel blue as the main palette.
|
||||
- Avoid default Element-UI green success styling unless the semantics truly require success.
|
||||
- Reserve red for alarms, orange for warnings, and gray for neutral states.
|
||||
- Buttons, tags, table headers, and form focus states should visually align with the blue industrial palette.
|
||||
|
||||
## Design rules
|
||||
|
||||
### Overall layout
|
||||
|
||||
- Use a light gray page background.
|
||||
- Keep padding and gaps tight.
|
||||
- Prefer multiple horizontal sections over tall stacked blocks.
|
||||
- Treat each section as a bordered card with a small header.
|
||||
|
||||
### Top status bar
|
||||
|
||||
- Use a full-width dark header strip.
|
||||
- Left side should show system name, divider, and unit tag.
|
||||
- Right side should show online/offline state and a live clock.
|
||||
- Keep the bar compact, stable, and highly legible.
|
||||
|
||||
### KPI cards
|
||||
|
||||
- Use white cards with a small colored icon block.
|
||||
- Show a large numeric value and a smaller label.
|
||||
- Keep card height short and consistent.
|
||||
- Prefer blue for normal metrics, orange for in-progress, red for warnings.
|
||||
|
||||
### Equipment or station cards
|
||||
|
||||
- Use a dark card header with the equipment name and runtime badge.
|
||||
- Use a grid for dense parameter display.
|
||||
- Display values in monospace or tabular-style text where possible.
|
||||
- Add a slim footer with current coil/order, grade, shift, or similar operational context.
|
||||
|
||||
### Tables
|
||||
|
||||
- Prefer compact tables with borders and stripes.
|
||||
- Use small button sizes and small tags.
|
||||
- Keep column widths tight and practical.
|
||||
- Use status text and colors to show workflow state.
|
||||
|
||||
### Communication or alarm indicators
|
||||
|
||||
- Use small dots, compact labels, and timestamps.
|
||||
- Use blue for healthy connections.
|
||||
- Use red and subtle blinking for alarms or disconnects.
|
||||
|
||||
## Visual tokens
|
||||
|
||||
Use these as the default visual language unless the user asks otherwise:
|
||||
|
||||
- Background: `#f0f2f5`
|
||||
- Card border: `#dde1e6`
|
||||
- Primary dark: `#1c2b3a`
|
||||
- Primary blue: `#1d4e89`
|
||||
- Secondary blue: `#2471a3`
|
||||
- Warning orange: `#d68910`
|
||||
- Danger red: `#c0392b`
|
||||
- Muted text: `#7f8c8d`
|
||||
- Soft shadow: `0 1px 4px rgba(0,0,0,.05)`
|
||||
|
||||
## Typography and spacing
|
||||
|
||||
- Use 11?C13px text for most labels and chrome.
|
||||
- Use bold, larger numeric values for KPIs.
|
||||
- Keep corner radii small, around 2?C4px.
|
||||
- Use subtle dividers and minimal decoration.
|
||||
|
||||
## SCSS conventions
|
||||
|
||||
- Prefer scoped SCSS.
|
||||
- Use BEM-style nested blocks like `card__header`, `card__body`, `card__footer`.
|
||||
- Keep component styles compact and local.
|
||||
- Use monospace for clocks and numeric readings when appropriate.
|
||||
|
||||
## When implementing a new screen
|
||||
|
||||
1. Start with the overall page shell and background.
|
||||
2. Add the dark status bar.
|
||||
3. Add KPI cards in a tight grid.
|
||||
4. Add one or more dense equipment/status panels.
|
||||
5. Add a compact table or communication panel.
|
||||
6. Apply the color, spacing, border, and blue-control rules above.
|
||||
|
||||
## Example prompt behavior
|
||||
|
||||
If the user says they like the style from `ruoyi-ui/src/views/index.vue`, interpret that as a request to reuse this exact industrial dashboard language in new pages, components, or screens.
|
||||
|
||||
## Design rules
|
||||
|
||||
### Overall layout
|
||||
|
||||
- Use a light gray page background.
|
||||
- Keep padding and gaps tight.
|
||||
- Prefer multiple horizontal sections over tall stacked blocks.
|
||||
- Treat each section as a bordered card with a small header.
|
||||
|
||||
### Top status bar
|
||||
|
||||
- Use a full-width dark header strip.
|
||||
- Left side should show system name, divider, and unit tag.
|
||||
- Right side should show online/offline state and a live clock.
|
||||
- Keep the bar compact, stable, and highly legible.
|
||||
|
||||
### KPI cards
|
||||
|
||||
- Use white cards with a small colored icon block.
|
||||
- Show a large numeric value and a smaller label.
|
||||
- Keep card height short and consistent.
|
||||
- Prefer blue for normal metrics, orange for in-progress, red for warnings.
|
||||
|
||||
### Equipment or station cards
|
||||
|
||||
- Use a dark card header with the equipment name and runtime badge.
|
||||
- Use a grid for dense parameter display.
|
||||
- Display values in monospace or tabular-style text where possible.
|
||||
- Add a slim footer with current coil/order, grade, shift, or similar operational context.
|
||||
|
||||
### Tables
|
||||
|
||||
- Prefer compact tables with borders and stripes.
|
||||
- Use small button sizes and small tags.
|
||||
- Keep column widths tight and practical.
|
||||
- Use status text and colors to show workflow state.
|
||||
|
||||
### Communication or alarm indicators
|
||||
|
||||
- Use small dots, compact labels, and timestamps.
|
||||
- Use blue for healthy connections.
|
||||
- Use red and subtle blinking for alarms or disconnects.
|
||||
|
||||
## Visual tokens
|
||||
|
||||
Use these as the default visual language unless the user asks otherwise:
|
||||
|
||||
- Background: `#f0f2f5`
|
||||
- Card border: `#dde1e6`
|
||||
- Primary dark: `#1c2b3a`
|
||||
- Primary blue: `#1d4e89`
|
||||
- Secondary blue: `#2471a3`
|
||||
- Warning orange: `#d68910`
|
||||
- Danger red: `#c0392b`
|
||||
- Muted text: `#7f8c8d`
|
||||
- Soft shadow: `0 1px 4px rgba(0,0,0,.05)`
|
||||
|
||||
## Typography and spacing
|
||||
|
||||
- Use 11?C13px text for most labels and chrome.
|
||||
- Use bold, larger numeric values for KPIs.
|
||||
- Keep corner radii small, around 2?C4px.
|
||||
- Use subtle dividers and minimal decoration.
|
||||
|
||||
## SCSS conventions
|
||||
|
||||
- Prefer scoped SCSS.
|
||||
- Use BEM-style nested blocks like `card__header`, `card__body`, `card__footer`.
|
||||
- Keep component styles compact and local.
|
||||
- Use monospace for clocks and numeric readings when appropriate.
|
||||
|
||||
## When implementing a new screen
|
||||
|
||||
1. Start with the overall page shell and background.
|
||||
2. Add the dark status bar.
|
||||
3. Add KPI cards in a tight grid.
|
||||
4. Add one or more dense equipment/status panels.
|
||||
5. Add a compact table or communication panel.
|
||||
6. Apply the color, spacing, and border rules above.
|
||||
|
||||
## Example prompt behavior
|
||||
|
||||
If the user says they like the style from `ruoyi-ui/src/views/index.vue`, interpret that as a request to reuse this exact industrial dashboard language in new pages, components, or screens.
|
||||
2
.dbg/product-import-image.env
Normal file
2
.dbg/product-import-image.env
Normal file
@@ -0,0 +1,2 @@
|
||||
DEBUG_SERVER_URL=http://127.0.0.1:7777/event
|
||||
DEBUG_SESSION_ID=product-import-image
|
||||
36
.dbg/trae-debug-log-default.ndjson
Normal file
36
.dbg/trae-debug-log-default.ndjson
Normal file
@@ -0,0 +1,36 @@
|
||||
{"ts": 1779294580277, "event": "import_open_workbook", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "fileSize": 204246016, "workbookClass": "org.apache.poi.hssf.usermodel.HSSFWorkbook"}}
|
||||
{"ts": 1779294580300, "event": "import_header", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "sheetClass": "org.apache.poi.hssf.usermodel.HSSFSheet", "lastRowNum": 333, "headerIndex": {"序号": 0, "产品名称": 1, "产品图片": 2, "产品规格": 3, "价格": 4, "产品型号": 5}, "colProductName": 1, "colSpec": 3, "colModel": 5, "colUnitPrice": -1, "colRemark": -1, "colImages": 2, "xssfCellImagesPart": null}}
|
||||
{"ts": 1779294580378, "event": "import_pictures_map", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "rowsWithPictures": 56, "totalPictures": 65}}
|
||||
{"ts": 1779294580412, "event": "import_image_miss_row", "payload": {"rowIndex": 1, "productName": "床头柜", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_DE28F1DE70D7472299A0EB95E12ABDE8\",1)"}}
|
||||
{"ts": 1779294580415, "event": "import_image_miss_row", "payload": {"rowIndex": 2, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_D1DA8BA74D034AC0892AF25D577A3DFC\",1)"}}
|
||||
{"ts": 1779294580417, "event": "import_image_miss_row", "payload": {"rowIndex": 3, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_C5A9E5DB6F484CD4B0ED9E78B40B850B\",1)"}}
|
||||
{"ts": 1779294580420, "event": "import_image_miss_row", "payload": {"rowIndex": 4, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_E9A371D0A3D74FE8AFF9840431B05F3E\",1)"}}
|
||||
{"ts": 1779294580423, "event": "import_image_miss_row", "payload": {"rowIndex": 5, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_690D368FCF9F4BFAB19C8654A6C61FFD\",1)"}}
|
||||
{"ts": 1779294642453, "event": "import_done_parse", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "resultSize": 236, "rowsWithProductImages": 55}}
|
||||
{"ts": 1779294704871, "event": "import_open_workbook", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "fileSize": 204246016, "workbookClass": "org.apache.poi.hssf.usermodel.HSSFWorkbook"}}
|
||||
{"ts": 1779294704873, "event": "import_header", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "sheetClass": "org.apache.poi.hssf.usermodel.HSSFSheet", "lastRowNum": 333, "headerIndex": {"序号": 0, "产品名称": 1, "产品图片": 2, "产品规格": 3, "价格": 4, "产品型号": 5}, "colProductName": 1, "colSpec": 3, "colModel": 5, "colUnitPrice": -1, "colRemark": -1, "colImages": 2, "xssfCellImagesPart": null}}
|
||||
{"ts": 1779294704910, "event": "import_pictures_map", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "rowsWithPictures": 56, "totalPictures": 65}}
|
||||
{"ts": 1779294704913, "event": "import_image_miss_row", "payload": {"rowIndex": 1, "productName": "床头柜", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_DE28F1DE70D7472299A0EB95E12ABDE8\",1)"}}
|
||||
{"ts": 1779294704916, "event": "import_image_miss_row", "payload": {"rowIndex": 2, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_D1DA8BA74D034AC0892AF25D577A3DFC\",1)"}}
|
||||
{"ts": 1779294704918, "event": "import_image_miss_row", "payload": {"rowIndex": 3, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_C5A9E5DB6F484CD4B0ED9E78B40B850B\",1)"}}
|
||||
{"ts": 1779294704921, "event": "import_image_miss_row", "payload": {"rowIndex": 4, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_E9A371D0A3D74FE8AFF9840431B05F3E\",1)"}}
|
||||
{"ts": 1779294704925, "event": "import_image_miss_row", "payload": {"rowIndex": 5, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_690D368FCF9F4BFAB19C8654A6C61FFD\",1)"}}
|
||||
{"ts": 1779294767240, "event": "import_done_parse", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "resultSize": 236, "rowsWithProductImages": 55}}
|
||||
{"ts": 1779294901849, "event": "import_open_workbook", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "fileSize": 204246016, "workbookClass": "org.apache.poi.hssf.usermodel.HSSFWorkbook"}}
|
||||
{"ts": 1779294901852, "event": "import_header", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "sheetClass": "org.apache.poi.hssf.usermodel.HSSFSheet", "lastRowNum": 333, "headerIndex": {"序号": 0, "产品名称": 1, "产品图片": 2, "产品规格": 3, "价格": 4, "产品型号": 5}, "colProductName": 1, "colSpec": 3, "colModel": 5, "colUnitPrice": -1, "colRemark": -1, "colImages": 2, "xssfCellImagesPart": null}}
|
||||
{"ts": 1779294901883, "event": "import_pictures_map", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "rowsWithPictures": 56, "totalPictures": 65}}
|
||||
{"ts": 1779294901886, "event": "import_image_miss_row", "payload": {"rowIndex": 1, "productName": "床头柜", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_DE28F1DE70D7472299A0EB95E12ABDE8\",1)"}}
|
||||
{"ts": 1779294901889, "event": "import_image_miss_row", "payload": {"rowIndex": 2, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_D1DA8BA74D034AC0892AF25D577A3DFC\",1)"}}
|
||||
{"ts": 1779294901893, "event": "import_image_miss_row", "payload": {"rowIndex": 3, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_C5A9E5DB6F484CD4B0ED9E78B40B850B\",1)"}}
|
||||
{"ts": 1779294901895, "event": "import_image_miss_row", "payload": {"rowIndex": 4, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_E9A371D0A3D74FE8AFF9840431B05F3E\",1)"}}
|
||||
{"ts": 1779294901897, "event": "import_image_miss_row", "payload": {"rowIndex": 5, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_690D368FCF9F4BFAB19C8654A6C61FFD\",1)"}}
|
||||
{"ts": 1779294980062, "event": "import_done_parse", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "resultSize": 236, "rowsWithProductImages": 55}}
|
||||
{"ts": 1779295230641, "event": "import_open_workbook", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "fileSize": 204246016, "workbookClass": "org.apache.poi.hssf.usermodel.HSSFWorkbook"}}
|
||||
{"ts": 1779295230643, "event": "import_header", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "sheetClass": "org.apache.poi.hssf.usermodel.HSSFSheet", "lastRowNum": 333, "headerIndex": {"序号": 0, "产品名称": 1, "产品图片": 2, "产品规格": 3, "价格": 4, "产品型号": 5}, "colProductName": 1, "colSpec": 3, "colModel": 5, "colUnitPrice": -1, "colRemark": -1, "colImages": 2, "xssfCellImagesPart": null}}
|
||||
{"ts": 1779295230672, "event": "import_pictures_map", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "rowsWithPictures": 56, "totalPictures": 65}}
|
||||
{"ts": 1779295230676, "event": "import_image_miss_row", "payload": {"rowIndex": 1, "productName": "床头柜", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_DE28F1DE70D7472299A0EB95E12ABDE8\",1)"}}
|
||||
{"ts": 1779295230679, "event": "import_image_miss_row", "payload": {"rowIndex": 2, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_D1DA8BA74D034AC0892AF25D577A3DFC\",1)"}}
|
||||
{"ts": 1779295230682, "event": "import_image_miss_row", "payload": {"rowIndex": 3, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_C5A9E5DB6F484CD4B0ED9E78B40B850B\",1)"}}
|
||||
{"ts": 1779295230684, "event": "import_image_miss_row", "payload": {"rowIndex": 4, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_E9A371D0A3D74FE8AFF9840431B05F3E\",1)"}}
|
||||
{"ts": 1779295230686, "event": "import_image_miss_row", "payload": {"rowIndex": 5, "productName": "置物架", "cellType": "FORMULA", "hasDispImgFormula": true, "cellText": "_xlfn.DISPIMG(\"ID_690D368FCF9F4BFAB19C8654A6C61FFD\",1)"}}
|
||||
{"ts": 1779295298724, "event": "import_done_parse", "payload": {"fileName": "询价-产品目录(整理)2604.xls", "resultSize": 236, "rowsWithProductImages": 55}}
|
||||
@@ -105,13 +105,13 @@ spring:
|
||||
spring:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
host: 49.232.154.205
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码(如没有密码请注释掉)
|
||||
# password:
|
||||
password: WANGyu11!
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
# 是否开启ssl
|
||||
@@ -128,7 +128,7 @@ redisson:
|
||||
singleServerConfig:
|
||||
# 客户端名称
|
||||
clientName: ${ruoyi.name}
|
||||
# 最小空闲连接数
|
||||
# 最小空闲连接数ACT_ID_PROPERTY
|
||||
connectionMinimumIdleSize: 32
|
||||
# 连接池大小
|
||||
connectionPoolSize: 64
|
||||
|
||||
@@ -70,14 +70,15 @@ spring:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: @profiles.active@
|
||||
active: prod
|
||||
# @profiles.active@
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
max-file-size: 512MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
max-request-size: 512MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
<groupId>com.gear</groupId>
|
||||
<artifactId>gear-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.gear</groupId>
|
||||
<artifactId>gear-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
|
||||
@@ -75,8 +75,12 @@ public class MatMaterialController extends BaseController {
|
||||
@Log(title = "配料配件基础信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody MatMaterialBo bo) {
|
||||
return toAjax(iMatMaterialService.insertByBo(bo));
|
||||
public R<Long> add(@Validated(AddGroup.class) @RequestBody MatMaterialBo bo) {
|
||||
boolean ok = iMatMaterialService.insertByBo(bo);
|
||||
if (!ok) {
|
||||
return R.fail();
|
||||
}
|
||||
return R.ok(bo.getMaterialId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.gear.mat.controller;
|
||||
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.mat.domain.bo.MatProductAdditionBo;
|
||||
import com.gear.mat.domain.vo.MatProductAdditionVo;
|
||||
import com.gear.mat.service.IMatProductAdditionService;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Controller
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/mat/productAddition")
|
||||
public class MatProductAdditionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMatProductAdditionService productAdditionService;
|
||||
|
||||
/**
|
||||
* 查询产品属性附加表列表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 产品属性附加表列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MatProductAdditionBo productAdditionBo) {
|
||||
List<MatProductAdditionVo> list = productAdditionService.listProductAddition(productAdditionBo);
|
||||
return TableDataInfo.build(list);
|
||||
}
|
||||
|
||||
@PostMapping("/listByProductIds")
|
||||
public R<Map<Long, List<MatProductAdditionVo>>> listByProductIds(@RequestBody List<Long> productIds) {
|
||||
return R.ok(productAdditionService.listByProductIds(productIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增产品属性附加表
|
||||
*/
|
||||
@Log(title = "产品属性附加表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Boolean> add(@RequestBody MatProductAdditionBo productAdditionBo) {
|
||||
boolean result = productAdditionService.addProductAddition(productAdditionBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改产品属性附加表
|
||||
*/
|
||||
@Log(title = "产品属性附加表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody MatProductAdditionBo productAdditionBo) {
|
||||
boolean result = productAdditionService.updateProductAddition(productAdditionBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除产品属性附加表
|
||||
*
|
||||
* @param addId 主键ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
@Log(title = "产品属性附加表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{addId}")
|
||||
public R<Boolean> del(@PathVariable Long addId) {
|
||||
boolean result = productAdditionService.delProductAddition(addId);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Log(title = "产品属性附加表", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/batchSave")
|
||||
public R<Boolean> batchSave(@RequestBody BatchSaveRequest payload) {
|
||||
if (payload == null) {
|
||||
return R.ok(false);
|
||||
}
|
||||
return R.ok(productAdditionService.batchSaveProductAddition(payload.getProductId(), payload.getItems()));
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class BatchSaveRequest {
|
||||
private Long productId;
|
||||
private List<MatProductAdditionBo> items;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,71 @@
|
||||
package com.gear.mat.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.mat.domain.bo.MatProductInDetailBo;
|
||||
import com.gear.mat.domain.vo.MatProductInDetailVo;
|
||||
import com.gear.mat.service.IMatProductInDetailService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mat/productInDetail")
|
||||
public class MatProductInDetailController extends BaseController {
|
||||
|
||||
private final IMatProductInDetailService iMatProductInDetailService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<MatProductInDetailVo> list(MatProductInDetailBo bo, PageQuery pageQuery) {
|
||||
return iMatProductInDetailService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "产品入库单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(MatProductInDetailBo bo, HttpServletResponse response) {
|
||||
List<MatProductInDetailVo> list = iMatProductInDetailService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "产品入库单", MatProductInDetailVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/{detailId}")
|
||||
public R<MatProductInDetailVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long detailId) {
|
||||
return R.ok(iMatProductInDetailService.queryById(detailId));
|
||||
}
|
||||
|
||||
@Log(title = "产品入库单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody MatProductInDetailBo bo) {
|
||||
return toAjax(iMatProductInDetailService.insertByBoWithInventory(bo));
|
||||
}
|
||||
|
||||
@Log(title = "产品入库单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody MatProductInDetailBo bo) {
|
||||
return toAjax(iMatProductInDetailService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "产品入库单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{detailIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] detailIds) {
|
||||
return toAjax(iMatProductInDetailService.deleteWithValidByIdsWithInventory(Arrays.asList(detailIds), true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.gear.mat.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.mat.domain.bo.MatProductLaborBo;
|
||||
import com.gear.mat.domain.vo.MatProductLaborVo;
|
||||
import com.gear.mat.service.IMatProductLaborService;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/mat/productLabor")
|
||||
public class MatProductLaborController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IMatProductLaborService productLaborService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(MatProductLaborBo productLaborBo) {
|
||||
List<MatProductLaborVo> list = productLaborService.listProductLabor(productLaborBo);
|
||||
return TableDataInfo.build(list);
|
||||
}
|
||||
|
||||
@Log(title = "产品手动工价", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R<Boolean> add(@RequestBody MatProductLaborBo productLaborBo) {
|
||||
boolean result = productLaborService.addProductLabor(productLaborBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Log(title = "产品手动工价", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody MatProductLaborBo productLaborBo) {
|
||||
boolean result = productLaborService.updateProductLabor(productLaborBo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Log(title = "产品手动工价", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{laborId}")
|
||||
public R<Boolean> del(@PathVariable Long laborId) {
|
||||
boolean result = productLaborService.delProductLabor(laborId);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
@Log(title = "产品手动工价", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/batchSave")
|
||||
public R<Boolean> batchSave(@RequestBody BatchSaveRequest payload) {
|
||||
if (payload == null) {
|
||||
return R.ok(false);
|
||||
}
|
||||
return R.ok(productLaborService.batchSaveProductLabor(payload.getProductId(), payload.getItems()));
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class BatchSaveRequest {
|
||||
private Long productId;
|
||||
private List<MatProductLaborBo> items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.gear.mat.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.mat.domain.bo.MatProductOutsourceOrderBo;
|
||||
import com.gear.mat.domain.vo.MatProductOutsourceOrderVo;
|
||||
import com.gear.mat.service.IMatProductOutsourceOrderService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mat/productOutsourceOrder")
|
||||
public class MatProductOutsourceOrderController extends BaseController {
|
||||
|
||||
private final IMatProductOutsourceOrderService iMatProductOutsourceOrderService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<MatProductOutsourceOrderVo> list(MatProductOutsourceOrderBo bo, PageQuery pageQuery) {
|
||||
return iMatProductOutsourceOrderService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "半成品委外单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(MatProductOutsourceOrderBo bo, HttpServletResponse response) {
|
||||
List<MatProductOutsourceOrderVo> list = iMatProductOutsourceOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "半成品委外单", MatProductOutsourceOrderVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/{orderId}")
|
||||
public R<MatProductOutsourceOrderVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
return R.ok(iMatProductOutsourceOrderService.queryById(orderId));
|
||||
}
|
||||
|
||||
@Log(title = "半成品委外单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody MatProductOutsourceOrderBo bo) {
|
||||
return toAjax(iMatProductOutsourceOrderService.insertByBoWithInventory(bo));
|
||||
}
|
||||
|
||||
@Log(title = "半成品委外单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{orderIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] orderIds) {
|
||||
return toAjax(iMatProductOutsourceOrderService.deleteWithValidByIdsWithInventory(Arrays.asList(orderIds), true));
|
||||
}
|
||||
|
||||
@Log(title = "半成品委外单", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/receive/{orderId}")
|
||||
public R<Void> receive(@NotNull(message = "主键不能为空") @PathVariable Long orderId,
|
||||
@RequestBody ReceiveReq req) {
|
||||
BigDecimal qty = req == null ? null : req.getReceiveQty();
|
||||
Date time = req == null ? null : req.getReceiveTime();
|
||||
String by = req == null ? null : req.getReceiveBy();
|
||||
return toAjax(iMatProductOutsourceOrderService.receive(orderId, qty, time, by));
|
||||
}
|
||||
|
||||
public static class ReceiveReq {
|
||||
private BigDecimal receiveQty;
|
||||
private Date receiveTime;
|
||||
private String receiveBy;
|
||||
|
||||
public BigDecimal getReceiveQty() {
|
||||
return receiveQty;
|
||||
}
|
||||
|
||||
public void setReceiveQty(BigDecimal receiveQty) {
|
||||
this.receiveQty = receiveQty;
|
||||
}
|
||||
|
||||
public Date getReceiveTime() {
|
||||
return receiveTime;
|
||||
}
|
||||
|
||||
public void setReceiveTime(Date receiveTime) {
|
||||
this.receiveTime = receiveTime;
|
||||
}
|
||||
|
||||
public String getReceiveBy() {
|
||||
return receiveBy;
|
||||
}
|
||||
|
||||
public void setReceiveBy(String receiveBy) {
|
||||
this.receiveBy = receiveBy;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,12 @@ public class MatProduct extends BaseEntity {
|
||||
* 产品单价 可手动维护
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@TableField("product_type")
|
||||
private String productType;
|
||||
|
||||
@TableField("current_stock")
|
||||
private BigDecimal currentStock;
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
@@ -59,4 +65,9 @@ public class MatProduct extends BaseEntity {
|
||||
*/
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品说明书,多个PDF以逗号分隔
|
||||
*/
|
||||
private String productPdfs;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.gear.mat.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 产品属性附加表
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Data
|
||||
@TableName("gear_product_addition")
|
||||
public class MatProductAddition extends BaseEntity {
|
||||
/** 主键ID */
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long addId;
|
||||
|
||||
/** 属性名 */
|
||||
private String attrName;
|
||||
|
||||
/** 属性值 */
|
||||
private String attrValue;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 删除标识 0-未删除 1-已删除 */
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.gear.mat.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("mat_product_in_detail")
|
||||
public class MatProductInDetail extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "detail_id")
|
||||
private Long detailId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private BigDecimal inNum;
|
||||
|
||||
private Date inTime;
|
||||
|
||||
private String operator;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.gear.mat.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@TableName("gear_product_labor")
|
||||
public class MatProductLabor extends BaseEntity {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long laborId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String laborName;
|
||||
|
||||
private BigDecimal laborPrice;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.gear.mat.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("mat_product_outsource_order")
|
||||
public class MatProductOutsourceOrder extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "order_id")
|
||||
private Long orderId;
|
||||
|
||||
private String orderNo;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String productTypeSnapshot;
|
||||
|
||||
private Long customerId;
|
||||
|
||||
private String customerName;
|
||||
|
||||
private BigDecimal quantity;
|
||||
|
||||
private Date outTime;
|
||||
|
||||
private String operator;
|
||||
|
||||
private BigDecimal receivedQty;
|
||||
|
||||
private Integer receiveFlag;
|
||||
|
||||
private Date receiveTime;
|
||||
|
||||
private String receiveBy;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -67,6 +67,11 @@ public class MatMaterialOutBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 厂家(配料厂家)
|
||||
*/
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 产品属性附加表业务对象
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Data
|
||||
public class MatProductAdditionBo {
|
||||
/** 主键ID */
|
||||
private Long addId;
|
||||
|
||||
/** 属性名 */
|
||||
private String attrName;
|
||||
|
||||
/** 属性值 */
|
||||
private String attrValue;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
@@ -47,6 +47,10 @@ public class MatProductBo extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
private String productType;
|
||||
|
||||
private BigDecimal currentStock;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -57,5 +61,9 @@ public class MatProductBo extends BaseEntity {
|
||||
*/
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品说明书,多个PDF以逗号分隔
|
||||
*/
|
||||
private String productPdfs;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 产品导入模板对象
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MatProductImportBo {
|
||||
|
||||
@ExcelProperty("产品名称")
|
||||
private String productName;
|
||||
|
||||
@ExcelProperty("产品规格")
|
||||
private String spec;
|
||||
|
||||
@ExcelProperty("产品型号")
|
||||
private String model;
|
||||
|
||||
@ExcelProperty("产品单价")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty("产品图片")
|
||||
private String productImages;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MatProductInDetailBo extends BaseEntity {
|
||||
|
||||
private Long detailId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private BigDecimal inNum;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date inTime;
|
||||
|
||||
private String operator;
|
||||
|
||||
private String remark;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date beginTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class MatProductLaborBo {
|
||||
|
||||
private Long laborId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String laborName;
|
||||
|
||||
private BigDecimal laborPrice;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gear.mat.domain.bo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class MatProductOutsourceOrderBo extends BaseEntity {
|
||||
|
||||
private Long orderId;
|
||||
|
||||
private String orderNo;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private Long customerId;
|
||||
|
||||
private String customerName;
|
||||
|
||||
private BigDecimal quantity;
|
||||
|
||||
private Integer receiveFlag;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date outTime;
|
||||
|
||||
private String operator;
|
||||
|
||||
private String remark;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date beginTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
}
|
||||
@@ -72,6 +72,11 @@ public class MatPurchaseInDetailBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 厂家(配料厂家)
|
||||
*/
|
||||
private String factory;
|
||||
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
|
||||
@@ -71,6 +71,11 @@ public class MatMaterialVo {
|
||||
@ExcelDictFormat(readConverterExp = "已=入库")
|
||||
private BigDecimal currentStock;
|
||||
|
||||
/**
|
||||
* 单价(用于成本测算:默认取最新入库单价,其次取最新采购单价)
|
||||
*/
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.gear.mat.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 产品属性附加表视图对象
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Data
|
||||
public class MatProductAdditionVo {
|
||||
/** 主键ID */
|
||||
private Long addId;
|
||||
|
||||
/** 属性名 */
|
||||
private String attrName;
|
||||
|
||||
/** 属性值 */
|
||||
private String attrValue;
|
||||
|
||||
/** 产品ID */
|
||||
private Long productId;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
|
||||
/** 创建人 */
|
||||
private String createBy;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
|
||||
/** 更新人 */
|
||||
private String updateBy;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.gear.mat.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MatProductInDetailVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty(value = "入库明细ID")
|
||||
private Long detailId;
|
||||
|
||||
@ExcelProperty(value = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
@ExcelProperty(value = "入库数量")
|
||||
private BigDecimal inNum;
|
||||
|
||||
@ExcelProperty(value = "入库时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date inTime;
|
||||
|
||||
@ExcelProperty(value = "操作人")
|
||||
private String operator;
|
||||
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
@ExcelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
|
||||
@ExcelProperty(value = "产品规格")
|
||||
private String spec;
|
||||
|
||||
@ExcelProperty(value = "产品型号")
|
||||
private String model;
|
||||
|
||||
@ExcelProperty(value = "产品类型")
|
||||
private String productType;
|
||||
|
||||
@ExcelProperty(value = "当前库存")
|
||||
private BigDecimal currentStock;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gear.mat.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class MatProductLaborVo {
|
||||
|
||||
private Long laborId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String laborName;
|
||||
|
||||
private BigDecimal laborPrice;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private String createBy;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.gear.mat.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MatProductOutsourceOrderVo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ExcelProperty(value = "委外单ID")
|
||||
private Long orderId;
|
||||
|
||||
@ExcelProperty(value = "委外单号")
|
||||
private String orderNo;
|
||||
|
||||
@ExcelProperty(value = "产品ID")
|
||||
private Long productId;
|
||||
|
||||
@ExcelProperty(value = "产品名称")
|
||||
private String productName;
|
||||
|
||||
@ExcelProperty(value = "产品规格")
|
||||
private String spec;
|
||||
|
||||
@ExcelProperty(value = "产品型号")
|
||||
private String model;
|
||||
|
||||
@ExcelProperty(value = "产品类型")
|
||||
private String productTypeSnapshot;
|
||||
|
||||
@ExcelProperty(value = "委托公司ID")
|
||||
private Long customerId;
|
||||
|
||||
@ExcelProperty(value = "委托公司")
|
||||
private String customerName;
|
||||
|
||||
@ExcelProperty(value = "委派数量")
|
||||
private BigDecimal quantity;
|
||||
|
||||
@ExcelProperty(value = "已收回数量")
|
||||
private BigDecimal receivedQty;
|
||||
|
||||
@ExcelProperty(value = "收回标志")
|
||||
private Integer receiveFlag;
|
||||
|
||||
@ExcelProperty(value = "委外时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date outTime;
|
||||
|
||||
@ExcelProperty(value = "收回时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date receiveTime;
|
||||
|
||||
@ExcelProperty(value = "收回人")
|
||||
private String receiveBy;
|
||||
|
||||
@ExcelProperty(value = "操作人")
|
||||
private String operator;
|
||||
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -52,6 +52,12 @@ public class MatProductVo {
|
||||
@ExcelProperty(value = "产品单价 可手动维护")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ExcelProperty(value = "产品类型")
|
||||
private String productType;
|
||||
|
||||
@ExcelProperty(value = "库存")
|
||||
private BigDecimal currentStock;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -64,5 +70,11 @@ public class MatProductVo {
|
||||
@ExcelProperty(value = "产品图片")
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品说明书,多个PDF以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "产品说明书")
|
||||
private String productPdfs;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -51,6 +51,12 @@ public class MatProductWithMaterialsVo {
|
||||
@ExcelProperty(value = "产品单价 可手动维护")
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
@ExcelProperty(value = "产品类型")
|
||||
private String productType;
|
||||
|
||||
@ExcelProperty(value = "库存")
|
||||
private BigDecimal currentStock;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -63,6 +69,12 @@ public class MatProductWithMaterialsVo {
|
||||
@ExcelProperty(value = "产品图片")
|
||||
private String productImages;
|
||||
|
||||
/**
|
||||
* 产品PDF文件,多个PDF以逗号分隔
|
||||
*/
|
||||
@ExcelProperty(value = "产品PDF文件")
|
||||
private String productPdfs;
|
||||
|
||||
/**
|
||||
* 关联的配料信息列表
|
||||
*/
|
||||
|
||||
@@ -92,6 +92,7 @@ public class MatPurchaseInDetailVo {
|
||||
/**
|
||||
* 厂家
|
||||
*/
|
||||
@ExcelProperty(value = "厂家")
|
||||
private String factory;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.gear.mat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gear.mat.domain.MatProductAddition;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Mapper接口
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Mapper
|
||||
public interface MatProductAdditionMapper extends BaseMapper<MatProductAddition> {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.gear.mat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
import com.gear.mat.domain.MatProductInDetail;
|
||||
import com.gear.mat.domain.vo.MatProductInDetailVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface MatProductInDetailMapper extends BaseMapperPlus<MatProductInDetailMapper, MatProductInDetail, MatProductInDetailVo> {
|
||||
|
||||
Page<MatProductInDetailVo> selectVoPagePlus(Page<Object> page, @Param("ew") QueryWrapper<MatProductInDetail> qw);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.gear.mat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gear.mat.domain.MatProductLabor;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MatProductLaborMapper extends BaseMapper<MatProductLabor> {
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.gear.mat.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.common.core.mapper.BaseMapperPlus;
|
||||
import com.gear.mat.domain.MatProductOutsourceOrder;
|
||||
import com.gear.mat.domain.vo.MatProductOutsourceOrderVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface MatProductOutsourceOrderMapper extends BaseMapperPlus<MatProductOutsourceOrderMapper, MatProductOutsourceOrder, MatProductOutsourceOrderVo> {
|
||||
|
||||
Page<MatProductOutsourceOrderVo> selectVoPagePlus(Page<Object> page, @Param("ew") QueryWrapper<MatProductOutsourceOrder> qw);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gear.mat.domain.MatProductAddition;
|
||||
import com.gear.mat.domain.bo.MatProductAdditionBo;
|
||||
import com.gear.mat.domain.vo.MatProductAdditionVo;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Service接口
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
public interface IMatProductAdditionService extends IService<MatProductAddition> {
|
||||
/**
|
||||
* 查询产品属性附加表列表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 产品属性附加表列表
|
||||
*/
|
||||
List<MatProductAdditionVo> listProductAddition(MatProductAdditionBo productAdditionBo);
|
||||
|
||||
/**
|
||||
* 新增产品属性附加表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
boolean addProductAddition(MatProductAdditionBo productAdditionBo);
|
||||
|
||||
/**
|
||||
* 修改产品属性附加表
|
||||
*
|
||||
* @param productAdditionBo 产品属性附加表业务对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
boolean updateProductAddition(MatProductAdditionBo productAdditionBo);
|
||||
|
||||
/**
|
||||
* 删除产品属性附加表
|
||||
*
|
||||
* @param addId 主键ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
boolean delProductAddition(Long addId);
|
||||
|
||||
boolean batchSaveProductAddition(Long productId, List<MatProductAdditionBo> items);
|
||||
|
||||
Map<Long, List<MatProductAdditionVo>> listByProductIds(List<Long> productIds);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.mat.domain.bo.MatProductInDetailBo;
|
||||
import com.gear.mat.domain.vo.MatProductInDetailVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface IMatProductInDetailService {
|
||||
|
||||
MatProductInDetailVo queryById(Long detailId);
|
||||
|
||||
TableDataInfo<MatProductInDetailVo> queryPageList(MatProductInDetailBo bo, PageQuery pageQuery);
|
||||
|
||||
List<MatProductInDetailVo> queryList(MatProductInDetailBo bo);
|
||||
|
||||
Boolean insertByBoWithInventory(MatProductInDetailBo bo);
|
||||
|
||||
Boolean updateByBo(MatProductInDetailBo bo);
|
||||
|
||||
Boolean deleteWithValidByIdsWithInventory(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.gear.mat.domain.MatProductLabor;
|
||||
import com.gear.mat.domain.bo.MatProductLaborBo;
|
||||
import com.gear.mat.domain.vo.MatProductLaborVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMatProductLaborService extends IService<MatProductLabor> {
|
||||
|
||||
List<MatProductLaborVo> listProductLabor(MatProductLaborBo productLaborBo);
|
||||
|
||||
boolean addProductLabor(MatProductLaborBo productLaborBo);
|
||||
|
||||
boolean updateProductLabor(MatProductLaborBo productLaborBo);
|
||||
|
||||
boolean delProductLabor(Long laborId);
|
||||
|
||||
boolean batchSaveProductLabor(Long productId, List<MatProductLaborBo> items);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.mat.domain.bo.MatProductOutsourceOrderBo;
|
||||
import com.gear.mat.domain.vo.MatProductOutsourceOrderVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public interface IMatProductOutsourceOrderService {
|
||||
|
||||
MatProductOutsourceOrderVo queryById(Long orderId);
|
||||
|
||||
TableDataInfo<MatProductOutsourceOrderVo> queryPageList(MatProductOutsourceOrderBo bo, PageQuery pageQuery);
|
||||
|
||||
List<MatProductOutsourceOrderVo> queryList(MatProductOutsourceOrderBo bo);
|
||||
|
||||
Boolean insertByBoWithInventory(MatProductOutsourceOrderBo bo);
|
||||
|
||||
Boolean receive(Long orderId, java.math.BigDecimal receiveQty, java.util.Date receiveTime, String receiveBy);
|
||||
|
||||
Boolean deleteWithValidByIdsWithInventory(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.gear.mat.service;
|
||||
|
||||
import com.gear.mat.domain.MatProduct;
|
||||
import com.gear.mat.domain.bo.MatProductImportBo;
|
||||
import com.gear.mat.domain.vo.MatProductVo;
|
||||
import com.gear.mat.domain.vo.MatProductWithMaterialsVo;
|
||||
import com.gear.mat.domain.bo.MatProductBo;
|
||||
@@ -52,4 +53,9 @@ public interface IMatProductService {
|
||||
* 校验并批量删除产品基础信息信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* Excel导入产品基础信息
|
||||
*/
|
||||
String importByExcel(List<MatProductImportBo> list, Boolean updateSupport);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ public class MatMaterialOutServiceImpl implements IMatMaterialOutService {
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOperator()), "mmo.operator", bo.getOperator());
|
||||
lqw.ge(bo.getBeginTime() != null, "mmo.out_time", bo.getBeginTime());
|
||||
lqw.le(bo.getEndTime() != null, "mmo.out_time", bo.getEndTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFactory()), "mm.factory", bo.getFactory());
|
||||
// 逻辑删除
|
||||
lqw.eq("mmo.del_flag", 0);
|
||||
// 排序
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.gear.mat.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.gear.common.exception.ServiceException;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
@@ -49,7 +50,41 @@ public class MatMaterialServiceImpl implements IMatMaterialService {
|
||||
*/
|
||||
@Override
|
||||
public MatMaterialVo queryById(Long materialId){
|
||||
return baseMapper.selectVoById(materialId);
|
||||
MatMaterialVo vo = baseMapper.selectVoById(materialId);
|
||||
if (vo == null) {
|
||||
return null;
|
||||
}
|
||||
vo.setUnitPrice(resolveUnitPrice(materialId));
|
||||
return vo;
|
||||
}
|
||||
|
||||
private BigDecimal resolveUnitPrice(Long materialId) {
|
||||
QueryWrapper<MatPurchaseInDetail> inDetailQw = new QueryWrapper<>();
|
||||
inDetailQw.eq("material_id", materialId);
|
||||
inDetailQw.eq("del_flag", 0);
|
||||
inDetailQw.isNotNull("in_price");
|
||||
inDetailQw.orderByDesc("in_time");
|
||||
inDetailQw.orderByDesc("create_time");
|
||||
inDetailQw.last("LIMIT 1");
|
||||
MatPurchaseInDetail latestInDetail = matPurchaseInDetailMapper.selectOne(inDetailQw);
|
||||
if (latestInDetail != null && latestInDetail.getInPrice() != null) {
|
||||
return latestInDetail.getInPrice();
|
||||
}
|
||||
|
||||
QueryWrapper<MatPurchase> purchaseQw = new QueryWrapper<>();
|
||||
purchaseQw.eq("material_id", materialId);
|
||||
purchaseQw.eq("del_flag", 0);
|
||||
purchaseQw.ne("status", 3);
|
||||
purchaseQw.isNotNull("purchase_price");
|
||||
purchaseQw.orderByDesc("update_time");
|
||||
purchaseQw.orderByDesc("create_time");
|
||||
purchaseQw.last("LIMIT 1");
|
||||
MatPurchase latestPurchase = matPurchaseMapper.selectOne(purchaseQw);
|
||||
if (latestPurchase != null && latestPurchase.getPurchasePrice() != null) {
|
||||
return latestPurchase.getPurchasePrice();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +147,28 @@ public class MatMaterialServiceImpl implements IMatMaterialService {
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(MatMaterial entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
if (entity == null) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isNotBlank(entity.getMaterialName())) {
|
||||
entity.setMaterialName(entity.getMaterialName().trim());
|
||||
}
|
||||
if (StringUtils.isNotBlank(entity.getFactory())) {
|
||||
entity.setFactory(entity.getFactory().trim());
|
||||
}
|
||||
if (StringUtils.isBlank(entity.getMaterialName()) || StringUtils.isBlank(entity.getFactory()) || entity.getMaterialType() == null) {
|
||||
return;
|
||||
}
|
||||
Long cnt = baseMapper.selectCount(Wrappers.<MatMaterial>lambdaQuery()
|
||||
.eq(MatMaterial::getMaterialName, entity.getMaterialName())
|
||||
.eq(MatMaterial::getFactory, entity.getFactory())
|
||||
.eq(MatMaterial::getMaterialType, entity.getMaterialType())
|
||||
.eq(MatMaterial::getDelFlag, 0)
|
||||
.ne(entity.getMaterialId() != null, MatMaterial::getMaterialId, entity.getMaterialId()));
|
||||
if (cnt != null && cnt > 0) {
|
||||
String typeLabel = Objects.equals(entity.getMaterialType(), 2) ? "主材" : Objects.equals(entity.getMaterialType(), 1) ? "辅材" : "原料";
|
||||
throw new ServiceException(typeLabel + "已存在:" + entity.getMaterialName() + " - " + entity.getFactory());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.gear.mat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gear.mat.domain.MatProductAddition;
|
||||
import com.gear.mat.domain.bo.MatProductAdditionBo;
|
||||
import com.gear.mat.domain.vo.MatProductAdditionVo;
|
||||
import com.gear.mat.mapper.MatProductAdditionMapper;
|
||||
import com.gear.mat.service.IMatProductAdditionService;
|
||||
import com.gear.common.utils.BeanCopyUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 产品属性附加表Service实现类
|
||||
*
|
||||
* @author gear
|
||||
* @date 2026-04-22
|
||||
*/
|
||||
@Service
|
||||
public class MatProductAdditionServiceImpl extends ServiceImpl<MatProductAdditionMapper, MatProductAddition> implements IMatProductAdditionService {
|
||||
|
||||
@Override
|
||||
public List<MatProductAdditionVo> listProductAddition(MatProductAdditionBo productAdditionBo) {
|
||||
LambdaQueryWrapper<MatProductAddition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (productAdditionBo.getProductId() != null) {
|
||||
queryWrapper.eq(MatProductAddition::getProductId, productAdditionBo.getProductId());
|
||||
}
|
||||
if (productAdditionBo.getAttrName() != null) {
|
||||
queryWrapper.eq(MatProductAddition::getAttrName, productAdditionBo.getAttrName());
|
||||
}
|
||||
queryWrapper.eq(MatProductAddition::getDelFlag, 0);
|
||||
|
||||
List<MatProductAddition> list = baseMapper.selectList(queryWrapper);
|
||||
return BeanCopyUtils.copyList(list, MatProductAdditionVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProductAddition(MatProductAdditionBo productAdditionBo) {
|
||||
MatProductAddition productAddition = BeanCopyUtils.copy(productAdditionBo, MatProductAddition.class);
|
||||
return save(productAddition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateProductAddition(MatProductAdditionBo productAdditionBo) {
|
||||
MatProductAddition productAddition = BeanCopyUtils.copy(productAdditionBo, MatProductAddition.class);
|
||||
return updateById(productAddition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delProductAddition(Long addId) {
|
||||
return removeById(addId);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean batchSaveProductAddition(Long productId, List<MatProductAdditionBo> items) {
|
||||
if (productId == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<MatProductAddition> exist = baseMapper.selectList(new LambdaQueryWrapper<MatProductAddition>()
|
||||
.select(MatProductAddition::getAddId)
|
||||
.eq(MatProductAddition::getProductId, productId)
|
||||
.eq(MatProductAddition::getDelFlag, 0));
|
||||
|
||||
Set<Long> existIds = exist.stream()
|
||||
.map(MatProductAddition::getAddId)
|
||||
.filter(id -> id != null && id > 0)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<Long> incomingIds = items == null ? java.util.Collections.emptySet() : items.stream()
|
||||
.map(MatProductAdditionBo::getAddId)
|
||||
.filter(id -> id != null && id > 0)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<Long> deleteIds = existIds.stream()
|
||||
.filter(id -> !incomingIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
if (!deleteIds.isEmpty()) {
|
||||
removeByIds(deleteIds);
|
||||
}
|
||||
|
||||
if (items == null || items.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (MatProductAdditionBo item : items) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
MatProductAddition addition = BeanCopyUtils.copy(item, MatProductAddition.class);
|
||||
if (addition == null) {
|
||||
continue;
|
||||
}
|
||||
addition.setProductId(productId);
|
||||
if (addition.getAddId() == null) {
|
||||
save(addition);
|
||||
} else {
|
||||
updateById(addition);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, List<MatProductAdditionVo>> listByProductIds(List<Long> productIds) {
|
||||
if (productIds == null || productIds.isEmpty()) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
List<MatProductAddition> list = baseMapper.selectList(new LambdaQueryWrapper<MatProductAddition>()
|
||||
.in(MatProductAddition::getProductId, productIds)
|
||||
.eq(MatProductAddition::getDelFlag, 0)
|
||||
.orderByAsc(MatProductAddition::getProductId)
|
||||
.orderByAsc(MatProductAddition::getAddId));
|
||||
|
||||
Map<Long, List<MatProductAdditionVo>> result = new HashMap<>();
|
||||
for (MatProductAddition item : list) {
|
||||
if (item == null || item.getProductId() == null) {
|
||||
continue;
|
||||
}
|
||||
MatProductAdditionVo vo = BeanCopyUtils.copy(item, MatProductAdditionVo.class);
|
||||
result.computeIfAbsent(item.getProductId(), k -> new java.util.ArrayList<>()).add(vo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.gear.mat.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.mat.domain.MatProduct;
|
||||
import com.gear.mat.domain.MatProductInDetail;
|
||||
import com.gear.mat.domain.bo.MatProductInDetailBo;
|
||||
import com.gear.mat.domain.vo.MatProductInDetailVo;
|
||||
import com.gear.mat.mapper.MatProductInDetailMapper;
|
||||
import com.gear.mat.mapper.MatProductMapper;
|
||||
import com.gear.mat.service.IMatProductInDetailService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MatProductInDetailServiceImpl implements IMatProductInDetailService {
|
||||
|
||||
private final MatProductInDetailMapper baseMapper;
|
||||
private final MatProductMapper matProductMapper;
|
||||
|
||||
@Override
|
||||
public MatProductInDetailVo queryById(Long detailId) {
|
||||
return baseMapper.selectVoById(detailId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<MatProductInDetailVo> queryPageList(MatProductInDetailBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<MatProductInDetail> qw = buildQueryWrapperPlus(bo);
|
||||
Page<MatProductInDetailVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), qw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<MatProductInDetail> buildQueryWrapperPlus(MatProductInDetailBo bo) {
|
||||
QueryWrapper<MatProductInDetail> qw = Wrappers.query();
|
||||
qw.eq(bo.getProductId() != null, "mpid.product_id", bo.getProductId());
|
||||
qw.eq(bo.getInNum() != null, "mpid.in_num", bo.getInNum());
|
||||
qw.ge(bo.getBeginTime() != null, "mpid.in_time", bo.getBeginTime());
|
||||
qw.le(bo.getEndTime() != null, "mpid.in_time", bo.getEndTime());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getOperator()), "mpid.operator", bo.getOperator());
|
||||
qw.eq("mpid.del_flag", 0);
|
||||
qw.orderByDesc("mpid.in_time");
|
||||
return qw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MatProductInDetailVo> queryList(MatProductInDetailBo bo) {
|
||||
LambdaQueryWrapper<MatProductInDetail> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<MatProductInDetail> buildQueryWrapper(MatProductInDetailBo bo) {
|
||||
LambdaQueryWrapper<MatProductInDetail> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getProductId() != null, MatProductInDetail::getProductId, bo.getProductId());
|
||||
lqw.eq(bo.getInNum() != null, MatProductInDetail::getInNum, bo.getInNum());
|
||||
lqw.eq(bo.getInTime() != null, MatProductInDetail::getInTime, bo.getInTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getOperator()), MatProductInDetail::getOperator, bo.getOperator());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBoWithInventory(MatProductInDetailBo bo) {
|
||||
if (bo.getProductId() == null) {
|
||||
throw new IllegalArgumentException("产品不能为空");
|
||||
}
|
||||
if (bo.getInNum() == null || bo.getInNum().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new IllegalArgumentException("入库数量必须大于0");
|
||||
}
|
||||
if (bo.getInTime() == null) {
|
||||
bo.setInTime(new Date());
|
||||
}
|
||||
if (StringUtils.isBlank(bo.getOperator())) {
|
||||
bo.setOperator("-");
|
||||
}
|
||||
|
||||
MatProductInDetail add = BeanUtil.toBean(bo, MatProductInDetail.class);
|
||||
boolean ok = baseMapper.insert(add) > 0;
|
||||
if (!ok) {
|
||||
throw new IllegalStateException("入库记录保存失败");
|
||||
}
|
||||
bo.setDetailId(add.getDetailId());
|
||||
|
||||
updateProductStock(bo.getProductId(), bo.getInNum());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByBo(MatProductInDetailBo bo) {
|
||||
MatProductInDetail update = BeanUtil.toBean(bo, MatProductInDetail.class);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIdsWithInventory(Collection<Long> ids, Boolean isValid) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return false;
|
||||
}
|
||||
List<MatProductInDetailVo> records = baseMapper.selectVoBatchIds(ids);
|
||||
if (records == null || records.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean ok = baseMapper.deleteBatchIds(ids) > 0;
|
||||
if (!ok) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (MatProductInDetailVo r : records) {
|
||||
if (r.getProductId() == null || r.getInNum() == null) {
|
||||
continue;
|
||||
}
|
||||
revertProductStock(r.getProductId(), r.getInNum());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateProductStock(Long productId, BigDecimal qty) {
|
||||
MatProduct product = matProductMapper.selectById(productId);
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("产品不存在,productId=" + productId);
|
||||
}
|
||||
BigDecimal current = product.getCurrentStock() == null ? BigDecimal.ZERO : product.getCurrentStock();
|
||||
BigDecimal next = current.add(qty);
|
||||
product.setCurrentStock(next);
|
||||
int affected = matProductMapper.updateById(product);
|
||||
if (affected <= 0) {
|
||||
throw new IllegalStateException("更新产品库存失败");
|
||||
}
|
||||
}
|
||||
|
||||
private void revertProductStock(Long productId, BigDecimal qty) {
|
||||
MatProduct product = matProductMapper.selectById(productId);
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("产品不存在,productId=" + productId);
|
||||
}
|
||||
BigDecimal current = product.getCurrentStock() == null ? BigDecimal.ZERO : product.getCurrentStock();
|
||||
BigDecimal next = current.subtract(qty);
|
||||
if (next.compareTo(BigDecimal.ZERO) < 0) {
|
||||
throw new IllegalArgumentException("库存不足,无法撤回入库");
|
||||
}
|
||||
product.setCurrentStock(next);
|
||||
int affected = matProductMapper.updateById(product);
|
||||
if (affected <= 0) {
|
||||
throw new IllegalStateException("更新产品库存失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.gear.mat.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gear.common.utils.BeanCopyUtils;
|
||||
import com.gear.mat.domain.MatProductLabor;
|
||||
import com.gear.mat.domain.bo.MatProductLaborBo;
|
||||
import com.gear.mat.domain.vo.MatProductLaborVo;
|
||||
import com.gear.mat.mapper.MatProductLaborMapper;
|
||||
import com.gear.mat.service.IMatProductLaborService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class MatProductLaborServiceImpl extends ServiceImpl<MatProductLaborMapper, MatProductLabor> implements IMatProductLaborService {
|
||||
|
||||
@Override
|
||||
public List<MatProductLaborVo> listProductLabor(MatProductLaborBo productLaborBo) {
|
||||
LambdaQueryWrapper<MatProductLabor> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (productLaborBo.getProductId() != null) {
|
||||
queryWrapper.eq(MatProductLabor::getProductId, productLaborBo.getProductId());
|
||||
}
|
||||
queryWrapper.eq(MatProductLabor::getDelFlag, 0);
|
||||
List<MatProductLabor> list = baseMapper.selectList(queryWrapper);
|
||||
return BeanCopyUtils.copyList(list, MatProductLaborVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProductLabor(MatProductLaborBo productLaborBo) {
|
||||
MatProductLabor labor = BeanCopyUtils.copy(productLaborBo, MatProductLabor.class);
|
||||
return save(labor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateProductLabor(MatProductLaborBo productLaborBo) {
|
||||
MatProductLabor labor = BeanCopyUtils.copy(productLaborBo, MatProductLabor.class);
|
||||
return updateById(labor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delProductLabor(Long laborId) {
|
||||
return removeById(laborId);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public boolean batchSaveProductLabor(Long productId, List<MatProductLaborBo> items) {
|
||||
if (productId == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<MatProductLabor> exist = baseMapper.selectList(new LambdaQueryWrapper<MatProductLabor>()
|
||||
.select(MatProductLabor::getLaborId)
|
||||
.eq(MatProductLabor::getProductId, productId)
|
||||
.eq(MatProductLabor::getDelFlag, 0));
|
||||
|
||||
Set<Long> existIds = exist.stream()
|
||||
.map(MatProductLabor::getLaborId)
|
||||
.filter(id -> id != null && id > 0)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<Long> incomingIds = items == null ? java.util.Collections.emptySet() : items.stream()
|
||||
.map(MatProductLaborBo::getLaborId)
|
||||
.filter(id -> id != null && id > 0)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<Long> deleteIds = existIds.stream()
|
||||
.filter(id -> !incomingIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
if (!deleteIds.isEmpty()) {
|
||||
removeByIds(deleteIds);
|
||||
}
|
||||
|
||||
if (items == null || items.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (MatProductLaborBo item : items) {
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
MatProductLabor labor = BeanCopyUtils.copy(item, MatProductLabor.class);
|
||||
if (labor == null) {
|
||||
continue;
|
||||
}
|
||||
labor.setProductId(productId);
|
||||
if (labor.getLaborId() == null) {
|
||||
save(labor);
|
||||
} else {
|
||||
updateById(labor);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
package com.gear.mat.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.mat.domain.MatProduct;
|
||||
import com.gear.mat.domain.MatProductOutsourceOrder;
|
||||
import com.gear.mat.domain.bo.MatProductOutsourceOrderBo;
|
||||
import com.gear.mat.domain.vo.MatProductOutsourceOrderVo;
|
||||
import com.gear.mat.mapper.MatProductMapper;
|
||||
import com.gear.mat.mapper.MatProductOutsourceOrderMapper;
|
||||
import com.gear.mat.service.IMatProductOutsourceOrderService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class MatProductOutsourceOrderServiceImpl implements IMatProductOutsourceOrderService {
|
||||
|
||||
private static final String PRODUCT_TYPE_SEMI = "semi";
|
||||
|
||||
private final MatProductOutsourceOrderMapper baseMapper;
|
||||
private final MatProductMapper matProductMapper;
|
||||
|
||||
@Override
|
||||
public MatProductOutsourceOrderVo queryById(Long orderId) {
|
||||
return baseMapper.selectVoById(orderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<MatProductOutsourceOrderVo> queryPageList(MatProductOutsourceOrderBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<MatProductOutsourceOrder> qw = buildQueryWrapperPlus(bo);
|
||||
Page<MatProductOutsourceOrderVo> result = baseMapper.selectVoPagePlus(pageQuery.build(), qw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
private QueryWrapper<MatProductOutsourceOrder> buildQueryWrapperPlus(MatProductOutsourceOrderBo bo) {
|
||||
QueryWrapper<MatProductOutsourceOrder> qw = Wrappers.query();
|
||||
qw.eq(bo.getProductId() != null, "mo.product_id", bo.getProductId());
|
||||
qw.eq(bo.getCustomerId() != null, "mo.customer_id", bo.getCustomerId());
|
||||
qw.like(StringUtils.isNotBlank(bo.getCustomerName()), "mo.customer_name", bo.getCustomerName());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getOperator()), "mo.operator", bo.getOperator());
|
||||
qw.ge(bo.getBeginTime() != null, "mo.out_time", bo.getBeginTime());
|
||||
qw.le(bo.getEndTime() != null, "mo.out_time", bo.getEndTime());
|
||||
qw.eq("mo.del_flag", 0);
|
||||
qw.orderByDesc("mo.out_time");
|
||||
return qw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MatProductOutsourceOrderVo> queryList(MatProductOutsourceOrderBo bo) {
|
||||
QueryWrapper<MatProductOutsourceOrder> qw = buildQueryWrapperPlus(bo);
|
||||
return baseMapper.selectVoList(qw);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean insertByBoWithInventory(MatProductOutsourceOrderBo bo) {
|
||||
if (bo.getProductId() == null) {
|
||||
throw new IllegalArgumentException("半成品不能为空");
|
||||
}
|
||||
if (bo.getQuantity() == null || bo.getQuantity().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new IllegalArgumentException("委派数量必须大于0");
|
||||
}
|
||||
if (StringUtils.isBlank(bo.getCustomerName()) && bo.getCustomerId() == null) {
|
||||
throw new IllegalArgumentException("委托公司不能为空");
|
||||
}
|
||||
|
||||
MatProduct product = matProductMapper.selectById(bo.getProductId());
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("半成品不存在");
|
||||
}
|
||||
if (!PRODUCT_TYPE_SEMI.equals(product.getProductType())) {
|
||||
throw new IllegalArgumentException("只能委外半成品");
|
||||
}
|
||||
|
||||
BigDecimal current = product.getCurrentStock() == null ? BigDecimal.ZERO : product.getCurrentStock();
|
||||
if (current.compareTo(bo.getQuantity()) < 0) {
|
||||
throw new IllegalArgumentException("库存不足,无法委外出库");
|
||||
}
|
||||
|
||||
if (bo.getOutTime() == null) {
|
||||
bo.setOutTime(new Date());
|
||||
}
|
||||
if (StringUtils.isBlank(bo.getOperator())) {
|
||||
bo.setOperator("-");
|
||||
}
|
||||
if (StringUtils.isBlank(bo.getOrderNo())) {
|
||||
bo.setOrderNo(generateOrderNo());
|
||||
}
|
||||
|
||||
MatProductOutsourceOrder add = BeanUtil.toBean(bo, MatProductOutsourceOrder.class);
|
||||
add.setProductTypeSnapshot(product.getProductType());
|
||||
add.setReceivedQty(BigDecimal.ZERO);
|
||||
add.setReceiveFlag(0);
|
||||
boolean ok = baseMapper.insert(add) > 0;
|
||||
if (!ok) {
|
||||
throw new IllegalStateException("委外单保存失败");
|
||||
}
|
||||
bo.setOrderId(add.getOrderId());
|
||||
|
||||
product.setCurrentStock(current.subtract(bo.getQuantity()));
|
||||
int affected = matProductMapper.updateById(product);
|
||||
if (affected <= 0) {
|
||||
throw new IllegalStateException("扣减库存失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean receive(Long orderId, BigDecimal receiveQty, Date receiveTime, String receiveBy) {
|
||||
if (orderId == null) {
|
||||
throw new IllegalArgumentException("委外单不能为空");
|
||||
}
|
||||
if (receiveQty == null || receiveQty.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new IllegalArgumentException("收回数量必须大于0");
|
||||
}
|
||||
MatProductOutsourceOrder order = baseMapper.selectById(orderId);
|
||||
if (order == null) {
|
||||
throw new IllegalArgumentException("委外单不存在");
|
||||
}
|
||||
if (order.getDelFlag() != null && order.getDelFlag() != 0) {
|
||||
throw new IllegalArgumentException("委外单已撤回");
|
||||
}
|
||||
if (!PRODUCT_TYPE_SEMI.equals(order.getProductTypeSnapshot())) {
|
||||
throw new IllegalArgumentException("只能收回半成品委外单");
|
||||
}
|
||||
BigDecimal total = order.getQuantity() == null ? BigDecimal.ZERO : order.getQuantity();
|
||||
BigDecimal received = order.getReceivedQty() == null ? BigDecimal.ZERO : order.getReceivedQty();
|
||||
BigDecimal remaining = total.subtract(received);
|
||||
if (remaining.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new IllegalArgumentException("已全部收回");
|
||||
}
|
||||
if (receiveQty.compareTo(remaining) > 0) {
|
||||
throw new IllegalArgumentException("收回数量不能大于未收回数量");
|
||||
}
|
||||
|
||||
MatProduct product = matProductMapper.selectById(order.getProductId());
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("半成品不存在");
|
||||
}
|
||||
BigDecimal current = product.getCurrentStock() == null ? BigDecimal.ZERO : product.getCurrentStock();
|
||||
product.setCurrentStock(current.add(receiveQty));
|
||||
int affected = matProductMapper.updateById(product);
|
||||
if (affected <= 0) {
|
||||
throw new IllegalStateException("更新库存失败");
|
||||
}
|
||||
|
||||
BigDecimal nextReceived = received.add(receiveQty);
|
||||
order.setReceivedQty(nextReceived);
|
||||
order.setReceiveTime(receiveTime == null ? new Date() : receiveTime);
|
||||
order.setReceiveBy(StringUtils.isBlank(receiveBy) ? "-" : receiveBy);
|
||||
order.setReceiveFlag(nextReceived.compareTo(total) >= 0 ? 1 : 0);
|
||||
int updated = baseMapper.updateById(order);
|
||||
if (updated <= 0) {
|
||||
throw new IllegalStateException("更新委外单失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteWithValidByIdsWithInventory(Collection<Long> ids, Boolean isValid) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return false;
|
||||
}
|
||||
List<MatProductOutsourceOrder> records = baseMapper.selectBatchIds(ids);
|
||||
if (records == null || records.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (MatProductOutsourceOrder r : records) {
|
||||
if (r.getProductId() == null || r.getQuantity() == null) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal received = r.getReceivedQty() == null ? BigDecimal.ZERO : r.getReceivedQty();
|
||||
if (received.compareTo(BigDecimal.ZERO) > 0) {
|
||||
throw new IllegalArgumentException("已收回的委外单不可撤回");
|
||||
}
|
||||
revertStock(r.getProductId(), r.getQuantity());
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
private void revertStock(Long productId, BigDecimal qty) {
|
||||
MatProduct product = matProductMapper.selectById(productId);
|
||||
if (product == null) {
|
||||
throw new IllegalArgumentException("半成品不存在");
|
||||
}
|
||||
BigDecimal current = product.getCurrentStock() == null ? BigDecimal.ZERO : product.getCurrentStock();
|
||||
product.setCurrentStock(current.add(qty));
|
||||
int affected = matProductMapper.updateById(product);
|
||||
if (affected <= 0) {
|
||||
throw new IllegalStateException("回滚库存失败");
|
||||
}
|
||||
}
|
||||
|
||||
private String generateOrderNo() {
|
||||
String ts = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
||||
int rnd = (int) (Math.random() * 9000) + 1000;
|
||||
return "WW" + ts + rnd;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.gear.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.gear.mat.domain.bo.MatProductImportBo;
|
||||
import com.gear.mat.domain.bo.MatProductMaterialRelationBo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -22,9 +23,11 @@ import com.gear.mat.service.IMatProductMaterialRelationService;
|
||||
import com.gear.mat.domain.vo.MatMaterialVo;
|
||||
import com.gear.mat.domain.vo.MatProductMaterialRelationVo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -38,6 +41,9 @@ import java.util.ArrayList;
|
||||
@Service
|
||||
public class MatProductServiceImpl implements IMatProductService {
|
||||
|
||||
private static final String PRODUCT_TYPE_PRODUCT = "product";
|
||||
private static final String PRODUCT_TYPE_SEMI = "semi";
|
||||
|
||||
private final MatProductMapper baseMapper;
|
||||
private final IMatMaterialService matMaterialService;
|
||||
private final IMatProductMaterialRelationService productMaterialRelationService;
|
||||
@@ -71,12 +77,12 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<MatProduct> buildQueryWrapper(MatProductBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<MatProduct> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getProductName()), MatProduct::getProductName, bo.getProductName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSpec()), MatProduct::getSpec, bo.getSpec());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getModel()), MatProduct::getModel, bo.getModel());
|
||||
lqw.eq(bo.getUnitPrice() != null, MatProduct::getUnitPrice, bo.getUnitPrice());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getProductType()), MatProduct::getProductType, bo.getProductType());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -111,8 +117,11 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
productWithMaterialsVo.setSpec(productVo.getSpec());
|
||||
productWithMaterialsVo.setModel(productVo.getModel());
|
||||
productWithMaterialsVo.setUnitPrice(productVo.getUnitPrice());
|
||||
productWithMaterialsVo.setProductType(productVo.getProductType());
|
||||
productWithMaterialsVo.setCurrentStock(productVo.getCurrentStock());
|
||||
productWithMaterialsVo.setRemark(productVo.getRemark());
|
||||
// productWithMaterialsVo.setProductImages(productVo.getProductImages());
|
||||
productWithMaterialsVo.setProductImages(productVo.getProductImages());
|
||||
productWithMaterialsVo.setProductPdfs(productVo.getProductPdfs());
|
||||
|
||||
// 查询并设置关联的配料信息
|
||||
List<MatProductMaterialRelationVo> relations = productMaterialRelationService.queryList(
|
||||
@@ -169,7 +178,11 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(MatProductBo bo) {
|
||||
System.out.println("插入产品,productPdfs: " + bo.getProductPdfs());
|
||||
MatProduct add = BeanUtil.toBean(bo, MatProduct.class);
|
||||
add.setProductType(normalizeProductType(add.getProductType()));
|
||||
add.setCurrentStock(normalizeCurrentStock(add.getCurrentStock()));
|
||||
System.out.println("转换后,productPdfs: " + add.getProductPdfs());
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
@@ -183,7 +196,11 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(MatProductBo bo) {
|
||||
System.out.println("修改产品,productPdfs: " + bo.getProductPdfs());
|
||||
MatProduct update = BeanUtil.toBean(bo, MatProduct.class);
|
||||
update.setProductType(normalizeProductType(update.getProductType()));
|
||||
update.setCurrentStock(normalizeCurrentStock(update.getCurrentStock()));
|
||||
System.out.println("转换后,productPdfs: " + update.getProductPdfs());
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
@@ -205,4 +222,70 @@ public class MatProductServiceImpl implements IMatProductService {
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importByExcel(List<MatProductImportBo> list, Boolean updateSupport) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
return "导入数据为空";
|
||||
}
|
||||
int success = 0;
|
||||
int skipped = 0;
|
||||
for (MatProductImportBo row : list) {
|
||||
String productName = row == null ? null : StringUtils.trim(row.getProductName());
|
||||
String spec = row == null ? null : StringUtils.trim(row.getSpec());
|
||||
String model = row == null ? null : StringUtils.trim(row.getModel());
|
||||
if (StringUtils.isBlank(productName)) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
LambdaQueryWrapper<MatProduct> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(MatProduct::getProductName, productName)
|
||||
.eq(MatProduct::getSpec, Objects.toString(spec, ""))
|
||||
.eq(MatProduct::getModel, Objects.toString(model, ""))
|
||||
.last("limit 1");
|
||||
MatProduct exist = baseMapper.selectOne(lqw);
|
||||
if (exist != null && !Boolean.TRUE.equals(updateSupport)) {
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
MatProduct data = exist == null ? new MatProduct() : exist;
|
||||
data.setProductName(productName);
|
||||
data.setSpec(spec);
|
||||
data.setModel(model);
|
||||
data.setUnitPrice(row.getUnitPrice());
|
||||
data.setRemark(row.getRemark());
|
||||
String images = StringUtils.trim(row.getProductImages());
|
||||
if (StringUtils.isNotBlank(images)) {
|
||||
data.setProductImages(images);
|
||||
}
|
||||
data.setProductType(normalizeProductType(data.getProductType()));
|
||||
data.setCurrentStock(normalizeCurrentStock(data.getCurrentStock()));
|
||||
if (exist == null) {
|
||||
baseMapper.insert(data);
|
||||
} else {
|
||||
baseMapper.updateById(data);
|
||||
}
|
||||
success++;
|
||||
}
|
||||
return "导入完成,成功 " + success + " 条,跳过 " + skipped + " 条";
|
||||
}
|
||||
|
||||
private String normalizeProductType(String productType) {
|
||||
String val = StringUtils.trim(productType);
|
||||
if (StringUtils.isBlank(val)) {
|
||||
return PRODUCT_TYPE_PRODUCT;
|
||||
}
|
||||
if (PRODUCT_TYPE_SEMI.equals(val)) {
|
||||
return PRODUCT_TYPE_SEMI;
|
||||
}
|
||||
if (PRODUCT_TYPE_PRODUCT.equals(val)) {
|
||||
return PRODUCT_TYPE_PRODUCT;
|
||||
}
|
||||
return PRODUCT_TYPE_PRODUCT;
|
||||
}
|
||||
|
||||
private BigDecimal normalizeCurrentStock(BigDecimal currentStock) {
|
||||
return currentStock == null ? BigDecimal.ZERO : currentStock;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,7 @@ public class MatPurchaseInDetailServiceImpl implements IMatPurchaseInDetailServi
|
||||
qw.ge(bo.getBeginTime() != null, "mpid.in_time", bo.getBeginTime());
|
||||
qw.le(bo.getEndTime() != null, "mpid.in_time", bo.getEndTime());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getOperator()), "mpid.operator", bo.getOperator());
|
||||
qw.eq(StringUtils.isNotBlank(bo.getFactory()), "mm.factory", bo.getFactory());
|
||||
// 逻辑删除
|
||||
qw.eq("mpid.del_flag", 0);
|
||||
// 排序
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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="com.gear.mat.mapper.MatProductInDetailMapper">
|
||||
|
||||
<resultMap type="com.gear.mat.domain.MatProductInDetail" id="MatProductInDetailResult">
|
||||
<result property="detailId" column="detail_id"/>
|
||||
<result property="productId" column="product_id"/>
|
||||
<result property="inNum" column="in_num"/>
|
||||
<result property="inTime" column="in_time"/>
|
||||
<result property="operator" column="operator"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.gear.mat.domain.vo.MatProductInDetailVo">
|
||||
select mpid.detail_id AS detailId,
|
||||
mpid.product_id AS productId,
|
||||
mpid.in_num AS inNum,
|
||||
mpid.in_time AS inTime,
|
||||
mpid.operator AS operator,
|
||||
mpid.create_time AS createTime,
|
||||
mpid.create_by AS createBy,
|
||||
mpid.update_time AS updateTime,
|
||||
mpid.update_by AS updateBy,
|
||||
mpid.remark AS remark,
|
||||
mp.product_name AS productName,
|
||||
mp.spec AS spec,
|
||||
mp.model AS model,
|
||||
mp.product_type AS productType,
|
||||
mp.current_stock AS currentStock
|
||||
FROM mat_product_in_detail mpid
|
||||
LEFT JOIN mat_product mp ON mpid.product_id = mp.product_id AND mp.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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="com.gear.mat.mapper.MatProductOutsourceOrderMapper">
|
||||
|
||||
<resultMap type="com.gear.mat.domain.MatProductOutsourceOrder" id="MatProductOutsourceOrderResult">
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="orderNo" column="order_no"/>
|
||||
<result property="productId" column="product_id"/>
|
||||
<result property="productTypeSnapshot" column="product_type_snapshot"/>
|
||||
<result property="customerId" column="customer_id"/>
|
||||
<result property="customerName" column="customer_name"/>
|
||||
<result property="quantity" column="quantity"/>
|
||||
<result property="outTime" column="out_time"/>
|
||||
<result property="operator" column="operator"/>
|
||||
<result property="receivedQty" column="received_qty"/>
|
||||
<result property="receiveFlag" column="receive_flag"/>
|
||||
<result property="receiveTime" column="receive_time"/>
|
||||
<result property="receiveBy" column="receive_by"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.gear.mat.domain.vo.MatProductOutsourceOrderVo">
|
||||
select mo.order_id AS orderId,
|
||||
mo.order_no AS orderNo,
|
||||
mo.product_id AS productId,
|
||||
mp.product_name AS productName,
|
||||
mp.spec AS spec,
|
||||
mp.model AS model,
|
||||
mo.product_type_snapshot AS productTypeSnapshot,
|
||||
mo.customer_id AS customerId,
|
||||
mo.customer_name AS customerName,
|
||||
mo.quantity AS quantity,
|
||||
mo.received_qty AS receivedQty,
|
||||
mo.receive_flag AS receiveFlag,
|
||||
mo.out_time AS outTime,
|
||||
mo.receive_time AS receiveTime,
|
||||
mo.receive_by AS receiveBy,
|
||||
mo.operator AS operator,
|
||||
mo.remark AS remark,
|
||||
mo.create_time AS createTime,
|
||||
mo.create_by AS createBy,
|
||||
mo.update_time AS updateTime,
|
||||
mo.update_by AS updateBy
|
||||
FROM mat_product_outsource_order mo
|
||||
LEFT JOIN mat_product mp ON mo.product_id = mp.product_id AND mp.del_flag = 0
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.gear.mes.production.controller;
|
||||
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.AjaxResult;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.mes.production.domain.GearProductionTask;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskListVo;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskWithDetailVo;
|
||||
import com.gear.mes.production.service.IGearProductionTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/mes/production/task")
|
||||
public class GearProductionTaskController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IGearProductionTaskService productionTaskService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearProductionTaskListVo> list(GearProductionTask query) {
|
||||
startPage();
|
||||
List<GearProductionTaskListVo> list = productionTaskService.selectTaskList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/{taskId}")
|
||||
public AjaxResult getInfo(@PathVariable("taskId") Long taskId) {
|
||||
return AjaxResult.success(productionTaskService.selectTaskWithDetail(taskId));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public R<Long> add(@RequestBody GearProductionTaskWithDetailVo bo) {
|
||||
Long taskId = productionTaskService.insertTaskWithDetail(bo);
|
||||
if (taskId == null) {
|
||||
return R.fail("新增失败");
|
||||
}
|
||||
return R.ok(taskId);
|
||||
}
|
||||
|
||||
@PostMapping("/{taskId}/complete")
|
||||
public R<Void> complete(@PathVariable("taskId") Long taskId) {
|
||||
boolean ok = productionTaskService.completeTask(taskId);
|
||||
if (!ok) {
|
||||
return R.fail("完成失败");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/{taskId}/uncomplete")
|
||||
public R<Void> uncomplete(@PathVariable("taskId") Long taskId) {
|
||||
boolean ok = productionTaskService.uncompleteTask(taskId);
|
||||
if (!ok) {
|
||||
return R.fail("撤销完成失败");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/{taskId}/start")
|
||||
public R<Void> start(@PathVariable("taskId") Long taskId) {
|
||||
boolean ok = productionTaskService.startTask(taskId);
|
||||
if (!ok) {
|
||||
return R.fail("开始失败");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/{taskId}/pause")
|
||||
public R<Void> pause(@PathVariable("taskId") Long taskId) {
|
||||
boolean ok = productionTaskService.pauseTask(taskId);
|
||||
if (!ok) {
|
||||
return R.fail("暂停失败");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/{taskId}/resume")
|
||||
public R<Void> resume(@PathVariable("taskId") Long taskId) {
|
||||
boolean ok = productionTaskService.resumeTask(taskId);
|
||||
if (!ok) {
|
||||
return R.fail("继续失败");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public R<Void> edit(@RequestBody GearProductionTaskWithDetailVo bo) {
|
||||
boolean ok = productionTaskService.updateTaskWithDetail(bo);
|
||||
if (!ok) {
|
||||
return R.fail("修改失败");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping("/{taskId}")
|
||||
public R<Void> remove(@PathVariable("taskId") Long taskId) {
|
||||
boolean ok = productionTaskService.deleteTask(taskId);
|
||||
if (!ok) {
|
||||
return R.fail("删除失败");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.gear.mes.production.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class GearProductionTask extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long taskId;
|
||||
|
||||
private String taskCode;
|
||||
|
||||
private String taskName;
|
||||
|
||||
private String status;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date planStartTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date planEndTime;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String delFlag;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date beginTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.gear.mes.production.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class GearProductionTaskMaterial {
|
||||
private Long lineId;
|
||||
|
||||
private Long taskId;
|
||||
|
||||
private Long materialId;
|
||||
|
||||
private String materialRole;
|
||||
|
||||
private BigDecimal planQty;
|
||||
|
||||
private BigDecimal usedQty;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.gear.mes.production.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class GearProductionTaskProduct {
|
||||
private Long lineId;
|
||||
|
||||
private Long taskId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private BigDecimal planQty;
|
||||
|
||||
private BigDecimal finishedQty;
|
||||
|
||||
private BigDecimal badQty;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.gear.mes.production.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class GearProductionTaskListVo {
|
||||
private Long taskId;
|
||||
|
||||
private String taskCode;
|
||||
|
||||
private String taskName;
|
||||
|
||||
private String status;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date planStartTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date planEndTime;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
private String updateBy;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
private BigDecimal planQty;
|
||||
|
||||
private BigDecimal finishedQty;
|
||||
|
||||
private BigDecimal badQty;
|
||||
|
||||
private BigDecimal unfinishedQty;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.gear.mes.production.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class GearProductionTaskMaterialVo {
|
||||
private Long lineId;
|
||||
|
||||
private Long taskId;
|
||||
|
||||
private Long materialId;
|
||||
|
||||
private String materialRole;
|
||||
|
||||
private BigDecimal planQty;
|
||||
|
||||
private BigDecimal usedQty;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String materialName;
|
||||
|
||||
private Integer materialType;
|
||||
|
||||
private String spec;
|
||||
|
||||
private String model;
|
||||
|
||||
private String factory;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.gear.mes.production.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class GearProductionTaskProductVo {
|
||||
private Long lineId;
|
||||
|
||||
private Long taskId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private BigDecimal planQty;
|
||||
|
||||
private BigDecimal finishedQty;
|
||||
|
||||
private BigDecimal badQty;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String productCode;
|
||||
|
||||
private String productType;
|
||||
|
||||
private String spec;
|
||||
|
||||
private String model;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.gear.mes.production.domain.vo;
|
||||
|
||||
import com.gear.mes.production.domain.GearProductionTask;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GearProductionTaskWithDetailVo {
|
||||
private GearProductionTask task;
|
||||
|
||||
private List<GearProductionTaskProductVo> products;
|
||||
|
||||
private List<GearProductionTaskMaterialVo> materials;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.gear.mes.production.mapper;
|
||||
|
||||
import com.gear.mes.production.domain.GearProductionTask;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskListVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface GearProductionTaskMapper {
|
||||
List<GearProductionTaskListVo> selectTaskList(GearProductionTask query);
|
||||
|
||||
GearProductionTask selectTaskById(@Param("taskId") Long taskId);
|
||||
|
||||
int insertTask(GearProductionTask task);
|
||||
|
||||
int updateTask(GearProductionTask task);
|
||||
|
||||
int updateTaskStatus(@Param("taskId") Long taskId,
|
||||
@Param("status") String status,
|
||||
@Param("updateBy") String updateBy,
|
||||
@Param("updateTime") Date updateTime);
|
||||
|
||||
int updateDelFlag(@Param("taskId") Long taskId,
|
||||
@Param("delFlag") String delFlag,
|
||||
@Param("updateBy") String updateBy,
|
||||
@Param("updateTime") Date updateTime);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.gear.mes.production.mapper;
|
||||
|
||||
import com.gear.mes.production.domain.GearProductionTaskMaterial;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskMaterialVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GearProductionTaskMaterialMapper {
|
||||
List<GearProductionTaskMaterialVo> selectByTaskId(@Param("taskId") Long taskId);
|
||||
|
||||
List<GearProductionTaskMaterial> selectRequirementByTaskId(@Param("taskId") Long taskId);
|
||||
|
||||
int insertBatch(@Param("list") List<GearProductionTaskMaterial> list);
|
||||
|
||||
int deleteByTaskId(@Param("taskId") Long taskId);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.gear.mes.production.mapper;
|
||||
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskProductVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GearProductionTaskProductMapper {
|
||||
List<GearProductionTaskProductVo> selectByTaskId(@Param("taskId") Long taskId);
|
||||
|
||||
int insertBatch(@Param("list") List<com.gear.mes.production.domain.GearProductionTaskProduct> list);
|
||||
|
||||
int deleteByTaskId(@Param("taskId") Long taskId);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.gear.mes.production.service;
|
||||
|
||||
import com.gear.mes.production.domain.GearProductionTask;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskListVo;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskWithDetailVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IGearProductionTaskService {
|
||||
List<GearProductionTaskListVo> selectTaskList(GearProductionTask query);
|
||||
|
||||
GearProductionTaskWithDetailVo selectTaskWithDetail(Long taskId);
|
||||
|
||||
Long insertTaskWithDetail(GearProductionTaskWithDetailVo bo);
|
||||
|
||||
boolean completeTask(Long taskId);
|
||||
|
||||
boolean uncompleteTask(Long taskId);
|
||||
|
||||
boolean startTask(Long taskId);
|
||||
|
||||
boolean pauseTask(Long taskId);
|
||||
|
||||
boolean resumeTask(Long taskId);
|
||||
|
||||
boolean updateTaskWithDetail(GearProductionTaskWithDetailVo bo);
|
||||
|
||||
boolean deleteTask(Long taskId);
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
package com.gear.mes.production.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.gear.mes.production.domain.GearProductionTask;
|
||||
import com.gear.mes.production.domain.GearProductionTaskMaterial;
|
||||
import com.gear.mes.production.domain.GearProductionTaskProduct;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskListVo;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskMaterialVo;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskWithDetailVo;
|
||||
import com.gear.mes.production.domain.vo.GearProductionTaskProductVo;
|
||||
import com.gear.common.utils.DateUtils;
|
||||
import com.gear.common.helper.LoginHelper;
|
||||
import com.gear.mes.production.mapper.GearProductionTaskMapper;
|
||||
import com.gear.mes.production.mapper.GearProductionTaskMaterialMapper;
|
||||
import com.gear.mes.production.mapper.GearProductionTaskProductMapper;
|
||||
import com.gear.mes.production.service.IGearProductionTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class GearProductionTaskServiceImpl implements IGearProductionTaskService {
|
||||
|
||||
@Autowired
|
||||
private GearProductionTaskMapper taskMapper;
|
||||
|
||||
@Autowired
|
||||
private GearProductionTaskProductMapper productMapper;
|
||||
|
||||
@Autowired
|
||||
private GearProductionTaskMaterialMapper materialMapper;
|
||||
|
||||
@Override
|
||||
public List<GearProductionTaskListVo> selectTaskList(GearProductionTask query) {
|
||||
return taskMapper.selectTaskList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GearProductionTaskWithDetailVo selectTaskWithDetail(Long taskId) {
|
||||
GearProductionTask task = taskMapper.selectTaskById(taskId);
|
||||
GearProductionTaskWithDetailVo vo = new GearProductionTaskWithDetailVo();
|
||||
vo.setTask(task);
|
||||
if (taskId == null) {
|
||||
vo.setProducts(null);
|
||||
vo.setMaterials(null);
|
||||
return vo;
|
||||
}
|
||||
vo.setProducts(productMapper.selectByTaskId(taskId));
|
||||
List<GearProductionTaskMaterialVo> materials = materialMapper.selectByTaskId(taskId);
|
||||
if (task != null && "2".equals(String.valueOf(task.getStatus())) && (materials == null || materials.isEmpty())) {
|
||||
regenerateReceiptMaterials(taskId);
|
||||
materials = materialMapper.selectByTaskId(taskId);
|
||||
}
|
||||
vo.setMaterials(materials);
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long insertTaskWithDetail(GearProductionTaskWithDetailVo bo) {
|
||||
if (bo == null || bo.getTask() == null) {
|
||||
return null;
|
||||
}
|
||||
GearProductionTask task = bo.getTask();
|
||||
Long taskId = task.getTaskId() != null ? task.getTaskId() : IdUtil.getSnowflakeNextId();
|
||||
task.setTaskId(taskId);
|
||||
if (task.getDelFlag() == null) {
|
||||
task.setDelFlag("0");
|
||||
}
|
||||
if (task.getStatus() == null || String.valueOf(task.getStatus()).trim().isEmpty()) {
|
||||
task.setStatus("0");
|
||||
}
|
||||
String username = LoginHelper.getUsername();
|
||||
task.setCreateBy(username);
|
||||
task.setUpdateBy(username);
|
||||
task.setCreateTime(DateUtils.getNowDate());
|
||||
task.setUpdateTime(DateUtils.getNowDate());
|
||||
taskMapper.insertTask(task);
|
||||
|
||||
Map<Long, GearProductionTaskProduct> productMap = new LinkedHashMap<>();
|
||||
if (bo.getProducts() != null) {
|
||||
bo.getProducts().forEach(p -> {
|
||||
if (p == null || p.getProductId() == null) return;
|
||||
GearProductionTaskProduct hit = productMap.get(p.getProductId());
|
||||
if (hit == null) {
|
||||
GearProductionTaskProduct row = new GearProductionTaskProduct();
|
||||
row.setLineId(IdUtil.getSnowflakeNextId());
|
||||
row.setTaskId(taskId);
|
||||
row.setProductId(p.getProductId());
|
||||
row.setPlanQty(p.getPlanQty() == null ? BigDecimal.ZERO : p.getPlanQty());
|
||||
row.setFinishedQty(p.getFinishedQty() == null ? BigDecimal.ZERO : p.getFinishedQty());
|
||||
row.setBadQty(p.getBadQty() == null ? BigDecimal.ZERO : p.getBadQty());
|
||||
row.setUnit(p.getUnit());
|
||||
row.setRemark(p.getRemark());
|
||||
productMap.put(p.getProductId(), row);
|
||||
return;
|
||||
}
|
||||
BigDecimal planQty = p.getPlanQty() == null ? BigDecimal.ZERO : p.getPlanQty();
|
||||
BigDecimal finishedQty = p.getFinishedQty() == null ? BigDecimal.ZERO : p.getFinishedQty();
|
||||
BigDecimal badQty = p.getBadQty() == null ? BigDecimal.ZERO : p.getBadQty();
|
||||
hit.setPlanQty((hit.getPlanQty() == null ? BigDecimal.ZERO : hit.getPlanQty()).add(planQty));
|
||||
hit.setFinishedQty((hit.getFinishedQty() == null ? BigDecimal.ZERO : hit.getFinishedQty()).add(finishedQty));
|
||||
hit.setBadQty((hit.getBadQty() == null ? BigDecimal.ZERO : hit.getBadQty()).add(badQty));
|
||||
if ((hit.getUnit() == null || hit.getUnit().trim().isEmpty()) && p.getUnit() != null && !p.getUnit().trim().isEmpty()) {
|
||||
hit.setUnit(p.getUnit());
|
||||
}
|
||||
if ((hit.getRemark() == null || hit.getRemark().trim().isEmpty()) && p.getRemark() != null && !p.getRemark().trim().isEmpty()) {
|
||||
hit.setRemark(p.getRemark());
|
||||
}
|
||||
});
|
||||
}
|
||||
List<GearProductionTaskProduct> products = new ArrayList<>(productMap.values());
|
||||
if (!products.isEmpty()) {
|
||||
productMapper.insertBatch(products);
|
||||
}
|
||||
|
||||
return taskId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean completeTask(Long taskId) {
|
||||
if (taskId == null) {
|
||||
return false;
|
||||
}
|
||||
GearProductionTask task = taskMapper.selectTaskById(taskId);
|
||||
if (task == null) {
|
||||
return false;
|
||||
}
|
||||
if ("2".equals(String.valueOf(task.getStatus()))) {
|
||||
return true;
|
||||
}
|
||||
String username = LoginHelper.getUsername();
|
||||
int updated = taskMapper.updateTaskStatus(taskId, "2", username, DateUtils.getNowDate());
|
||||
if (updated <= 0) {
|
||||
GearProductionTask after = taskMapper.selectTaskById(taskId);
|
||||
return after != null && "2".equals(String.valueOf(after.getStatus()));
|
||||
}
|
||||
regenerateReceiptMaterials(taskId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean uncompleteTask(Long taskId) {
|
||||
if (taskId == null) {
|
||||
return false;
|
||||
}
|
||||
GearProductionTask task = taskMapper.selectTaskById(taskId);
|
||||
if (task == null) {
|
||||
return false;
|
||||
}
|
||||
if (!"2".equals(String.valueOf(task.getStatus()))) {
|
||||
return true;
|
||||
}
|
||||
String username = LoginHelper.getUsername();
|
||||
int updated = taskMapper.updateTaskStatus(taskId, "1", username, DateUtils.getNowDate());
|
||||
if (updated <= 0) {
|
||||
GearProductionTask after = taskMapper.selectTaskById(taskId);
|
||||
return after != null && !"2".equals(String.valueOf(after.getStatus()));
|
||||
}
|
||||
materialMapper.deleteByTaskId(taskId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean startTask(Long taskId) {
|
||||
return setStatus(taskId, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean pauseTask(Long taskId) {
|
||||
return setStatus(taskId, "3");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean resumeTask(Long taskId) {
|
||||
return setStatus(taskId, "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateTaskWithDetail(GearProductionTaskWithDetailVo bo) {
|
||||
if (bo == null || bo.getTask() == null || bo.getTask().getTaskId() == null) {
|
||||
return false;
|
||||
}
|
||||
Long taskId = bo.getTask().getTaskId();
|
||||
GearProductionTask existed = taskMapper.selectTaskById(taskId);
|
||||
if (existed == null) {
|
||||
return false;
|
||||
}
|
||||
GearProductionTask task = bo.getTask();
|
||||
task.setStatus(existed.getStatus());
|
||||
task.setDelFlag(existed.getDelFlag());
|
||||
task.setUpdateBy(LoginHelper.getUsername());
|
||||
task.setUpdateTime(DateUtils.getNowDate());
|
||||
taskMapper.updateTask(task);
|
||||
|
||||
Map<Long, GearProductionTaskProductVo> existingProducts = new LinkedHashMap<>();
|
||||
List<GearProductionTaskProductVo> existList = productMapper.selectByTaskId(taskId);
|
||||
if (existList != null) {
|
||||
existList.forEach(p -> {
|
||||
if (p != null && p.getProductId() != null) {
|
||||
existingProducts.put(p.getProductId(), p);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
productMapper.deleteByTaskId(taskId);
|
||||
List<GearProductionTaskProduct> rows = mergeProductsForSave(taskId, bo.getProducts(), existingProducts);
|
||||
if (!rows.isEmpty()) {
|
||||
productMapper.insertBatch(rows);
|
||||
}
|
||||
if ("2".equals(String.valueOf(existed.getStatus()))) {
|
||||
regenerateReceiptMaterials(taskId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteTask(Long taskId) {
|
||||
if (taskId == null) {
|
||||
return false;
|
||||
}
|
||||
String username = LoginHelper.getUsername();
|
||||
int updated = taskMapper.updateDelFlag(taskId, "1", username, DateUtils.getNowDate());
|
||||
if (updated <= 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean setStatus(Long taskId, String targetStatus) {
|
||||
if (taskId == null) {
|
||||
return false;
|
||||
}
|
||||
GearProductionTask task = taskMapper.selectTaskById(taskId);
|
||||
if (task == null) {
|
||||
return false;
|
||||
}
|
||||
if (targetStatus.equals(String.valueOf(task.getStatus()))) {
|
||||
return true;
|
||||
}
|
||||
if ("2".equals(String.valueOf(task.getStatus())) && !"2".equals(targetStatus)) {
|
||||
return false;
|
||||
}
|
||||
String username = LoginHelper.getUsername();
|
||||
int updated = taskMapper.updateTaskStatus(taskId, targetStatus, username, DateUtils.getNowDate());
|
||||
if (updated <= 0) {
|
||||
GearProductionTask after = taskMapper.selectTaskById(taskId);
|
||||
return after != null && targetStatus.equals(String.valueOf(after.getStatus()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private List<GearProductionTaskProduct> mergeProductsForSave(Long taskId,
|
||||
List<GearProductionTaskProductVo> incoming,
|
||||
Map<Long, GearProductionTaskProductVo> existed) {
|
||||
Map<Long, GearProductionTaskProduct> map = new LinkedHashMap<>();
|
||||
if (incoming != null) {
|
||||
incoming.forEach(p -> {
|
||||
if (p == null || p.getProductId() == null) return;
|
||||
GearProductionTaskProduct hit = map.get(p.getProductId());
|
||||
BigDecimal planQty = p.getPlanQty() == null ? BigDecimal.ZERO : p.getPlanQty();
|
||||
if (hit == null) {
|
||||
GearProductionTaskProduct row = new GearProductionTaskProduct();
|
||||
row.setLineId(IdUtil.getSnowflakeNextId());
|
||||
row.setTaskId(taskId);
|
||||
row.setProductId(p.getProductId());
|
||||
row.setPlanQty(planQty);
|
||||
GearProductionTaskProductVo old = existed != null ? existed.get(p.getProductId()) : null;
|
||||
row.setFinishedQty(old != null && old.getFinishedQty() != null ? old.getFinishedQty() : BigDecimal.ZERO);
|
||||
row.setBadQty(old != null && old.getBadQty() != null ? old.getBadQty() : BigDecimal.ZERO);
|
||||
String unit = (p.getUnit() != null && !p.getUnit().trim().isEmpty()) ? p.getUnit() : (old != null ? old.getUnit() : null);
|
||||
row.setUnit(unit);
|
||||
row.setRemark(p.getRemark());
|
||||
map.put(p.getProductId(), row);
|
||||
return;
|
||||
}
|
||||
hit.setPlanQty((hit.getPlanQty() == null ? BigDecimal.ZERO : hit.getPlanQty()).add(planQty));
|
||||
if ((hit.getUnit() == null || hit.getUnit().trim().isEmpty()) && p.getUnit() != null && !p.getUnit().trim().isEmpty()) {
|
||||
hit.setUnit(p.getUnit());
|
||||
}
|
||||
if ((hit.getRemark() == null || hit.getRemark().trim().isEmpty()) && p.getRemark() != null && !p.getRemark().trim().isEmpty()) {
|
||||
hit.setRemark(p.getRemark());
|
||||
}
|
||||
});
|
||||
}
|
||||
return new ArrayList<>(map.values());
|
||||
}
|
||||
|
||||
private void regenerateReceiptMaterials(Long taskId) {
|
||||
materialMapper.deleteByTaskId(taskId);
|
||||
List<GearProductionTaskMaterial> required = materialMapper.selectRequirementByTaskId(taskId);
|
||||
if (required == null || required.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
List<GearProductionTaskMaterial> rows = new ArrayList<>();
|
||||
required.forEach(r -> {
|
||||
if (r == null || r.getMaterialId() == null) return;
|
||||
GearProductionTaskMaterial row = new GearProductionTaskMaterial();
|
||||
row.setLineId(IdUtil.getSnowflakeNextId());
|
||||
row.setTaskId(taskId);
|
||||
row.setMaterialId(r.getMaterialId());
|
||||
row.setMaterialRole(r.getMaterialRole());
|
||||
BigDecimal planQty = r.getPlanQty() == null ? BigDecimal.ZERO : r.getPlanQty();
|
||||
row.setPlanQty(planQty);
|
||||
row.setUsedQty(planQty);
|
||||
String unit = r.getUnit();
|
||||
row.setUnit(unit == null || unit.trim().isEmpty() ? "个" : unit);
|
||||
row.setRemark(null);
|
||||
rows.add(row);
|
||||
});
|
||||
if (!rows.isEmpty()) {
|
||||
materialMapper.insertBatch(rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<?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="com.gear.mes.production.mapper.GearProductionTaskMapper">
|
||||
|
||||
<select id="selectTaskList" parameterType="com.gear.mes.production.domain.GearProductionTask" resultType="com.gear.mes.production.domain.vo.GearProductionTaskListVo">
|
||||
SELECT
|
||||
t.task_id AS taskId,
|
||||
t.task_code AS taskCode,
|
||||
t.task_name AS taskName,
|
||||
t.status AS status,
|
||||
t.plan_start_time AS planStartTime,
|
||||
t.plan_end_time AS planEndTime,
|
||||
t.remark AS remark,
|
||||
t.create_by AS createBy,
|
||||
t.create_time AS createTime,
|
||||
t.update_by AS updateBy,
|
||||
t.update_time AS updateTime,
|
||||
IFNULL(SUM(p.plan_qty), 0) AS planQty,
|
||||
IFNULL(SUM(p.finished_qty), 0) AS finishedQty,
|
||||
IFNULL(SUM(p.bad_qty), 0) AS badQty,
|
||||
GREATEST(IFNULL(SUM(p.plan_qty), 0) - IFNULL(SUM(p.finished_qty), 0), 0) AS unfinishedQty
|
||||
FROM gear_production_task t
|
||||
LEFT JOIN gear_production_task_product p ON t.task_id = p.task_id
|
||||
<where>
|
||||
t.del_flag = '0'
|
||||
<if test="status != null and status != ''"> AND t.status = #{status}</if>
|
||||
<if test="taskCode != null and taskCode != ''"> AND t.task_code LIKE CONCAT('%', #{taskCode}, '%')</if>
|
||||
<if test="taskName != null and taskName != ''"> AND t.task_name LIKE CONCAT('%', #{taskName}, '%')</if>
|
||||
<if test="beginTime != null"> AND t.plan_start_time <![CDATA[>=]]> #{beginTime}</if>
|
||||
<if test="endTime != null"> AND t.plan_start_time <![CDATA[<=]]> #{endTime}</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
t.task_id,
|
||||
t.task_code,
|
||||
t.task_name,
|
||||
t.status,
|
||||
t.plan_start_time,
|
||||
t.plan_end_time,
|
||||
t.remark,
|
||||
t.create_by,
|
||||
t.create_time,
|
||||
t.update_by,
|
||||
t.update_time
|
||||
ORDER BY t.update_time DESC, t.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectTaskById" resultType="com.gear.mes.production.domain.GearProductionTask">
|
||||
SELECT
|
||||
task_id AS taskId,
|
||||
task_code AS taskCode,
|
||||
task_name AS taskName,
|
||||
status AS status,
|
||||
plan_start_time AS planStartTime,
|
||||
plan_end_time AS planEndTime,
|
||||
remark AS remark,
|
||||
create_by AS createBy,
|
||||
create_time AS createTime,
|
||||
update_by AS updateBy,
|
||||
update_time AS updateTime
|
||||
FROM gear_production_task
|
||||
WHERE task_id = #{taskId}
|
||||
AND del_flag = '0'
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertTask" parameterType="com.gear.mes.production.domain.GearProductionTask">
|
||||
INSERT INTO gear_production_task (
|
||||
task_id,
|
||||
task_code,
|
||||
task_name,
|
||||
status,
|
||||
plan_start_time,
|
||||
plan_end_time,
|
||||
remark,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
) VALUES (
|
||||
#{taskId},
|
||||
#{taskCode},
|
||||
#{taskName},
|
||||
#{status},
|
||||
#{planStartTime},
|
||||
#{planEndTime},
|
||||
#{remark},
|
||||
#{delFlag},
|
||||
#{createBy},
|
||||
#{createTime},
|
||||
#{updateBy},
|
||||
#{updateTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateTask" parameterType="com.gear.mes.production.domain.GearProductionTask">
|
||||
UPDATE gear_production_task
|
||||
SET
|
||||
task_code = #{taskCode},
|
||||
task_name = #{taskName},
|
||||
status = #{status},
|
||||
plan_start_time = #{planStartTime},
|
||||
plan_end_time = #{planEndTime},
|
||||
remark = #{remark},
|
||||
update_by = #{updateBy},
|
||||
update_time = #{updateTime}
|
||||
WHERE task_id = #{taskId}
|
||||
AND del_flag = '0'
|
||||
</update>
|
||||
|
||||
<update id="updateTaskStatus">
|
||||
UPDATE gear_production_task
|
||||
SET
|
||||
status = #{status},
|
||||
update_by = #{updateBy},
|
||||
update_time = #{updateTime}
|
||||
WHERE task_id = #{taskId}
|
||||
AND del_flag = '0'
|
||||
AND status <![CDATA[<>]]> #{status}
|
||||
</update>
|
||||
|
||||
<update id="updateDelFlag">
|
||||
UPDATE gear_production_task
|
||||
SET
|
||||
del_flag = #{delFlag},
|
||||
update_by = #{updateBy},
|
||||
update_time = #{updateTime}
|
||||
WHERE task_id = #{taskId}
|
||||
AND del_flag = '0'
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,79 @@
|
||||
<?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="com.gear.mes.production.mapper.GearProductionTaskMaterialMapper">
|
||||
|
||||
<select id="selectByTaskId" resultType="com.gear.mes.production.domain.vo.GearProductionTaskMaterialVo">
|
||||
SELECT
|
||||
m.line_id AS lineId,
|
||||
m.task_id AS taskId,
|
||||
m.material_id AS materialId,
|
||||
m.material_role AS materialRole,
|
||||
m.plan_qty AS planQty,
|
||||
m.used_qty AS usedQty,
|
||||
m.unit AS unit,
|
||||
m.remark AS remark,
|
||||
mm.material_name AS materialName,
|
||||
mm.material_type AS materialType,
|
||||
mm.spec AS spec,
|
||||
mm.model AS model,
|
||||
mm.factory AS factory
|
||||
FROM gear_production_task_material m
|
||||
LEFT JOIN mat_material mm ON m.material_id = mm.material_id
|
||||
WHERE m.task_id = #{taskId}
|
||||
ORDER BY m.material_role, m.line_id
|
||||
</select>
|
||||
|
||||
<select id="selectRequirementByTaskId" resultType="com.gear.mes.production.domain.GearProductionTaskMaterial">
|
||||
SELECT
|
||||
r.material_id AS materialId,
|
||||
CASE WHEN mm.material_type = 2 THEN 'main' ELSE 'aux' END AS materialRole,
|
||||
SUM(
|
||||
(
|
||||
CASE
|
||||
WHEN p.finished_qty IS NOT NULL AND p.finished_qty > 0 THEN p.finished_qty
|
||||
ELSE IFNULL(p.plan_qty, 0)
|
||||
END
|
||||
) * IFNULL(r.material_num, 0)
|
||||
) AS planQty,
|
||||
CASE WHEN mm.unit IS NULL OR mm.unit = '' THEN '个' ELSE mm.unit END AS unit
|
||||
FROM gear_production_task_product p
|
||||
JOIN mat_product_material_relation r ON p.product_id = r.product_id AND r.del_flag = 0
|
||||
LEFT JOIN mat_material mm ON r.material_id = mm.material_id
|
||||
WHERE p.task_id = #{taskId}
|
||||
GROUP BY r.material_id, mm.material_type, mm.unit
|
||||
ORDER BY mm.material_type DESC, MIN(IFNULL(r.sort, 0)), r.material_id
|
||||
</select>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO gear_production_task_material (
|
||||
line_id,
|
||||
task_id,
|
||||
material_id,
|
||||
material_role,
|
||||
plan_qty,
|
||||
used_qty,
|
||||
unit,
|
||||
remark
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.lineId},
|
||||
#{i.taskId},
|
||||
#{i.materialId},
|
||||
#{i.materialRole},
|
||||
#{i.planQty},
|
||||
#{i.usedQty},
|
||||
#{i.unit},
|
||||
#{i.remark}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByTaskId">
|
||||
DELETE FROM gear_production_task_material WHERE task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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="com.gear.mes.production.mapper.GearProductionTaskProductMapper">
|
||||
|
||||
<select id="selectByTaskId" resultType="com.gear.mes.production.domain.vo.GearProductionTaskProductVo">
|
||||
SELECT
|
||||
p.line_id AS lineId,
|
||||
p.task_id AS taskId,
|
||||
p.product_id AS productId,
|
||||
p.plan_qty AS planQty,
|
||||
p.finished_qty AS finishedQty,
|
||||
p.bad_qty AS badQty,
|
||||
p.unit AS unit,
|
||||
p.remark AS remark,
|
||||
COALESCE(gp.product_name, mp.product_name) AS productName,
|
||||
COALESCE(gp.product_code, CAST(mp.product_id AS CHAR)) AS productCode,
|
||||
COALESCE(gp.type, mp.product_type) AS productType,
|
||||
mp.spec AS spec,
|
||||
mp.model AS model
|
||||
FROM gear_production_task_product p
|
||||
LEFT JOIN gear_product gp ON p.product_id = gp.product_id
|
||||
LEFT JOIN mat_product mp ON p.product_id = mp.product_id
|
||||
WHERE p.task_id = #{taskId}
|
||||
ORDER BY p.line_id
|
||||
</select>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO gear_production_task_product (
|
||||
line_id,
|
||||
task_id,
|
||||
product_id,
|
||||
plan_qty,
|
||||
finished_qty,
|
||||
bad_qty,
|
||||
unit,
|
||||
remark
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
(
|
||||
#{i.lineId},
|
||||
#{i.taskId},
|
||||
#{i.productId},
|
||||
#{i.planQty},
|
||||
#{i.finishedQty},
|
||||
#{i.badQty},
|
||||
#{i.unit},
|
||||
#{i.remark}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByTaskId">
|
||||
DELETE FROM gear_production_task_product WHERE task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.bo.GearContractBo;
|
||||
import com.gear.oa.domain.vo.GearContractVo;
|
||||
import com.gear.oa.service.IGearContractService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/contract")
|
||||
public class GearContractController extends BaseController {
|
||||
|
||||
private final IGearContractService iGearContractService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearContractVo> list(GearContractBo bo, PageQuery pageQuery) {
|
||||
return iGearContractService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "合同编辑详情", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearContractBo bo, HttpServletResponse response) {
|
||||
List<GearContractVo> list = iGearContractService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "合同编辑详情", GearContractVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/{contractId}")
|
||||
public R<GearContractVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long contractId) {
|
||||
return R.ok(iGearContractService.queryById(contractId));
|
||||
}
|
||||
|
||||
@Log(title = "合同编辑详情", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearContractBo bo) {
|
||||
return toAjax(iGearContractService.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "合同编辑详情", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearContractBo bo) {
|
||||
return toAjax(iGearContractService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "合同编辑详情", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{contractIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] contractIds) {
|
||||
return toAjax(iGearContractService.deleteWithValidByIds(Arrays.asList(contractIds), true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.bo.GearContractDetailBo;
|
||||
import com.gear.oa.domain.vo.GearContractDetailVo;
|
||||
import com.gear.oa.service.IGearContractDetailService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/contractDetail")
|
||||
public class GearContractDetailController extends BaseController {
|
||||
|
||||
private final IGearContractDetailService iGearContractDetailService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearContractDetailVo> list(GearContractDetailBo bo, PageQuery pageQuery) {
|
||||
return iGearContractDetailService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "订单明细列表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearContractDetailBo bo, HttpServletResponse response) {
|
||||
List<GearContractDetailVo> list = iGearContractDetailService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "订单明细列表", GearContractDetailVo.class, response);
|
||||
}
|
||||
|
||||
@Log(title = "订单明细列表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearContractDetailBo bo) {
|
||||
return toAjax(iGearContractDetailService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "订单明细列表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{detailIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] detailIds) {
|
||||
return toAjax(iGearContractDetailService.deleteWithValidByIds(Arrays.asList(detailIds), true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.oa.domain.bo.GearOrderProductionBo;
|
||||
import com.gear.oa.domain.vo.GearOrderProductionVo;
|
||||
import com.gear.oa.service.IGearOrderProductionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单生产记录
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/orderProduction")
|
||||
public class GearOrderProductionController extends BaseController {
|
||||
|
||||
private final IGearOrderProductionService iGearOrderProductionService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearOrderProductionVo> list(GearOrderProductionBo bo, PageQuery pageQuery) {
|
||||
return iGearOrderProductionService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{productionId}")
|
||||
public R<GearOrderProductionVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long productionId) {
|
||||
return R.ok(iGearOrderProductionService.queryById(productionId));
|
||||
}
|
||||
|
||||
@Log(title = "订单生产记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearOrderProductionBo bo) {
|
||||
return toAjax(iGearOrderProductionService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "订单生产记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{productionIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] productionIds) {
|
||||
return toAjax(iGearOrderProductionService.deleteWithValidByIds(Arrays.asList(productionIds), true));
|
||||
}
|
||||
|
||||
@Log(title = "订单生产记录", businessType = BusinessType.OTHER)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/init/{orderId}")
|
||||
public R<Void> init(@NotNull(message = "订单ID不能为空") @PathVariable Long orderId) {
|
||||
return toAjax(iGearOrderProductionService.initByOrderId(orderId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.gear.oa.domain.vo.GearReturnExchangeVo;
|
||||
import com.gear.oa.domain.bo.GearReturnExchangeBo;
|
||||
import com.gear.oa.service.IGearReturnExchangeService;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 退换货管理
|
||||
@@ -47,6 +48,14 @@ public class GearReturnExchangeController extends BaseController {
|
||||
return iGearReturnExchangeService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汇总(总数/总金额/按状态/按类型)
|
||||
*/
|
||||
@GetMapping("/summary")
|
||||
public R<Map<String, Object>> summary(GearReturnExchangeBo bo) {
|
||||
return R.ok(iGearReturnExchangeService.summary(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出退换货管理列表
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.bo.GearSalesmanBo;
|
||||
import com.gear.oa.domain.vo.GearCustomerVo;
|
||||
import com.gear.oa.domain.vo.GearSalesmanVo;
|
||||
import com.gear.oa.service.IGearSalesmanService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 销售员管理
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/salesman")
|
||||
public class GearSalesmanController extends BaseController {
|
||||
|
||||
private final IGearSalesmanService iGearSalesmanService;
|
||||
|
||||
/**
|
||||
* 查询销售员列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearSalesmanVo> list(GearSalesmanBo bo, PageQuery pageQuery) {
|
||||
return iGearSalesmanService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销售员列表
|
||||
*/
|
||||
@Log(title = "销售员", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearSalesmanBo bo, HttpServletResponse response) {
|
||||
List<GearSalesmanVo> list = iGearSalesmanService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "销售员", GearSalesmanVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取销售员详情
|
||||
*/
|
||||
@GetMapping("/{salesmanId}")
|
||||
public R<GearSalesmanVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long salesmanId) {
|
||||
return R.ok(iGearSalesmanService.queryById(salesmanId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增销售员
|
||||
*/
|
||||
@Log(title = "销售员", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearSalesmanBo bo) {
|
||||
return toAjax(iGearSalesmanService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改销售员
|
||||
*/
|
||||
@Log(title = "销售员", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearSalesmanBo bo) {
|
||||
return toAjax(iGearSalesmanService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售员
|
||||
*/
|
||||
@Log(title = "销售员", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{salesmanIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] salesmanIds) {
|
||||
return toAjax(iGearSalesmanService.deleteWithValidByIds(Arrays.asList(salesmanIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 跟进客户:按销售员反查客户列表
|
||||
*/
|
||||
@GetMapping("/{salesmanId}/customers")
|
||||
public TableDataInfo<GearCustomerVo> customers(@NotNull(message = "主键不能为空") @PathVariable Long salesmanId,
|
||||
PageQuery pageQuery) {
|
||||
return iGearSalesmanService.queryFollowCustomers(salesmanId, pageQuery);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.bo.GearShippingOrderBo;
|
||||
import com.gear.oa.domain.vo.GearShippingOrderVo;
|
||||
import com.gear.oa.service.IGearShippingOrderService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发货单据
|
||||
*
|
||||
* 说明:
|
||||
* - 本模块写入 gear_shipping_order(独立表)
|
||||
* - 用于订单发货/物流信息记录,不与出入库/WMS 绑定
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/shippingOrder")
|
||||
public class GearShippingOrderController extends BaseController {
|
||||
|
||||
private final IGearShippingOrderService iGearShippingOrderService;
|
||||
|
||||
/**
|
||||
* 查询发货单据列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearShippingOrderVo> list(GearShippingOrderBo bo, PageQuery pageQuery) {
|
||||
return iGearShippingOrderService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单ID查询发货单据列表
|
||||
*/
|
||||
@GetMapping("/listByOrderId/{orderId}")
|
||||
public R<List<GearShippingOrderVo>> listByOrderId(@PathVariable Long orderId) {
|
||||
return R.ok(iGearShippingOrderService.queryListByOrderId(orderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出发货单据列表
|
||||
*/
|
||||
@Log(title = "发货单据", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearShippingOrderBo bo, HttpServletResponse response) {
|
||||
List<GearShippingOrderVo> list = iGearShippingOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "发货单据", GearShippingOrderVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发货单据详细信息
|
||||
*/
|
||||
@GetMapping("/{shippingId}")
|
||||
public R<GearShippingOrderVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long shippingId) {
|
||||
return R.ok(iGearShippingOrderService.queryById(shippingId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增发货单据
|
||||
*/
|
||||
@Log(title = "发货单据", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearShippingOrderBo bo) {
|
||||
return toAjax(iGearShippingOrderService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发货单据
|
||||
*/
|
||||
@Log(title = "发货单据", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearShippingOrderBo bo) {
|
||||
return toAjax(iGearShippingOrderService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发货单据
|
||||
*/
|
||||
@Log(title = "发货单据", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{shippingIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] shippingIds) {
|
||||
return toAjax(iGearShippingOrderService.deleteWithValidByIds(Arrays.asList(shippingIds), true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.oa.domain.bo.GearShippingOrderDetailBo;
|
||||
import com.gear.oa.domain.vo.GearShippingOrderDetailVo;
|
||||
import com.gear.oa.service.IGearShippingOrderDetailService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/shippingOrderDetail")
|
||||
public class GearShippingOrderDetailController extends BaseController {
|
||||
|
||||
private final IGearShippingOrderDetailService iGearShippingOrderDetailService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearShippingOrderDetailVo> list(GearShippingOrderDetailBo bo, PageQuery pageQuery) {
|
||||
return iGearShippingOrderDetailService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@GetMapping("/{detailId}")
|
||||
public R<GearShippingOrderDetailVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long detailId) {
|
||||
return R.ok(iGearShippingOrderDetailService.queryById(detailId));
|
||||
}
|
||||
|
||||
@Log(title = "发货单据明细", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearShippingOrderDetailBo bo) {
|
||||
return toAjax(iGearShippingOrderDetailService.insertByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "发货单据明细", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearShippingOrderDetailBo bo) {
|
||||
return toAjax(iGearShippingOrderDetailService.updateByBo(bo));
|
||||
}
|
||||
|
||||
@Log(title = "发货单据明细", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{detailIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] detailIds) {
|
||||
return toAjax(iGearShippingOrderDetailService.deleteWithValidByIds(Arrays.asList(detailIds), true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.bo.GearShippingPlanBo;
|
||||
import com.gear.oa.domain.vo.GearShippingPlanVo;
|
||||
import com.gear.oa.service.IGearShippingPlanService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发货计划
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/oa/shippingPlan")
|
||||
public class GearShippingPlanController extends BaseController {
|
||||
|
||||
private final IGearShippingPlanService iGearShippingPlanService;
|
||||
|
||||
/**
|
||||
* 查询发货计划列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearShippingPlanVo> list(GearShippingPlanBo bo, PageQuery pageQuery) {
|
||||
return iGearShippingPlanService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发货计划列表(带单据数)
|
||||
*/
|
||||
@GetMapping("/listWithCount")
|
||||
public R<List<GearShippingPlanVo>> listWithCount(GearShippingPlanBo bo) {
|
||||
return R.ok(iGearShippingPlanService.queryListWithCount(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出发货计划列表
|
||||
*/
|
||||
@Log(title = "发货计划", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearShippingPlanBo bo, HttpServletResponse response) {
|
||||
List<GearShippingPlanVo> list = iGearShippingPlanService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "发货计划", GearShippingPlanVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发货计划详细信息
|
||||
*/
|
||||
@GetMapping("/{planId}")
|
||||
public R<GearShippingPlanVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long planId) {
|
||||
return R.ok(iGearShippingPlanService.queryById(planId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增发货计划
|
||||
*/
|
||||
@Log(title = "发货计划", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody GearShippingPlanBo bo) {
|
||||
return toAjax(iGearShippingPlanService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发货计划
|
||||
*/
|
||||
@Log(title = "发货计划", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody GearShippingPlanBo bo) {
|
||||
return toAjax(iGearShippingPlanService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发货计划
|
||||
*/
|
||||
@Log(title = "发货计划", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{planIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] planIds) {
|
||||
return toAjax(iGearShippingPlanService.deleteWithValidByIds(Arrays.asList(planIds), true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 库存:原材料/产品与库区/库位的存放关系
|
||||
@@ -45,6 +47,12 @@ public class GearStockController extends BaseController {
|
||||
return iGearStockService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@PostMapping("/sumQuantityByItemIds")
|
||||
public R<Map<Long, BigDecimal>> sumQuantityByItemIds(@RequestParam(defaultValue = "product") String itemType,
|
||||
@RequestBody List<Long> itemIds) {
|
||||
return R.ok(iGearStockService.sumQuantityByItemIds(itemType, itemIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出库存:原材料/产品与库区/库位的存放关系列表
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,328 @@
|
||||
package com.gear.oa.controller;
|
||||
|
||||
import com.gear.common.annotation.Log;
|
||||
import com.gear.common.annotation.RepeatSubmit;
|
||||
import com.gear.common.core.controller.BaseController;
|
||||
import com.gear.common.core.domain.PageQuery;
|
||||
import com.gear.common.core.domain.R;
|
||||
import com.gear.common.core.page.TableDataInfo;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.gear.common.enums.BusinessType;
|
||||
import com.gear.common.exception.ServiceException;
|
||||
import com.gear.common.utils.StringUtils;
|
||||
import com.gear.common.utils.poi.ExcelUtil;
|
||||
import com.gear.oa.domain.bo.GearStockIoOrderBo;
|
||||
import com.gear.oa.domain.bo.GearStockIoOrderWithDetailBo;
|
||||
import com.gear.oa.domain.vo.GearStockIoOrderDetailVo;
|
||||
import com.gear.oa.domain.vo.GearStockIoOrderVo;
|
||||
import com.gear.oa.domain.vo.GearStockIoOrderWithDetailVo;
|
||||
import com.gear.oa.service.IGearStockIoOrderService;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/gear/stockIoOrder")
|
||||
public class GearStockIoOrderController extends BaseController {
|
||||
|
||||
private final IGearStockIoOrderService stockIoOrderService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<GearStockIoOrderVo> list(GearStockIoOrderBo bo, PageQuery pageQuery) {
|
||||
return stockIoOrderService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(GearStockIoOrderBo bo, HttpServletResponse response) {
|
||||
List<GearStockIoOrderVo> list = stockIoOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "出入库单据", GearStockIoOrderVo.class, response);
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据明细", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/exportDetail")
|
||||
public void exportDetail(GearStockIoOrderBo bo, HttpServletResponse response) {
|
||||
List<GearStockIoOrderDetailVo> list = stockIoOrderService.queryDetailExportList(bo);
|
||||
ExcelUtil.exportExcel(list, "出入库单据明细", GearStockIoOrderDetailVo.class, response);
|
||||
}
|
||||
|
||||
@GetMapping("/materialFlow")
|
||||
public R<IGearStockIoOrderService.MaterialFlowResp> materialFlow(@RequestParam(required = false) Long itemId,
|
||||
@RequestParam(required = false) String factory,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime) {
|
||||
if (itemId != null) {
|
||||
return R.ok(stockIoOrderService.queryMaterialFlow(itemId, startTime, endTime));
|
||||
}
|
||||
if (StringUtils.isBlank(factory)) {
|
||||
return R.fail("请选择物料或填写厂家");
|
||||
}
|
||||
return R.ok(stockIoOrderService.queryMaterialFlowByFactory(factory, startTime, endTime));
|
||||
}
|
||||
|
||||
@Log(title = "物料出入库统计", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/materialFlow/export")
|
||||
public void exportMaterialFlow(@RequestParam(required = false) Long itemId,
|
||||
@RequestParam(required = false) String factory,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date startTime,
|
||||
@RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date endTime,
|
||||
HttpServletResponse response) {
|
||||
IGearStockIoOrderService.MaterialFlowResp resp;
|
||||
if (itemId != null) {
|
||||
resp = stockIoOrderService.queryMaterialFlow(itemId, startTime, endTime);
|
||||
} else if (StringUtils.isNotBlank(factory)) {
|
||||
resp = stockIoOrderService.queryMaterialFlowByFactory(factory, startTime, endTime);
|
||||
} else {
|
||||
throw new ServiceException("请选择物料或填写厂家");
|
||||
}
|
||||
List<MaterialFlowExportRow> exportRows = new ArrayList<>();
|
||||
|
||||
MaterialFlowExportRow summary = new MaterialFlowExportRow();
|
||||
summary.setItemId(resp.getItemId());
|
||||
summary.setFactory(factory);
|
||||
summary.setStartTime(resp.getStartTime());
|
||||
summary.setEndTime(resp.getEndTime());
|
||||
summary.setAction("汇总");
|
||||
summary.setConfirmInQty(nz(resp.getConfirmInQty()));
|
||||
summary.setOutQty(nz(resp.getOutQty()));
|
||||
summary.setRevokeInQty(nz(resp.getRevokeInQty()));
|
||||
summary.setRevokeOutQty(nz(resp.getRevokeOutQty()));
|
||||
summary.setNetQty(nz(resp.getNetQty()));
|
||||
exportRows.add(summary);
|
||||
|
||||
if (resp.getRows() != null) {
|
||||
for (IGearStockIoOrderService.MaterialFlowRow r : resp.getRows()) {
|
||||
MaterialFlowExportRow row = new MaterialFlowExportRow();
|
||||
row.setItemId(resp.getItemId());
|
||||
row.setFactory(factory);
|
||||
row.setTime(r.getTime());
|
||||
row.setAction(r.getAction());
|
||||
row.setOrderCode(r.getOrderCode());
|
||||
row.setIoType(r.getIoType());
|
||||
row.setQtyChange(r.getQtyChange());
|
||||
exportRows.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
ExcelUtil.exportExcel(exportRows, "物料出入库统计", MaterialFlowExportRow.class, response);
|
||||
}
|
||||
|
||||
private static BigDecimal nz(BigDecimal v) {
|
||||
return v == null ? BigDecimal.ZERO : v;
|
||||
}
|
||||
|
||||
@ExcelIgnoreUnannotated
|
||||
public static class MaterialFlowExportRow {
|
||||
@ExcelProperty(value = "物料ID")
|
||||
private Long itemId;
|
||||
@ExcelProperty(value = "厂家")
|
||||
private String factory;
|
||||
@ExcelProperty(value = "开始时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
@ExcelProperty(value = "结束时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
@ExcelProperty(value = "确认入库汇总")
|
||||
private BigDecimal confirmInQty;
|
||||
@ExcelProperty(value = "出库汇总")
|
||||
private BigDecimal outQty;
|
||||
@ExcelProperty(value = "撤回入库汇总")
|
||||
private BigDecimal revokeInQty;
|
||||
@ExcelProperty(value = "撤回出库汇总")
|
||||
private BigDecimal revokeOutQty;
|
||||
@ExcelProperty(value = "净变动汇总")
|
||||
private BigDecimal netQty;
|
||||
@ExcelProperty(value = "明细时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date time;
|
||||
@ExcelProperty(value = "动作")
|
||||
private String action;
|
||||
@ExcelProperty(value = "单号")
|
||||
private String orderCode;
|
||||
@ExcelProperty(value = "类型")
|
||||
private String ioType;
|
||||
@ExcelProperty(value = "数量变化")
|
||||
private BigDecimal qtyChange;
|
||||
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public String getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
public void setFactory(String factory) {
|
||||
this.factory = factory;
|
||||
}
|
||||
|
||||
public Date getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(Date startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public BigDecimal getConfirmInQty() {
|
||||
return confirmInQty;
|
||||
}
|
||||
|
||||
public void setConfirmInQty(BigDecimal confirmInQty) {
|
||||
this.confirmInQty = confirmInQty;
|
||||
}
|
||||
|
||||
public BigDecimal getOutQty() {
|
||||
return outQty;
|
||||
}
|
||||
|
||||
public void setOutQty(BigDecimal outQty) {
|
||||
this.outQty = outQty;
|
||||
}
|
||||
|
||||
public BigDecimal getRevokeInQty() {
|
||||
return revokeInQty;
|
||||
}
|
||||
|
||||
public void setRevokeInQty(BigDecimal revokeInQty) {
|
||||
this.revokeInQty = revokeInQty;
|
||||
}
|
||||
|
||||
public BigDecimal getRevokeOutQty() {
|
||||
return revokeOutQty;
|
||||
}
|
||||
|
||||
public void setRevokeOutQty(BigDecimal revokeOutQty) {
|
||||
this.revokeOutQty = revokeOutQty;
|
||||
}
|
||||
|
||||
public BigDecimal getNetQty() {
|
||||
return netQty;
|
||||
}
|
||||
|
||||
public void setNetQty(BigDecimal netQty) {
|
||||
this.netQty = netQty;
|
||||
}
|
||||
|
||||
public Date getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Date time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getOrderCode() {
|
||||
return orderCode;
|
||||
}
|
||||
|
||||
public void setOrderCode(String orderCode) {
|
||||
this.orderCode = orderCode;
|
||||
}
|
||||
|
||||
public String getIoType() {
|
||||
return ioType;
|
||||
}
|
||||
|
||||
public void setIoType(String ioType) {
|
||||
this.ioType = ioType;
|
||||
}
|
||||
|
||||
public BigDecimal getQtyChange() {
|
||||
return qtyChange;
|
||||
}
|
||||
|
||||
public void setQtyChange(BigDecimal qtyChange) {
|
||||
this.qtyChange = qtyChange;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/{orderId}")
|
||||
public R<GearStockIoOrderVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
return R.ok(stockIoOrderService.queryById(orderId));
|
||||
}
|
||||
|
||||
@GetMapping("/withDetail/{orderId}")
|
||||
public R<GearStockIoOrderWithDetailVo> getWithDetail(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
return R.ok(stockIoOrderService.queryWithDetail(orderId));
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping("/withDetail")
|
||||
public R<Long> addWithDetail(@Validated(AddGroup.class) @RequestBody GearStockIoOrderWithDetailBo bo) {
|
||||
return R.ok(stockIoOrderService.createWithDetail(bo));
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping("/withDetail")
|
||||
public R<Void> editWithDetail(@Validated(EditGroup.class) @RequestBody GearStockIoOrderWithDetailBo bo) {
|
||||
stockIoOrderService.updateWithDetail(bo);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{orderIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] orderIds) {
|
||||
return toAjax(stockIoOrderService.deleteWithValidByIds(Arrays.asList(orderIds), true));
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/confirmIn/{orderId}")
|
||||
public R<Void> confirmIn(@NotNull(message = "主键不能为空") @PathVariable Long orderId) {
|
||||
stockIoOrderService.confirmIn(orderId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "出入库单据", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PostMapping("/revoke/{orderId}")
|
||||
public R<Void> revoke(@NotNull(message = "主键不能为空") @PathVariable Long orderId,
|
||||
@RequestBody(required = false) Map<String, Object> payload) {
|
||||
String reason = payload == null ? "" : String.valueOf(payload.getOrDefault("reason", ""));
|
||||
stockIoOrderService.revoke(orderId, reason);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
45
gear-oa/src/main/java/com/gear/oa/domain/GearContract.java
Normal file
45
gear-oa/src/main/java/com/gear/oa/domain/GearContract.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_contract")
|
||||
public class GearContract extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "contract_id")
|
||||
private Long contractId;
|
||||
|
||||
private String contractNo;
|
||||
|
||||
private String partyA;
|
||||
|
||||
private String partyB;
|
||||
|
||||
private String effectiveFlag;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date signDate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date deliveryDate;
|
||||
|
||||
private String signPlace;
|
||||
|
||||
private String partyAAddress;
|
||||
|
||||
private String partyBAddress;
|
||||
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_contract_detail")
|
||||
public class GearContractDetail extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "detail_id")
|
||||
private Long detailId;
|
||||
|
||||
private Long contractId;
|
||||
|
||||
private Integer lineNo;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String spec;
|
||||
|
||||
private String material;
|
||||
|
||||
private BigDecimal widthMm;
|
||||
|
||||
private BigDecimal thicknessMm;
|
||||
|
||||
private String surfaceTreatment;
|
||||
|
||||
private String packagingRequirement;
|
||||
|
||||
private String remark;
|
||||
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,16 @@ public class GearJournal extends BaseEntity {
|
||||
* 对方户名
|
||||
*/
|
||||
private String counterpart;
|
||||
/**
|
||||
* 客户ID(用于按客户过滤收款记录)
|
||||
*/
|
||||
@TableField("customer_id")
|
||||
private Long customerId;
|
||||
/**
|
||||
* 销售员ID(用于按销售员过滤收款记录)
|
||||
*/
|
||||
@TableField("salesman_id")
|
||||
private Long salesmanId;
|
||||
/**
|
||||
* 收入金额
|
||||
*/
|
||||
|
||||
@@ -44,6 +44,12 @@ public class GearOrder extends BaseEntity {
|
||||
* 销售经理
|
||||
*/
|
||||
private String salesManager;
|
||||
|
||||
/**
|
||||
* 销售员ID(挂接销售员管理)
|
||||
*/
|
||||
@TableField("salesman_id")
|
||||
private Long salesmanId;
|
||||
/**
|
||||
* 订单状态(0=新建,1=生产中,2=已完成,3=已取消)
|
||||
*/
|
||||
@@ -70,4 +76,10 @@ public class GearOrder extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal noTaxAmount;
|
||||
|
||||
/**
|
||||
* 合同Excel附件ossId列表(逗号分隔)
|
||||
*/
|
||||
@TableField("contract_excel_oss_ids")
|
||||
private String contractExcelOssIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -62,4 +62,8 @@ public class GearOrderDetail extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal noTaxPrice;
|
||||
|
||||
private String spec;
|
||||
|
||||
private String model;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单生产记录对象 gear_order_production
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_order_production")
|
||||
public class GearOrderProduction extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "production_id")
|
||||
private Long productionId;
|
||||
|
||||
private Long orderId;
|
||||
|
||||
private Long orderDetailId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private BigDecimal planQty;
|
||||
|
||||
private BigDecimal finishedQty;
|
||||
|
||||
private BigDecimal badQty;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String remark;
|
||||
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@ public class GearReturnExchange extends BaseEntity {
|
||||
* 涉及金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 销售员ID
|
||||
*/
|
||||
private Long salesmanId;
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
|
||||
52
gear-oa/src/main/java/com/gear/oa/domain/GearSalesman.java
Normal file
52
gear-oa/src/main/java/com/gear/oa/domain/GearSalesman.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 销售员对象 gear_salesman
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_salesman")
|
||||
public class GearSalesman extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 销售员ID
|
||||
*/
|
||||
@TableId(value = "salesman_id")
|
||||
private Long salesmanId;
|
||||
|
||||
/**
|
||||
* 销售员姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 状态(0正常 1停用)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标志(0=正常,1=已删除)
|
||||
*/
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
|
||||
117
gear-oa/src/main/java/com/gear/oa/domain/GearShippingOrder.java
Normal file
117
gear-oa/src/main/java/com/gear/oa/domain/GearShippingOrder.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发货单据对象 gear_shipping_order
|
||||
*
|
||||
* 说明:
|
||||
* - 用于记录订单发货信息(物流公司/运单号/收货信息等)
|
||||
* - 与出入库/WMS 单据无关,避免与库存模块耦合
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_shipping_order")
|
||||
public class GearShippingOrder extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 发货单据ID
|
||||
*/
|
||||
@TableId(value = "shipping_id")
|
||||
private Long shippingId;
|
||||
|
||||
/**
|
||||
* 发货单号(唯一)
|
||||
*/
|
||||
private String shippingNo;
|
||||
|
||||
/**
|
||||
* 发货单名称(展示用)
|
||||
*/
|
||||
private String shippingName;
|
||||
|
||||
/**
|
||||
* 发货计划ID
|
||||
*/
|
||||
private Long planId;
|
||||
|
||||
/**
|
||||
* 关联订单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 订单编号快照
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
/**
|
||||
* 收货单位
|
||||
*/
|
||||
private String receiverCompany;
|
||||
|
||||
/**
|
||||
* 收货客户ID(真实归属客户)
|
||||
*/
|
||||
private Long receiverCustomerId;
|
||||
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
private Date shipTime;
|
||||
|
||||
/**
|
||||
* 负责人
|
||||
*/
|
||||
private String responsibleName;
|
||||
|
||||
/**
|
||||
* 物流公司
|
||||
*/
|
||||
private String logisticsCompany;
|
||||
|
||||
/**
|
||||
* 运单号
|
||||
*/
|
||||
private String logisticsNo;
|
||||
|
||||
/**
|
||||
* 收货人
|
||||
*/
|
||||
private String receiverName;
|
||||
|
||||
/**
|
||||
* 收货电话
|
||||
*/
|
||||
private String receiverPhone;
|
||||
|
||||
/**
|
||||
* 收货地址
|
||||
*/
|
||||
private String receiverAddress;
|
||||
|
||||
/**
|
||||
* 完成状态(0未发货 1已打印 2已发货 3已完成)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标志(0存在 2删除)
|
||||
*/
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_shipping_order_detail")
|
||||
public class GearShippingOrderDetail extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "detail_id")
|
||||
private Long detailId;
|
||||
|
||||
private Long shippingId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private String productCode;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String spec;
|
||||
|
||||
private String model;
|
||||
|
||||
private BigDecimal quantity;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发货计划对象 gear_shipping_plan
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_shipping_plan")
|
||||
public class GearShippingPlan extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 发货计划ID
|
||||
*/
|
||||
@TableId(value = "plan_id")
|
||||
private Long planId;
|
||||
|
||||
/**
|
||||
* 计划名称
|
||||
*/
|
||||
private String planName;
|
||||
|
||||
/**
|
||||
* 计划日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date planDate;
|
||||
|
||||
/**
|
||||
* 状态(0未完成 1已完成)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 删除标志(0存在 2删除)
|
||||
*/
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
105
gear-oa/src/main/java/com/gear/oa/domain/GearStockIoOrder.java
Normal file
105
gear-oa/src/main/java/com/gear/oa/domain/GearStockIoOrder.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_stock_io_order")
|
||||
public class GearStockIoOrder extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "order_id")
|
||||
private Long orderId;
|
||||
|
||||
private String orderCode;
|
||||
|
||||
private String ioType;
|
||||
|
||||
private String bizType;
|
||||
|
||||
private String sourceType;
|
||||
|
||||
private String sourceNo;
|
||||
|
||||
private Long sourceOrderId;
|
||||
|
||||
private Long responsibleId;
|
||||
|
||||
private String responsibleName;
|
||||
|
||||
private Date ioTime;
|
||||
|
||||
private Date planArrivalTime;
|
||||
|
||||
private Date actualArrivalTime;
|
||||
|
||||
private Date planFinishTime;
|
||||
|
||||
private Date actualFinishTime;
|
||||
|
||||
private Integer delayMinutes;
|
||||
|
||||
private String delayReason;
|
||||
|
||||
private String delayStatus;
|
||||
|
||||
private Long warehouseId;
|
||||
|
||||
private Long fromWarehouseId;
|
||||
|
||||
private Long toWarehouseId;
|
||||
|
||||
private String status;
|
||||
|
||||
private String execFlag;
|
||||
|
||||
private String confirmInFlag;
|
||||
|
||||
private String confirmInBy;
|
||||
|
||||
private Date confirmInTime;
|
||||
|
||||
private String revokeFlag;
|
||||
|
||||
private String revokeBy;
|
||||
|
||||
private Date revokeTime;
|
||||
|
||||
private String reversalFlag;
|
||||
|
||||
private Long reversalOrderId;
|
||||
|
||||
private String reversalReason;
|
||||
|
||||
private Date reversalTime;
|
||||
|
||||
private String cancelReason;
|
||||
|
||||
private Date cancelTime;
|
||||
|
||||
private String auditBy;
|
||||
|
||||
private Date auditTime;
|
||||
|
||||
private String executeBy;
|
||||
|
||||
private Date executeTime;
|
||||
|
||||
private Long sourceIoId;
|
||||
|
||||
private BigDecimal totalQty;
|
||||
|
||||
private String remark;
|
||||
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.gear.oa.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("gear_stock_io_order_detail")
|
||||
public class GearStockIoOrderDetail extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "detail_id")
|
||||
private Long detailId;
|
||||
|
||||
private Long orderId;
|
||||
|
||||
private Integer lineNo;
|
||||
|
||||
private String itemType;
|
||||
|
||||
private Long itemId;
|
||||
|
||||
private Integer materialTypeSnapshot;
|
||||
|
||||
private String itemName;
|
||||
|
||||
private String specName;
|
||||
|
||||
private Long warehouseId;
|
||||
|
||||
private Long fromWarehouseId;
|
||||
|
||||
private BigDecimal quantity;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String batchNo;
|
||||
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
private BigDecimal amount;
|
||||
|
||||
private String sourceDetailNo;
|
||||
|
||||
private Long reversalDetailId;
|
||||
|
||||
private String remark;
|
||||
|
||||
@TableLogic(value = "0", delval = "2")
|
||||
private String delFlag;
|
||||
}
|
||||
@@ -57,6 +57,16 @@ public class GearWageEntryDetail extends BaseEntity {
|
||||
|
||||
private String extraReason;
|
||||
|
||||
/**
|
||||
* 明细计算金额(多行乘法合计)
|
||||
*/
|
||||
private BigDecimal calcAmount;
|
||||
|
||||
/**
|
||||
* 明细计算行JSON(两列乘法)
|
||||
*/
|
||||
private String calcDetail;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.gear.oa.domain.bo;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GearContractBo extends BaseEntity {
|
||||
|
||||
@NotNull(message = "合同ID不能为空", groups = {EditGroup.class})
|
||||
private Long contractId;
|
||||
|
||||
@NotBlank(message = "合同号不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String contractNo;
|
||||
|
||||
private String partyA;
|
||||
|
||||
private String partyB;
|
||||
|
||||
private String effectiveFlag;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date signDate;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date deliveryDate;
|
||||
|
||||
private String signPlace;
|
||||
|
||||
private String partyAAddress;
|
||||
|
||||
private String partyBAddress;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date signDateStart;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date signDateEnd;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deliveryDateStart;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deliveryDateEnd;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.gear.oa.domain.bo;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import com.gear.common.core.validate.AddGroup;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GearContractDetailBo extends BaseEntity {
|
||||
|
||||
@NotNull(message = "明细ID不能为空", groups = {EditGroup.class})
|
||||
private Long detailId;
|
||||
|
||||
@NotNull(message = "合同ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long contractId;
|
||||
|
||||
private Integer lineNo;
|
||||
|
||||
private String contractNo;
|
||||
|
||||
private String partyA;
|
||||
|
||||
private String partyB;
|
||||
|
||||
private String effectiveFlag;
|
||||
|
||||
private String productName;
|
||||
|
||||
private String spec;
|
||||
|
||||
private String material;
|
||||
|
||||
private BigDecimal widthMm;
|
||||
|
||||
private BigDecimal thicknessMm;
|
||||
|
||||
private String surfaceTreatment;
|
||||
|
||||
private String packagingRequirement;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,16 @@ public class GearJournalBo extends BaseEntity {
|
||||
*/
|
||||
private String counterpart;
|
||||
|
||||
/**
|
||||
* 客户ID(用于按客户过滤收款记录)
|
||||
*/
|
||||
private Long customerId;
|
||||
|
||||
/**
|
||||
* 销售员ID(用于按销售员过滤收款记录)
|
||||
*/
|
||||
private Long salesmanId;
|
||||
|
||||
/**
|
||||
* 收入金额
|
||||
*/
|
||||
@@ -72,5 +82,15 @@ public class GearJournalBo extends BaseEntity {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 时间范围筛选(按 journalDate)
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,11 @@ public class GearOrderBo extends BaseEntity {
|
||||
*/
|
||||
private String salesManager;
|
||||
|
||||
/**
|
||||
* 销售员ID(挂接销售员管理)
|
||||
*/
|
||||
private Long salesmanId;
|
||||
|
||||
/**
|
||||
* 订单状态(0=新建,1=生产中,2=已完成,3=已取消)
|
||||
*/
|
||||
@@ -73,5 +78,9 @@ public class GearOrderBo extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal noTaxAmount;
|
||||
|
||||
/**
|
||||
* 合同Excel附件ossId列表(逗号分隔)
|
||||
*/
|
||||
private String contractExcelOssIds;
|
||||
|
||||
}
|
||||
|
||||
@@ -63,5 +63,9 @@ public class GearOrderDetailBo extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal noTaxPrice;
|
||||
|
||||
private String spec;
|
||||
|
||||
private String model;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.gear.oa.domain.bo;
|
||||
|
||||
import com.gear.common.core.domain.BaseEntity;
|
||||
import com.gear.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单生产记录业务对象 gear_order_production
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class GearOrderProductionBo extends BaseEntity {
|
||||
|
||||
private Long productionId;
|
||||
|
||||
private Long orderId;
|
||||
|
||||
private Long orderDetailId;
|
||||
|
||||
private Long productId;
|
||||
|
||||
private BigDecimal planQty;
|
||||
|
||||
@NotNull(message = "完成数量不能为空", groups = {EditGroup.class})
|
||||
private BigDecimal finishedQty;
|
||||
|
||||
private BigDecimal badQty;
|
||||
|
||||
private String unit;
|
||||
|
||||
private String remark;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ public class GearReceivableBo extends BaseEntity {
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
private Long salesmanId;
|
||||
|
||||
/**
|
||||
* 到期日
|
||||
*/
|
||||
|
||||
@@ -58,8 +58,24 @@ public class GearReturnExchangeBo extends BaseEntity {
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 销售员ID
|
||||
*/
|
||||
private Long salesmanId;
|
||||
|
||||
//订单id
|
||||
private Long orderId;
|
||||
|
||||
//时间范围筛选(按创建时间)
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* 汇总维度:status,type(逗号分隔),为空则不返回分组汇总
|
||||
*/
|
||||
private String summaryDims;
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user