Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
custom-magic
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guoyu
custom-magic
Commits
04f9aa1c
Commit
04f9aa1c
authored
Jan 29, 2023
by
guoyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
61beea43
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
225 additions
and
65 deletions
+225
-65
创建商品.ms
mushiny/magic-api/api/MFG/创建商品.ms
+42
-22
获取商品库存.ms
mushiny/magic-api/api/MFG/获取商品库存.ms
+13
-37
反馈库存数据.ms
mushiny/magic-api/task/MFG/反馈库存数据.ms
+5
-5
ProductBrand.java
src/main/java/com/mushiny/wms/mfg/entity/ProductBrand.java
+36
-0
ProductType.java
src/main/java/com/mushiny/wms/mfg/entity/ProductType.java
+36
-0
Uom.java
src/main/java/com/mushiny/wms/mfg/entity/Uom.java
+52
-0
MyNamedTableInterceptor.java
.../mushiny/wms/mfg/interceptor/MyNamedTableInterceptor.java
+40
-0
application.yml
src/main/resources/application.yml
+1
-1
No files found.
mushiny/magic-api/api/MFG/创建商品.ms
View file @
04f9aa1c
{
{
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "创建商品",
"name" : "创建商品",
"createTime" : null,
"createTime" : null,
"updateTime" : 167
3852300991
,
"updateTime" : 167
4982148090
,
"lock" : null,
"lock" : null,
"createBy" : null,
"createBy" : null,
"updateBy" : "admin",
"updateBy" : "admin",
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
"method" : "POST",
"method" : "POST",
"parameters" : [ ],
"parameters" : [ ],
"options" : [ ],
"options" : [ ],
"requestBody" : "{\n\t\"client_no\": \"C
lient-FIRST\",\n\t\"external_sku_id\": \"G2023011201\",\n\t\"sku_no\": [\"G20230112
01\"],\n\t\"name\": \"G测试商品1\",\n\t\"description\": \"This is a T - shirt\",\n\t\"product_group\": \"Normal\",\n\t\"brand\": \"Midas\",\n\t\"exp_date_mandatory_flag\": \"N\",\n\t\"serial_record_flag\": \"N\",\n\t\"measure_flag\": \"N\",\n\t\"weight\": 40,\n\t\"width\": 20,\n\t\"length\": 20,\n\t\"height\": 10,\n\t\"picture_resource_name\": \"https: //www.baidu.com/pic/demo/test.jpg\",\n\t\"batch\": \"N\"\n}",
"requestBody" : "{\n\t\"client_no\": \"C
-MELB TTC\",\n\t\"external_sku_id\": \"G2023012901\",\n\t\"sku_no\": [\"G20230129
01\"],\n\t\"name\": \"G测试商品1\",\n\t\"description\": \"This is a T - shirt\",\n\t\"product_group\": \"Normal\",\n\t\"brand\": \"Midas\",\n\t\"exp_date_mandatory_flag\": \"N\",\n\t\"serial_record_flag\": \"N\",\n\t\"measure_flag\": \"N\",\n\t\"weight\": 40,\n\t\"width\": 20,\n\t\"length\": 20,\n\t\"height\": 10,\n\t\"picture_resource_name\": \"https: //www.baidu.com/pic/demo/test.jpg\",\n\t\"batch\": \"N\"\n}",
"headers" : [ ],
"headers" : [ ],
"paths" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"status\": \"OK\",\n \"message\": \"Success\",\n \"datetime\": \"
16-01-2023 13:28:09\",\n \"client_no\": \"Client-FIRST\",\n \"external_sku_id\": \"G20230112
01\"\n}",
"responseBody" : "{\n \"status\": \"OK\",\n \"message\": \"Success\",\n \"datetime\": \"
29-01-2023 19:48:28\",\n \"client_no\": \"C-MELB TTC\",\n \"external_sku_id\": \"G20230129
01\"\n}",
"description" : null,
"description" : null,
"requestBodyDefinition" : {
"requestBodyDefinition" : {
"name" : "",
"name" : "",
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"expression" : "",
"expression" : "",
"children" : [ {
"children" : [ {
"name" : "client_no",
"name" : "client_no",
"value" : "C
lient-FIRST
",
"value" : "C
-MELB TTC
",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
"children" : [ ]
"children" : [ ]
}, {
}, {
"name" : "external_sku_id",
"name" : "external_sku_id",
"value" : "G202301
12
01",
"value" : "G202301
29
01",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -66,7 +66,7 @@
...
@@ -66,7 +66,7 @@
"expression" : "",
"expression" : "",
"children" : [ {
"children" : [ {
"name" : "",
"name" : "",
"value" : "G202301
12
01",
"value" : "G202301
29
01",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -272,7 +272,7 @@
...
@@ -272,7 +272,7 @@
"children" : [ ]
"children" : [ ]
}, {
}, {
"name" : "datetime",
"name" : "datetime",
"value" : "
16-01-2023 13:28:09
",
"value" : "
29-01-2023 19:48:28
",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -284,7 +284,7 @@
...
@@ -284,7 +284,7 @@
"children" : [ ]
"children" : [ ]
}, {
}, {
"name" : "client_no",
"name" : "client_no",
"value" : "C
lient-FIRST
",
"value" : "C
-MELB TTC
",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -296,7 +296,7 @@
...
@@ -296,7 +296,7 @@
"children" : [ ]
"children" : [ ]
}, {
}, {
"name" : "external_sku_id",
"name" : "external_sku_id",
"value" : "G202301
12
01",
"value" : "G202301
29
01",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -314,36 +314,56 @@ import response;
...
@@ -314,36 +314,56 @@ import response;
import env;
import env;
import 'com.mushiny.wms.mfg.dto.ProductResult' as ProductResult;
import 'com.mushiny.wms.mfg.dto.ProductResult' as ProductResult;
import 'com.mushiny.wms.mfg.constant.ResultStatus' as ResultStatus;
import 'com.mushiny.wms.mfg.constant.ResultStatus' as ResultStatus;
import 'cn.hutool.core.util.IdUtil' as IdUtil;
import 'com.mushiny.wms.mfg.entity.ProductGroup' as ProductGroup;
import 'com.mushiny.wms.mfg.entity.Uom' as Uom;
import 'com.mushiny.wms.mfg.entity.ProductType' as ProductType;
import 'com.mushiny.wms.mfg.entity.ProductBrand' as ProductBrand;
import 'cn.hutool.core.bean.BeanUtil' as BeanUtil;
var warehouseId = env.get('mushiny.warehouse');
var warehouseId = env.get('mushiny.warehouse')
::long
;
ProductResult productResult = new ProductResult();
ProductResult productResult = new ProductResult();
productResult.setClient_no(body.client_no).setExternal_sku_id(body.external_sku_id);
productResult.setClient_no(body.client_no).setExternal_sku_id(body.external_sku_id);
//商品分组
//商品分组
var
productGroup = db.selectOne('select * from md_product_group where code = #{body.product_group} and warehouse_id = #{warehouseId}');
ProductGroup
productGroup = db.selectOne('select * from md_product_group where code = #{body.product_group} and warehouse_id = #{warehouseId}');
if (is_null(productGroup)) {
if (is_null(productGroup)) {
//1.字段无法自动填充
productGroup = new ProductGroup();
db.table('md_product_group').primary('id', IdUtil.getSnowflakeNextId()).save({code:body.product_group, name:body.product_group, warehouse_id:warehouseId::long});
productGroup.setCode(body.product_group);
productGroup.setName(body.product_group);
productGroup.setWarehouse_id(warehouseId);
db.table('md_product_group').insert(BeanUtil.beanToMap(productGroup))
}
}
//商品单位
//商品单位
var uomCode = 'Pieces';
var uomCode = 'Pieces';
var
uom = db.selectOne('select * from md_uom where code = #{uomCode} and warehouse_id = #{warehouseId}');
Uom
uom = db.selectOne('select * from md_uom where code = #{uomCode} and warehouse_id = #{warehouseId}');
if (is_null(uom)) {
if (is_null(uom)) {
db.table('md_uom').primary('id', IdUtil.getSnowflakeNextId()).save({code:uomCode, name:uomCode, unit_type:'PIECE', warehouse_id:warehouseId::long});
uom = new Uom();
uom.setCode(uomCode);
uom.setName(uomCode);
uom.setUnitType('PIECE');
uom.setWarehouse_id(warehouseId);
db.table('md_uom').insert(BeanUtil.beanToMap(uom))
}
}
//商品类型
//商品类型
var typeCode = '
Normal
';
var typeCode = '
default
';
var
productType = db.selectOne('select * from md_product_type where code = #{typeCode} and warehouse_id = #{warehouseId}');
ProductType
productType = db.selectOne('select * from md_product_type where code = #{typeCode} and warehouse_id = #{warehouseId}');
if (is_null(productType)) {
if (is_null(productType)) {
db.table('md_product_type').primary('id', IdUtil.getSnowflakeNextId()).save({code:typeCode, name:typeCode,warehouse_id:warehouseId::long});
productType = new ProductType();
productType.setCode(typeCode);
productType.setName(typeCode);
productType.setWarehouse_id(warehouseId);
db.table('md_product_type').insert(BeanUtil.beanToMap(productType))
}
}
//商品品牌
//商品品牌
ProductBrand productBrand = new ProductBrand();
if(not_blank(body.brand)){
if(not_blank(body.brand)){
var
productBrand = db.selectOne('select * from md_brand where code = #{body.brand}');
productBrand = db.selectOne('select * from md_brand where code = #{body.brand}');
if(is_null(productBrand)){
if(is_null(productBrand)){
db.table('md_brand').primary('id', IdUtil.getSnowflakeNextId()).save({code:body.brand, name:body.brand});
productBrand = new ProductBrand();
productBrand.setCode(body.brand);
productBrand.setName(body.brand);
db.table('md_brand').insert(BeanUtil.beanToMap(productBrand))
}
}
}
}
//货主
//货主
...
...
mushiny/magic-api/api/MFG/获取商品库存.ms
View file @
04f9aa1c
{
{
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "获取商品库存",
"name" : "获取商品库存",
"createTime" : null,
"createTime" : null,
"updateTime" : 167
3849005063
,
"updateTime" : 167
4982355092
,
"lock" : null,
"lock" : null,
"createBy" : null,
"createBy" : null,
"updateBy" : "admin",
"updateBy" : "admin",
...
@@ -13,10 +13,10 @@
...
@@ -13,10 +13,10 @@
"method" : "POST",
"method" : "POST",
"parameters" : [ ],
"parameters" : [ ],
"options" : [ ],
"options" : [ ],
"requestBody" : "{\n \"client_no\": \"C
lient-FIRST\",\n \"details\": [{\n \"external_sku_id\": \"6956445461880\"\n }, {\n \"external_sku_id\": \"3130190151310
\"\n }]\n}",
"requestBody" : "{\n \"client_no\": \"C
-MELB TTC\",\n \"details\": [{\n \"external_sku_id\": \"001\"\n }, {\n \"external_sku_id\": \"002
\"\n }]\n}",
"headers" : [ ],
"headers" : [ ],
"paths" : [ ],
"paths" : [ ],
"responseBody" : "{\n \"
code\": -1,\n \"message\": \"系统内部出现错误\",\n \"data\": null,\n \"timestamp\": 1673516872009,\n \"executeTime\": 46
\n}",
"responseBody" : "{\n \"
status\": \"ERROR\",\n \"message\": \"Client does not exist\",\n \"datetime\": \"2023-01-29 16:50:49\"
\n}",
"description" : null,
"description" : null,
"requestBodyDefinition" : {
"requestBodyDefinition" : {
"name" : "",
"name" : "",
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
"expression" : "",
"expression" : "",
"children" : [ {
"children" : [ {
"name" : "client_no",
"name" : "client_no",
"value" : "C
lient-FIRST
",
"value" : "C
-MELB TTC
",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
"expression" : "",
"expression" : "",
"children" : [ {
"children" : [ {
"name" : "external_sku_id",
"name" : "external_sku_id",
"value" : "
6956445461880
",
"value" : "
001
",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -91,11 +91,11 @@
...
@@ -91,11 +91,11 @@
"error" : "",
"error" : "",
"expression" : "",
"expression" : "",
"children" : [ {
"children" : [ {
"name" : "
code
",
"name" : "
status
",
"value" : "
-1
",
"value" : "
ERROR
",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "
Integer
",
"dataType" : "
String
",
"type" : null,
"type" : null,
"defaultValue" : null,
"defaultValue" : null,
"validateType" : "",
"validateType" : "",
...
@@ -104,7 +104,7 @@
...
@@ -104,7 +104,7 @@
"children" : [ ]
"children" : [ ]
}, {
}, {
"name" : "message",
"name" : "message",
"value" : "
系统内部出现错误
",
"value" : "
Client does not exist
",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "String",
"dataType" : "String",
...
@@ -115,35 +115,11 @@
...
@@ -115,35 +115,11 @@
"expression" : "",
"expression" : "",
"children" : [ ]
"children" : [ ]
}, {
}, {
"name" : "data",
"name" : "datetime",
"value" : "null",
"value" : "2023-01-29 16:50:49",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "timestamp",
"value" : "1673516872009",
"description" : "",
"description" : "",
"required" : false,
"required" : false,
"dataType" : "Long",
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "executeTime",
"value" : "46",
"description" : "",
"required" : false,
"dataType" : "Integer",
"type" : null,
"type" : null,
"defaultValue" : null,
"defaultValue" : null,
"validateType" : "",
"validateType" : "",
...
...
mushiny/magic-api/task/MFG/反馈库存数据.ms
View file @
04f9aa1c
{
{
...
@@ -5,13 +5,13 @@
...
@@ -5,13 +5,13 @@
"groupId" : "d0f77f73a23b4374beb298d66a0dd923",
"groupId" : "d0f77f73a23b4374beb298d66a0dd923",
"name" : "反馈库存数据",
"name" : "反馈库存数据",
"createTime" : null,
"createTime" : null,
"updateTime" : 16749
72843173
,
"updateTime" : 16749
84238510
,
"lock" : null,
"lock" : null,
"createBy" : null,
"createBy" : null,
"updateBy" : "admin",
"updateBy" : "admin",
"path" : "inventoryFeedbackJobHandler",
"path" : "inventoryFeedbackJobHandler",
"cron" : "0 * * * * ?",
"cron" : "0 * * * * ?",
"enabled" :
tru
e,
"enabled" :
fals
e,
"description" : ""
"description" : ""
}
}
================================
================================
...
@@ -22,9 +22,9 @@ import log;
...
@@ -22,9 +22,9 @@ import log;
import 'com.mushiny.wms.mfg.dto.InventoryFeedbackResult' as InventoryFeedbackResult;
import 'com.mushiny.wms.mfg.dto.InventoryFeedbackResult' as InventoryFeedbackResult;
import 'com.mushiny.wms.mfg.utils.DateTimeUtil' as DateTimeUtils;
import 'com.mushiny.wms.mfg.utils.DateTimeUtil' as DateTimeUtils;
import 'com.mushiny.wms.mfg.constant.ResultStatus' as ResultStatus;
import 'com.mushiny.wms.mfg.constant.ResultStatus' as ResultStatus;
import 'cn.hutool.core.util.IdUtil' as IdUtil;
import 'cn.hutool.core.bean.BeanUtil' as BeanUtil;
import 'com.mushiny.wms.mfg.entity.LogApi' as LogApi;
import 'com.mushiny.wms.mfg.entity.LogApi' as LogApi;
import 'cn.hutool.core.bean.BeanUtil' as BeanUtil;
import 'cn.hutool.core.util.IdUtil' as IdUtil;
var url = env.get('custom.url.feedbackInventory');
var url = env.get('custom.url.feedbackInventory');
...
...
src/main/java/com/mushiny/wms/mfg/entity/ProductBrand.java
0 → 100755
View file @
04f9aa1c
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package
com
.
mushiny
.
wms
.
mfg
.
entity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 商品品牌
*
* @author Gy
* @since 4.0.0
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
ProductBrand
extends
BaseEntitys
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 产品品牌编码
*/
private
String
code
;
/**
* 产品品牌名称
*/
private
String
name
;
}
\ No newline at end of file
src/main/java/com/mushiny/wms/mfg/entity/ProductType.java
0 → 100755
View file @
04f9aa1c
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package
com
.
mushiny
.
wms
.
mfg
.
entity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 产品类型
*
* @author Gy
* @since 4.0.0
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
ProductType
extends
BaseWarehouse
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 产品类型编码
*/
private
String
code
;
/**
* 产品类型名称
*/
private
String
name
;
}
\ No newline at end of file
src/main/java/com/mushiny/wms/mfg/entity/Uom.java
0 → 100755
View file @
04f9aa1c
/*
* Copyright (c) 2020 牧星仓库管理系统 All rights reserved.
*
* http://www.mushiny.com
*
* 版权所有,侵权必究!
*/
package
com
.
mushiny
.
wms
.
mfg
.
entity
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* 单位管理
*
* @author Gy
* @since 4.0.0
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
Uom
extends
BaseWarehouse
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 单位编码
*/
private
String
code
;
/**
* 单位名称
*/
private
String
name
;
/**
* 单位类型
*/
private
String
unitType
;
/**
* 基础单位ID
*/
private
Long
baseUnitId
;
/**
* 基础因子
*/
private
Integer
baseFactor
;
}
\ No newline at end of file
src/main/java/com/mushiny/wms/mfg/interceptor/MyNamedTableInterceptor.java
0 → 100644
View file @
04f9aa1c
package
com
.
mushiny
.
wms
.
mfg
.
interceptor
;
import
cn.hutool.core.util.IdUtil
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.ssssssss.magicapi.modules.db.inteceptor.NamedTableInterceptor
;
import
org.ssssssss.magicapi.modules.db.model.SqlMode
;
import
org.ssssssss.magicapi.modules.db.table.NamedTable
;
import
java.util.Date
;
/**
* 拦截请求(字段自动填充)
*
* @author Gy
* @since 4.0.0
*/
@Component
public
class
MyNamedTableInterceptor
implements
NamedTableInterceptor
{
@Value
(
"${mushiny.user}"
)
private
Long
userId
;
@Override
public
void
preHandle
(
SqlMode
sqlMode
,
NamedTable
namedTable
)
{
Date
date
=
new
Date
();
if
(
sqlMode
==
SqlMode
.
INSERT
)
{
namedTable
.
column
(
"id"
,
IdUtil
.
getSnowflakeNextId
());
namedTable
.
column
(
"creator"
,
userId
);
namedTable
.
column
(
"create_date"
,
date
);
namedTable
.
column
(
"updater"
,
userId
);
namedTable
.
column
(
"update_date"
,
date
);
}
else
if
(
sqlMode
==
SqlMode
.
UPDATE
)
{
namedTable
.
column
(
"updater"
,
userId
);
namedTable
.
column
(
"update_date"
,
date
);
}
}
}
src/main/resources/application.yml
View file @
04f9aa1c
...
@@ -33,7 +33,7 @@ spring:
...
@@ -33,7 +33,7 @@ spring:
mushiny
:
mushiny
:
user
:
1067246875800000001
user
:
1067246875800000001
warehouse
:
1
303927529038716929
warehouse
:
1
439547536267333633
custom
:
custom
:
connectionKey
:
c84b8e4c297269d70205c5450cd278a4fdfc2ee0
connectionKey
:
c84b8e4c297269d70205c5450cd278a4fdfc2ee0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment