Commit ea4c8533 authored by guoyu's avatar guoyu

优化

parent 04f9aa1c
{ {
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"groupId" : "504dbc7823444f7a8df13edb6b189120", "groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "创建商品", "name" : "创建商品",
"createTime" : null, "createTime" : null,
"updateTime" : 1674982148090, "updateTime" : 1677140562317,
"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-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}", "requestBody" : "{\n\t\"client_no\": \"C-MELB TTC\",\n\t\"external_sku_id\": \"G2023012901\",\n\t\"sku_no\": [\"G2023012901\"],\n\t\"name\": \"G测试商品2\",\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\": \"29-01-2023 19:48:28\",\n \"client_no\": \"C-MELB TTC\",\n \"external_sku_id\": \"G2023012901\"\n}", "responseBody" : "{\n \"status\": \"ERROR\",\n \"message\": \"Client does not exist\",\n \"datetime\": \"23-02-2023 19:22:34\",\n \"client_no\": \"C-MELB TTC1\",\n \"external_sku_id\": \"G2023012901\"\n}",
"description" : null, "description" : null,
"requestBodyDefinition" : { "requestBodyDefinition" : {
"name" : "", "name" : "",
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
} ] } ]
}, { }, {
"name" : "name", "name" : "name",
"value" : "G测试商品1", "value" : "G测试商品2",
"description" : "", "description" : "",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
"expression" : "", "expression" : "",
"children" : [ { "children" : [ {
"name" : "status", "name" : "status",
"value" : "OK", "value" : "ERROR",
"description" : "", "description" : "",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
...@@ -260,7 +260,7 @@ ...@@ -260,7 +260,7 @@
"children" : [ ] "children" : [ ]
}, { }, {
"name" : "message", "name" : "message",
"value" : "Success", "value" : "Client does not exist",
"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" : "29-01-2023 19:48:28", "value" : "23-02-2023 19:22:34",
"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-MELB TTC", "value" : "C-MELB TTC1",
"description" : "", "description" : "",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
...@@ -318,41 +318,117 @@ import 'com.mushiny.wms.mfg.entity.ProductGroup' as ProductGroup; ...@@ -318,41 +318,117 @@ import 'com.mushiny.wms.mfg.entity.ProductGroup' as ProductGroup;
import 'com.mushiny.wms.mfg.entity.Uom' as Uom; import 'com.mushiny.wms.mfg.entity.Uom' as Uom;
import 'com.mushiny.wms.mfg.entity.ProductType' as ProductType; import 'com.mushiny.wms.mfg.entity.ProductType' as ProductType;
import 'com.mushiny.wms.mfg.entity.ProductBrand' as ProductBrand; import 'com.mushiny.wms.mfg.entity.ProductBrand' as ProductBrand;
import 'com.mushiny.wms.mfg.entity.Product' as Product;
import 'com.mushiny.wms.mfg.entity.ProductCode' as ProductCode;
import 'cn.hutool.core.bean.BeanUtil' as BeanUtil; import 'cn.hutool.core.bean.BeanUtil' as BeanUtil;
import 'java.math.BigDecimal' as BigDecimal;
import 'com.mushiny.wms.mfg.constant.ProductConstant' as ProductConstant;
var warehouseId = env.get('mushiny.warehouse')::long; var warehouseId = env.get('mushiny.warehouse')::long;
var saveProductCode = (productId, dto, client) => {
for (val in dto.sku_no) {
ProductCode productCode = new ProductCode();
productCode.setCode(val);
productCode.setProductId(productId);
productCode.setClientId(client.id);
productCode.setWarehouseId(warehouseId);
db.table('md_product_code').insert(BeanUtil.beanToMap(productCode))
}
}
var save = (product, body, productGroup, uom, productType, productBrand, client, createFlag) => {
product.setCode(body.external_sku_id);
product.setSku(body.sku_no[0]);
product.setName(body.name);
product.setProductGroupId(productGroup.id);
product.setBrandId(productBrand.id);
product.setUomId(uom.id);
product.setProductTypeId(productType.id);
product.setDescription(body.description);
//单位米
product.setDepth(is_null(body.length) || new BigDecimal(body.length).compareTo(BigDecimal.ZERO) == 0 ? new BigDecimal("0.001") : new BigDecimal(body.length).divide(new BigDecimal(1000)).setScale(3, BigDecimal.ROUND_HALF_UP));
product.setWidth(is_null(body.width) || new BigDecimal(body.width).compareTo(BigDecimal.ZERO) == 0 ? new BigDecimal("0.001") : new BigDecimal(body.width).divide(new BigDecimal(1000)).setScale(3, BigDecimal.ROUND_HALF_UP));
product.setHeight(is_null(body.height) || new BigDecimal(body.height).compareTo(BigDecimal.ZERO) == 0 ? new BigDecimal("0.001") : new BigDecimal(body.height).divide(new BigDecimal(1000)).setScale(3, BigDecimal.ROUND_HALF_UP));
product.setVolume(product.getDepth().multiply(product.getWidth()).multiply(product.getHeight()).setScale(6, BigDecimal.ROUND_HALF_UP));
//单位千克
product.setWeight(is_null(body.weight) || new BigDecimal(body.weight).compareTo(BigDecimal.ZERO) == 0 ? new BigDecimal("0.001") : new BigDecimal(body.weight).divide(new BigDecimal(1000)).setScale(3, BigDecimal.ROUND_HALF_UP));
if (ProductConstant.Y.equalsIgnoreCase(body.exp_date_mandatory_flag)) {
product.setBestBeforeMandatory(1);
if (ProductConstant.EXP.equalsIgnoreCase(body.exp_date_type)) {
product.setBestBeforeType("EXP");
} else {
product.setBestBeforeType("PRD");
product.setBestBeforeUnit(is_blank(body.getExp_unit())?"DAY" : body.exp_unit.toUpperCase());
}
} else {
product.setBestBeforeMandatory(0);
}
if(not_blank(body.serial_record_flag) && ("Y").equals(body.serial_record_flag)){
product.setSerialNoRecordType(1);
} else {
product.setSerialNoRecordType(0);
}
if (not_blank(body.exp_threshold)) {
product.setRestUsageGi(body.getExp_threshold()::int);
} else {
product.setRestUsageGi(0);
}
product.setRestUsageGo(0);
product.setPictureUrl(body.picture_resource_name);
product.setAdviceMandatory(0);
product.setLotMandatory(0);
product.setLotSubstitutionType(0);
product.setWeightRecordType(0);
product.setShelfLife(0);
product.setSafetyStock(0);
product.setWarehouseId(warehouseId);
product.setClientId(client.id);
if (createFlag) {
var productId = db.table('md_product').insert(BeanUtil.beanToMap(product))
saveProductCode(productId,body,client);
} else {
db.table('md_product').primary('id').update(BeanUtil.beanToMap(product))
var productCodeList = db.select('select * from md_product_code where product_id = #{product.id}');
for (val in productCodeList) {
db.table('md_product_code').primary('id').update({id : val.id, del_flag : 1})
}
saveProductCode(product.id,body,client);
}
}
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);
//商品分组 //商品分组
ProductGroup productGroup = db.selectOne('select * from md_product_group where code = #{body.product_group} and warehouse_id = #{warehouseId}'); var 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)) {
productGroup = new ProductGroup(); productGroup = new ProductGroup();
productGroup.setCode(body.product_group); productGroup.setCode(body.product_group);
productGroup.setName(body.product_group); productGroup.setName(body.product_group);
productGroup.setWarehouse_id(warehouseId); productGroup.setWarehouseId(warehouseId);
db.table('md_product_group').insert(BeanUtil.beanToMap(productGroup)) db.table('md_product_group').insert(BeanUtil.beanToMap(productGroup))
} }
//商品单位 //商品单位
var uomCode = 'Pieces'; var uomCode = 'Pieces';
Uom uom = db.selectOne('select * from md_uom where code = #{uomCode} and warehouse_id = #{warehouseId}'); var uom = db.selectOne('select * from md_uom where code = #{uomCode} and warehouse_id = #{warehouseId}');
if (is_null(uom)) { if (is_null(uom)) {
uom = new Uom(); uom = new Uom();
uom.setCode(uomCode); uom.setCode(uomCode);
uom.setName(uomCode); uom.setName(uomCode);
uom.setUnitType('PIECE'); uom.setUnitType('PIECE');
uom.setWarehouse_id(warehouseId); uom.setWarehouseId(warehouseId);
db.table('md_uom').insert(BeanUtil.beanToMap(uom)) db.table('md_uom').insert(BeanUtil.beanToMap(uom))
} }
//商品类型 //商品类型
var typeCode = 'default'; var typeCode = 'default';
ProductType productType = db.selectOne('select * from md_product_type where code = #{typeCode} and warehouse_id = #{warehouseId}'); var productType = db.selectOne('select * from md_product_type where code = #{typeCode} and warehouse_id = #{warehouseId}');
if (is_null(productType)) { if (is_null(productType)) {
productType = new ProductType(); productType = new ProductType();
productType.setCode(typeCode); productType.setCode(typeCode);
productType.setName(typeCode); productType.setName(typeCode);
productType.setWarehouse_id(warehouseId); productType.setWarehouseId(warehouseId);
db.table('md_product_type').insert(BeanUtil.beanToMap(productType)) db.table('md_product_type').insert(BeanUtil.beanToMap(productType))
} }
//商品品牌 //商品品牌
...@@ -381,15 +457,18 @@ if(is_null(product)){ ...@@ -381,15 +457,18 @@ if(is_null(product)){
return response.json(productResult.setStatus(ResultStatus.error).setMessage('sku_no already exists')); return response.json(productResult.setStatus(ResultStatus.error).setMessage('sku_no already exists'));
} }
} }
save(new Product(), body, productGroup, uom, productType, productBrand, client, true);
} else { } else {
for (val in body.sku_no) { for (val in body.sku_no) {
var p = db.selectOne('select * from md_product_code where code = #{val} and client_id = #{client.id}'); var p = db.selectOne('select * from md_product_code where code = #{val} and client_id = #{client.id}');
if (not_null(p)) { if (not_null(p)) {
if(!p.product_id.equals(product.id)){ if(!p.productId.equals(product.id)){
return response.json(productResult.setStatus(ResultStatus.error).setMessage('sku_no already exists')); return response.json(productResult.setStatus(ResultStatus.error).setMessage('sku_no already exists'));
} }
} }
} }
product = BeanUtil.fillBeanWithMap(product, new Product(), false);
save(product, body, productGroup, uom, productType, productBrand, client, false);
} }
return response.json(productResult); return response.json(productResult);
......
{ {
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"groupId" : "504dbc7823444f7a8df13edb6b189120", "groupId" : "504dbc7823444f7a8df13edb6b189120",
"name" : "获取商品库存", "name" : "获取商品库存",
"createTime" : null, "createTime" : null,
"updateTime" : 1674982355092, "updateTime" : 1677138527008,
"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-MELB TTC\",\n \"details\": [{\n \"external_sku_id\": \"001\"\n }, {\n \"external_sku_id\": \"002\"\n }]\n}", "requestBody" : "{\n \"client_no\": \"C-MELB TTC\",\n \"details\": [{\n \"external_sku_id\": \"30758800\"\n }, {\n \"external_sku_id\": \"002\"\n }]\n}",
"headers" : [ ], "headers" : [ ],
"paths" : [ ], "paths" : [ ],
"responseBody" : "{\n \"status\": \"ERROR\",\n \"message\": \"Client does not exist\",\n \"datetime\": \"2023-01-29 16:50:49\"\n}", "responseBody" : "{\n \"status\": \"ERROR\",\n \"message\": \"Product does not exist, wrong product is 307588001\",\n \"datetime\": \"2023-02-23 15:48:41\"\n}",
"description" : null, "description" : null,
"requestBodyDefinition" : { "requestBodyDefinition" : {
"name" : "", "name" : "",
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
"expression" : "", "expression" : "",
"children" : [ { "children" : [ {
"name" : "external_sku_id", "name" : "external_sku_id",
"value" : "001", "value" : "30758800",
"description" : "", "description" : "",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
"children" : [ ] "children" : [ ]
}, { }, {
"name" : "message", "name" : "message",
"value" : "Client does not exist", "value" : "Product does not exist, wrong product is 307588001",
"description" : "", "description" : "",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
"children" : [ ] "children" : [ ]
}, { }, {
"name" : "datetime", "name" : "datetime",
"value" : "2023-01-29 16:50:49", "value" : "2023-02-23 15:48:41",
"description" : "", "description" : "",
"required" : false, "required" : false,
"dataType" : "String", "dataType" : "String",
...@@ -148,7 +148,7 @@ var sql = """ ...@@ -148,7 +148,7 @@ var sql = """
inner join md_rack mr on mr.id = sb.rack_id inner join md_rack mr on mr.id = sb.rack_id
where su.del_flag = 0 where su.del_flag = 0
and su.quantity > 0 and su.quantity > 0
and su.warehouse_id = #{product.warehouse_id} and su.warehouse_id = #{product.warehouseId}
and su.status = 300 and su.status = 300
and mr.type ='POD' and mr.type ='POD'
group by productId group by productId
...@@ -158,7 +158,7 @@ var sql = """ ...@@ -158,7 +158,7 @@ var sql = """
ob_delivery_order_line odl ob_delivery_order_line odl
inner join ob_delivery_order od on od.id = odl.delivery_order_id inner join ob_delivery_order od on od.id = odl.delivery_order_id
where od.del_flag = 0 where od.del_flag = 0
and od.warehouse_id = #{product.warehouse_id} and od.warehouse_id = #{product.warehouseId}
and od.client_id = #{client.id} and od.client_id = #{client.id}
and od.status < 600 and od.status < 600
and odl.del_flag = 0 and odl.del_flag = 0
......
{ {
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
"groupId" : "d0f77f73a23b4374beb298d66a0dd923", "groupId" : "d0f77f73a23b4374beb298d66a0dd923",
"name" : "反馈库存数据", "name" : "反馈库存数据",
"createTime" : null, "createTime" : null,
"updateTime" : 1674984238510, "updateTime" : 1677138765230,
"lock" : null, "lock" : null,
"createBy" : null, "createBy" : null,
"updateBy" : "admin", "updateBy" : "admin",
"path" : "inventoryFeedbackJobHandler", "path" : "inventoryFeedbackJobHandler",
"cron" : "0 * * * * ?", "cron" : "0 * * * * ?",
"enabled" : false, "enabled" : true,
"description" : "" "description" : ""
} }
================================ ================================
...@@ -37,19 +37,19 @@ var saveLog = (url, param, method, code, result, time, status)=>{ ...@@ -37,19 +37,19 @@ var saveLog = (url, param, method, code, result, time, status)=>{
logApi.setId(IdUtil.getSnowflakeNextId()); logApi.setId(IdUtil.getSnowflakeNextId());
logApi.setType(1); logApi.setType(1);
logApi.setCreator(10001L); logApi.setCreator(10001L);
logApi.setCreator_name('ApiUser'); logApi.setCreatorName('ApiUser');
logApi.setStatus(status); logApi.setStatus(status);
logApi.setRequest_time(time::int); logApi.setRequestTime(time::int);
logApi.setCreate_date(new Date()); logApi.setCreateDate(new Date());
logApi.setUpdater(10001L); logApi.setUpdater(10001L);
logApi.setUpdate_date(new Date()); logApi.setUpdateDate(new Date());
logApi.setRequest_uri(url); logApi.setRequestUri(url);
logApi.setCode('inventory'); logApi.setCode('inventory');
logApi.setName('库存同步反馈'); logApi.setName('库存同步反馈');
logApi.setRequest_method(method); logApi.setRequestMethod(method);
logApi.setRequest_params(param); logApi.setRequestParams(param);
logApi.setResult(result::string); logApi.setResult(result::string);
logApi.setResult_status(code); logApi.setResultStatus(code);
db.table('sys_log_api').insert(BeanUtil.beanToMap(logApi)) db.table('sys_log_api').insert(BeanUtil.beanToMap(logApi))
} }
......
package com.mushiny.wms.mfg.constant;
/**
* @author Gy
* @since 4.0.0
*/
public class ProductConstant {
public static final String DEFAULT_UNIT = "Pieces";
public static final String DEFAULT_TYPE = "default";
public static final String Y = "Y";
public static final String EXP = "EXP";
}
...@@ -27,6 +27,6 @@ public abstract class BaseClient extends BaseWarehouse { ...@@ -27,6 +27,6 @@ public abstract class BaseClient extends BaseWarehouse {
* 货主ID * 货主ID
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Long client_id; private Long clientId;
} }
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
package com.mushiny.wms.mfg.entity; package com.mushiny.wms.mfg.entity;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.beans.Transient; import java.beans.Transient;
...@@ -40,7 +41,7 @@ public abstract class BaseEntitys implements Serializable { ...@@ -40,7 +41,7 @@ public abstract class BaseEntitys implements Serializable {
* 创建时间 * 创建时间
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Date create_date; private Date createDate;
/** /**
* 备注 * 备注
...@@ -74,25 +75,25 @@ public abstract class BaseEntitys implements Serializable { ...@@ -74,25 +75,25 @@ public abstract class BaseEntitys implements Serializable {
* 更新时间 * 更新时间
*/ */
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
private Date update_date; private Date updateDate;
/** /**
* 锁定 * 锁定
*/ */
private Integer entity_lock = 0; private Integer entityLock = 0;
@Transient @Transient
public Integer getLock() { public Integer getLock() {
return entity_lock; return entityLock;
} }
@Transient @Transient
public void setLock(Integer entityLock) { public void setLock(Integer entityLock) {
this.entity_lock = entity_lock; this.entityLock = entityLock;
} }
public boolean isLocked() { public boolean isLocked() {
return entity_lock != 0; return entityLock != 0;
} }
@Override @Override
......
...@@ -27,5 +27,5 @@ public abstract class BaseWarehouse extends BaseEntitys { ...@@ -27,5 +27,5 @@ public abstract class BaseWarehouse extends BaseEntitys {
* 仓库ID * 仓库ID
*/ */
@TableField(fill = FieldFill.INSERT) @TableField(fill = FieldFill.INSERT)
private Long warehouse_id; private Long warehouseId;
} }
...@@ -43,7 +43,7 @@ public class LogApi { ...@@ -43,7 +43,7 @@ public class LogApi {
/** /**
* 接口唯一key * 接口唯一key
*/ */
private String unique_key; private String uniqueKey;
/** /**
* 接口类型 0:接收(对方调用我方提供接口received) 1:发送(我方调用对方提供接口send) * 接口类型 0:接收(对方调用我方提供接口received) 1:发送(我方调用对方提供接口send)
...@@ -54,27 +54,27 @@ public class LogApi { ...@@ -54,27 +54,27 @@ public class LogApi {
/** /**
* 请求URI * 请求URI
*/ */
private String request_uri; private String requestUri;
/** /**
* 请求方式 * 请求方式
*/ */
private String request_method; private String requestMethod;
/** /**
* 请求参数 * 请求参数
*/ */
private String request_params; private String requestParams;
/** /**
* 请求时长(毫秒) * 请求时长(毫秒)
*/ */
private Integer request_time; private Integer requestTime;
/** /**
* 用户代理 * 用户代理
*/ */
private String user_agent; private String userAgent;
/** /**
* 操作IP * 操作IP
...@@ -94,18 +94,18 @@ public class LogApi { ...@@ -94,18 +94,18 @@ public class LogApi {
/** /**
* 结果状态 0:失败 1:成功 * 结果状态 0:失败 1:成功
*/ */
private Integer result_status; private Integer resultStatus;
/** /**
* 重试次数 * 重试次数
*/ */
private Integer retry_num; private Integer retryNum;
/** /**
* 用户名 * 用户名
*/ */
private String creator_name; private String creatorName;
/** /**
* 创建者 * 创建者
...@@ -115,7 +115,7 @@ public class LogApi { ...@@ -115,7 +115,7 @@ public class LogApi {
/** /**
* 创建时间 * 创建时间
*/ */
private Date create_date; private Date createDate;
/** /**
* 更新者 * 更新者
...@@ -125,5 +125,5 @@ public class LogApi { ...@@ -125,5 +125,5 @@ public class LogApi {
/** /**
* 更新时间 * 更新时间
*/ */
private Date update_date; private Date updateDate;
} }
\ 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;
import java.math.BigDecimal;
/**
* 商品管理
*
* @author Gy
* @since 4.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class Product extends BaseClient {
private static final long serialVersionUID = 1L;
/**
* 商品编码
*/
private String code;
/**
* 商品SKU
*/
private String sku;
/**
* 商品名称
*/
private String name;
/**
* 商品描述
*/
private String description;
/**
* 商品名称
*/
private String pictureName;
/**
* 商品主图URL
*/
private String pictureUrl;
/**
* 商品品牌ID
*/
private Long brandId;
/**
* 商品类型ID
*/
private Long productTypeId;
/**
* 商品分组ID
*/
private Long productGroupId;
/**
* 宽度
*/
private BigDecimal width;
/**
* 高度
*/
private BigDecimal height;
/**
* 深度
*/
private BigDecimal depth;
/**
* 体积
*/
private BigDecimal volume;
/**
* 重量
*/
private BigDecimal weight;
/**
* 需要收货通知 0:不需要 1:需要
*/
private Integer adviceMandatory;
/**
* 需要批次管理 0:不需要 1:需要
*/
private Integer lotMandatory;
/**
* 需要有效期管理 0:不需要 1:需要
*/
private Integer bestBeforeMandatory;
/**
* 可以用其他批次替代
*/
private Integer lotSubstitutionType;
/**
* 收货的最小剩余期限
*/
private Integer restUsageGi = 0;
/**
* 拣货的最小剩余期限
*/
private Integer restUsageGo;
/**
* 记录序列号类型
*/
private Integer serialNoRecordType;
/**
* 记录重量类型
*/
private Integer weightRecordType;
/**
* 有效期类型 MANUFACTURE:生产日期,EXPIRATION:到期日期
*/
private String bestBeforeType;
/**
* 有效期单位 YEAR:年,MONTH:月,DAY:日
*/
private String bestBeforeUnit;
/**
* 保质期之前的最少天数
*/
private Integer shelfLife;
/**
* 安全库存
*/
private Integer safetyStock;
/**
* 贸易集团
*/
private String tradeGroup;
/**
* 默认包装单位ID
*/
private Long defaultPackagingUnitId;
/**
* 默认存储策略ID
*/
private Long defaultStorageStrategyId;
/**
* 默认装载单元类型ID
*/
private Long defaultUnitLoadTypeId;
/**
* 计量单位ID
*/
private Long uomId;
/**
* 商品默认存储区域ID
*/
private Long zoneId;
}
\ 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 ProductCode extends BaseClient {
private static final long serialVersionUID = 1L;
/**
* 商品其他唯一编码
*/
private String code;
/**
* 生产商名称
*/
private String manufacturerName;
/**
* 商品ID
*/
private Long productId;
/**
* 包装单元ID
*/
private Long packagingUnitId;
}
\ No newline at end of file
package com.mushiny.wms.mfg.interceptor; package com.mushiny.wms.mfg.interceptor;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.mushiny.wms.mfg.constant.DateFormatPattern;
import com.mushiny.wms.mfg.utils.DateTimeUtil;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.ssssssss.magicapi.modules.db.inteceptor.NamedTableInterceptor; import org.ssssssss.magicapi.modules.db.inteceptor.NamedTableInterceptor;
import org.ssssssss.magicapi.modules.db.model.SqlMode; import org.ssssssss.magicapi.modules.db.model.SqlMode;
import org.ssssssss.magicapi.modules.db.table.NamedTable; import org.ssssssss.magicapi.modules.db.table.NamedTable;
import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
/** /**
...@@ -23,17 +26,16 @@ public class MyNamedTableInterceptor implements NamedTableInterceptor { ...@@ -23,17 +26,16 @@ public class MyNamedTableInterceptor implements NamedTableInterceptor {
@Override @Override
public void preHandle(SqlMode sqlMode, NamedTable namedTable) { public void preHandle(SqlMode sqlMode, NamedTable namedTable) {
Date date = new Date();
if (sqlMode == SqlMode.INSERT) { if (sqlMode == SqlMode.INSERT) {
namedTable.column("id", IdUtil.getSnowflakeNextId()); namedTable.column("id", IdUtil.getSnowflakeNextId());
namedTable.column("creator", userId); namedTable.column("creator", userId);
namedTable.column("create_date", date); namedTable.column("create_date", new Date());
namedTable.column("updater", userId); namedTable.column("updater", userId);
namedTable.column("update_date", date); namedTable.column("update_date", new Date());
}else if (sqlMode == SqlMode.UPDATE) { }else if (sqlMode == SqlMode.UPDATE) {
namedTable.column("updater", userId); namedTable.column("updater", userId);
namedTable.column("update_date", date); namedTable.column("update_date", new Date());
} }
} }
......
...@@ -20,6 +20,7 @@ magic-api: ...@@ -20,6 +20,7 @@ magic-api:
security: # 安全配置 security: # 安全配置
username: admin # 登录用的用户名 username: admin # 登录用的用户名
password: 123456 # 登录用的密码 password: 123456 # 登录用的密码
sql-column-case: camel # 启用驼峰命名转换
spring: spring:
datasource: datasource:
......
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