Commit 04f9aa1c authored by guoyu's avatar guoyu

优化

parent 61beea43
{
{
......@@ -5,7 +5,7 @@
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "创建商品",
"createTime" : null,
"updateTime" : 1673852300991,
"updateTime" : 1674982148090,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
......@@ -13,10 +13,10 @@
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "{\n\t\"client_no\": \"Client-FIRST\",\n\t\"external_sku_id\": \"G2023011201\",\n\t\"sku_no\": [\"G2023011201\"],\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\": [\"G2023012901\"],\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" : [ ],
"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\": \"G2023011201\"\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\": \"G2023012901\"\n}",
"description" : null,
"requestBodyDefinition" : {
"name" : "",
......@@ -31,7 +31,7 @@
"expression" : "",
"children" : [ {
"name" : "client_no",
"value" : "Client-FIRST",
"value" : "C-MELB TTC",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -43,7 +43,7 @@
"children" : [ ]
}, {
"name" : "external_sku_id",
"value" : "G2023011201",
"value" : "G2023012901",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -66,7 +66,7 @@
"expression" : "",
"children" : [ {
"name" : "",
"value" : "G2023011201",
"value" : "G2023012901",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -272,7 +272,7 @@
"children" : [ ]
}, {
"name" : "datetime",
"value" : "16-01-2023 13:28:09",
"value" : "29-01-2023 19:48:28",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -284,7 +284,7 @@
"children" : [ ]
}, {
"name" : "client_no",
"value" : "Client-FIRST",
"value" : "C-MELB TTC",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -296,7 +296,7 @@
"children" : [ ]
}, {
"name" : "external_sku_id",
"value" : "G2023011201",
"value" : "G2023012901",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -314,36 +314,56 @@ import response;
import env;
import 'com.mushiny.wms.mfg.dto.ProductResult' as ProductResult;
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.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)) {
//1.字段无法自动填充
db.table('md_product_group').primary('id', IdUtil.getSnowflakeNextId()).save({code:body.product_group, name:body.product_group, warehouse_id:warehouseId::long});
productGroup = new ProductGroup();
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 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)) {
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 productType = db.selectOne('select * from md_product_type where code = #{typeCode} and warehouse_id = #{warehouseId}');
var typeCode = 'default';
ProductType productType = db.selectOne('select * from md_product_type where code = #{typeCode} and warehouse_id = #{warehouseId}');
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)){
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)){
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))
}
}
//货主
......
{
{
......@@ -5,7 +5,7 @@
"groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "获取商品库存",
"createTime" : null,
"updateTime" : 1673849005063,
"updateTime" : 1674982355092,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
......@@ -13,10 +13,10 @@
"method" : "POST",
"parameters" : [ ],
"options" : [ ],
"requestBody" : "{\n \"client_no\": \"Client-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" : [ ],
"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,
"requestBodyDefinition" : {
"name" : "",
......@@ -31,7 +31,7 @@
"expression" : "",
"children" : [ {
"name" : "client_no",
"value" : "Client-FIRST",
"value" : "C-MELB TTC",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -65,7 +65,7 @@
"expression" : "",
"children" : [ {
"name" : "external_sku_id",
"value" : "6956445461880",
"value" : "001",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -91,11 +91,11 @@
"error" : "",
"expression" : "",
"children" : [ {
"name" : "code",
"value" : "-1",
"name" : "status",
"value" : "ERROR",
"description" : "",
"required" : false,
"dataType" : "Integer",
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
......@@ -104,7 +104,7 @@
"children" : [ ]
}, {
"name" : "message",
"value" : "系统内部出现错误",
"value" : "Client does not exist",
"description" : "",
"required" : false,
"dataType" : "String",
......@@ -115,35 +115,11 @@
"expression" : "",
"children" : [ ]
}, {
"name" : "data",
"value" : "null",
"description" : "",
"required" : false,
"dataType" : "Object",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "timestamp",
"value" : "1673516872009",
"name" : "datetime",
"value" : "2023-01-29 16:50:49",
"description" : "",
"required" : false,
"dataType" : "Long",
"type" : null,
"defaultValue" : null,
"validateType" : "",
"error" : "",
"expression" : "",
"children" : [ ]
}, {
"name" : "executeTime",
"value" : "46",
"description" : "",
"required" : false,
"dataType" : "Integer",
"dataType" : "String",
"type" : null,
"defaultValue" : null,
"validateType" : "",
......
{
{
......@@ -5,13 +5,13 @@
"groupId" : "d0f77f73a23b4374beb298d66a0dd923",
"name" : "反馈库存数据",
"createTime" : null,
"updateTime" : 1674972843173,
"updateTime" : 1674984238510,
"lock" : null,
"createBy" : null,
"updateBy" : "admin",
"path" : "inventoryFeedbackJobHandler",
"cron" : "0 * * * * ?",
"enabled" : true,
"enabled" : false,
"description" : ""
}
================================
......@@ -22,9 +22,9 @@ import log;
import 'com.mushiny.wms.mfg.dto.InventoryFeedbackResult' as InventoryFeedbackResult;
import 'com.mushiny.wms.mfg.utils.DateTimeUtil' as DateTimeUtils;
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 'cn.hutool.core.bean.BeanUtil' as BeanUtil;
import 'cn.hutool.core.util.IdUtil' as IdUtil;
var url = env.get('custom.url.feedbackInventory');
......
/*
* 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
/*
* 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
/*
* 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
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);
}
}
}
......@@ -33,7 +33,7 @@ spring:
mushiny:
user: 1067246875800000001
warehouse: 1303927529038716929
warehouse: 1439547536267333633
custom:
connectionKey: c84b8e4c297269d70205c5450cd278a4fdfc2ee0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment