|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.jsh.erp.constants.BusinessConstants;
|
|
import com.jsh.erp.constants.BusinessConstants;
|
|
import com.jsh.erp.constants.ExceptionConstants;
|
|
import com.jsh.erp.constants.ExceptionConstants;
|
|
@@ -41,6 +42,7 @@ import java.io.File;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
|
|
public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
|
|
@@ -134,12 +136,14 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询商品管理-商品信息列表查询
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
|
|
public List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand, String mfrs,
|
|
String materialOther, String weight, String expiryNum, String enableSerialNumber,
|
|
String materialOther, String weight, String expiryNum, String enableSerialNumber,
|
|
String enableBatchNumber, String position, String enabled, String remark, String categoryId,
|
|
String enableBatchNumber, String position, String enabled, String remark, String categoryId,
|
|
- String mpList)
|
|
|
|
- throws Exception{
|
|
|
|
|
|
+ String mpList,String reminder) {
|
|
String[] mpArr = new String[]{};
|
|
String[] mpArr = new String[]{};
|
|
if(StringUtil.isNotEmpty(mpList)){
|
|
if(StringUtil.isNotEmpty(mpList)){
|
|
mpArr= mpList.split(",");
|
|
mpArr= mpList.split(",");
|
|
@@ -147,12 +151,14 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
List<MaterialVo4Unit> list = new ArrayList<>();
|
|
List<MaterialVo4Unit> list = new ArrayList<>();
|
|
try{
|
|
try{
|
|
List<Long> idList = new ArrayList<>();
|
|
List<Long> idList = new ArrayList<>();
|
|
|
|
+ //类型不为空,获取类型id集合
|
|
if(StringUtil.isNotEmpty(categoryId)){
|
|
if(StringUtil.isNotEmpty(categoryId)){
|
|
idList = getListByParentId(Long.parseLong(categoryId));
|
|
idList = getListByParentId(Long.parseLong(categoryId));
|
|
|
|
+
|
|
}
|
|
}
|
|
PageUtils.startPage();
|
|
PageUtils.startPage();
|
|
list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
|
|
list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
|
|
- enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList);
|
|
|
|
|
|
+ enableSerialNumber, enableBatchNumber, position, enabled, remark, idList, mpList,reminder);
|
|
if (null != list && list.size()>0) {
|
|
if (null != list && list.size()>0) {
|
|
Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list);
|
|
Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list);
|
|
Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
|
|
Map<Long,BigDecimal> currentStockMap = getCurrentStockMapByMaterialList(list);
|
|
@@ -179,9 +185,9 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
- public int insertMaterial(MaterialDto obj, HttpServletRequest request)throws Exception {
|
|
|
|
|
|
+ public int insertMaterial(MaterialDto material, HttpServletRequest request)throws Exception {
|
|
//商品主表信息
|
|
//商品主表信息
|
|
- Material m = obj;
|
|
|
|
|
|
+ Material m = material;
|
|
//设置状态
|
|
//设置状态
|
|
m.setEnabled(true);
|
|
m.setEnabled(true);
|
|
//获取类型编码
|
|
//获取类型编码
|
|
@@ -189,17 +195,15 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
String sku = serial_no + DateUtils.dateTimeNow() + RandomHelper.getRandomStr(6);
|
|
String sku = serial_no + DateUtils.dateTimeNow() + RandomHelper.getRandomStr(6);
|
|
//设置系统sku
|
|
//设置系统sku
|
|
m.setSystemSku(sku);
|
|
m.setSystemSku(sku);
|
|
- User user = userService.getCurrentUser();
|
|
|
|
try{
|
|
try{
|
|
//添加商品
|
|
//添加商品
|
|
materialMapperEx.insertSelectiveEx(m);
|
|
materialMapperEx.insertSelectiveEx(m);
|
|
Long mId = m.getId();
|
|
Long mId = m.getId();
|
|
//添加商品条码信息
|
|
//添加商品条码信息
|
|
- materialExtendService.saveDetails(obj.getMbList(),obj.getSortList().toJSONString(),mId,"insert");
|
|
|
|
- //materialExtendService.saveDetials(null, obj.getSortList(), mId, "insert");
|
|
|
|
|
|
+ materialExtendService.saveDetails(material.getMbList(),material.getSortList().toJSONString(),mId,"insert");
|
|
//设置初始库存
|
|
//设置初始库存
|
|
- if(obj.getStock()!=null) {
|
|
|
|
- List<MaterialInitialStock> stockArr = obj.getStock();
|
|
|
|
|
|
+ if(material.getStock()!=null) {
|
|
|
|
+ List<MaterialInitialStock> stockArr = material.getStock();
|
|
for (int i = 0; i < stockArr.size(); i++) {
|
|
for (int i = 0; i < stockArr.size(); i++) {
|
|
MaterialInitialStock jsonObj = stockArr.get(i);
|
|
MaterialInitialStock jsonObj = stockArr.get(i);
|
|
//此时id为仓库id,仓库di、最低安全库存数量不为空
|
|
//此时id为仓库id,仓库di、最低安全库存数量不为空
|
|
@@ -309,7 +313,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
@Override
|
|
@Override
|
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
public int batchDeleteMaterialByIds(String ids) throws Exception{
|
|
public int batchDeleteMaterialByIds(String ids) throws Exception{
|
|
- String [] idArray=ids.split(",");
|
|
|
|
|
|
+ String [] idArray = ids.split(",");
|
|
//校验单据子表 jsh_depot_item
|
|
//校验单据子表 jsh_depot_item
|
|
List<DepotItem> depotItemList =null;
|
|
List<DepotItem> depotItemList =null;
|
|
try{
|
|
try{
|
|
@@ -436,7 +440,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<Long> getListByParentId(Long parentId) {
|
|
public List<Long> getListByParentId(Long parentId) {
|
|
- List<Long> idList = new ArrayList<Long>();
|
|
|
|
|
|
+ List<Long> idList = new ArrayList<>();
|
|
List<MaterialCategory> list = materialCategoryMapperEx.getListByParentId(parentId);
|
|
List<MaterialCategory> list = materialCategoryMapperEx.getListByParentId(parentId);
|
|
idList.add(parentId);
|
|
idList.add(parentId);
|
|
if(list!=null && list.size()>0) {
|
|
if(list!=null && list.size()>0) {
|
|
@@ -1023,7 +1027,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
private Map<Long, String> getExcelDepot(Sheet src, int depotCount, Map<String, Long> depotMap, int i) throws Exception {
|
|
private Map<Long, String> getExcelDepot(Sheet src, int depotCount, Map<String, Long> depotMap, int i) throws Exception {
|
|
Map<Long, String> stockMap = new HashMap<>();
|
|
Map<Long, String> stockMap = new HashMap<>();
|
|
for(int j = 1; j<= depotCount; j++) {
|
|
for(int j = 1; j<= depotCount; j++) {
|
|
- int col = 16 + j;
|
|
|
|
|
|
+ int col = 18 + j;
|
|
if(col < src.getColumns()){
|
|
if(col < src.getColumns()){
|
|
String depotName = ExcelUtils.getContent(src, 1, col); //获取仓库名称
|
|
String depotName = ExcelUtils.getContent(src, 1, col); //获取仓库名称
|
|
if(StringUtil.isNotEmpty(depotName)) {
|
|
if(StringUtil.isNotEmpty(depotName)) {
|
|
@@ -1614,14 +1618,12 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
|
|
|
/**
|
|
/**
|
|
* 根据商品id查询主表及子表信息
|
|
* 根据商品id查询主表及子表信息
|
|
- * @param id 商品id
|
|
|
|
- * @return
|
|
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Material getMaterialById(Long id){
|
|
public Material getMaterialById(Long id){
|
|
Material material = materialMapper.selectByPrimaryKey(id);
|
|
Material material = materialMapper.selectByPrimaryKey(id);
|
|
- List<MaterialExtend> list = materialExtendMapper.selectByMId(id);
|
|
|
|
- material.setList(list);
|
|
|
|
|
|
+// List<MaterialExtend> list = materialExtendMapper.selectByMId(id);
|
|
|
|
+// material.setList(list);
|
|
return material;
|
|
return material;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1653,11 +1655,32 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
List<String> expirationReminders = new ArrayList<>();
|
|
List<String> expirationReminders = new ArrayList<>();
|
|
List<String> inventoryReminders = new ArrayList<>();
|
|
List<String> inventoryReminders = new ArrayList<>();
|
|
//获取商品信息
|
|
//获取商品信息
|
|
- MaterialExample materialExample = new MaterialExample();
|
|
|
|
- materialExample.createCriteria().andDeleteFlagEqualTo("0");
|
|
|
|
- List<Material> materials = materialMapper.selectByExample(materialExample);
|
|
|
|
|
|
+ List<Material> materials = list(new LambdaQueryWrapperX<Material>().isNotNull(Material::getMovingPinReminderCycle).eq(Material::getDeleteFlag,"0"));
|
|
|
|
+ //所有商品提醒信息赋值为空
|
|
|
|
+ this.update(new UpdateWrapper<Material>().set("reminder","").eq("delete_flag","0"));
|
|
//获取商品批次信息
|
|
//获取商品批次信息
|
|
- List<MaterialBatch> extendList = materialBatchService.list(new LambdaQueryWrapperX<MaterialBatch>().eq(MaterialBatch::getDeleteFlag,"0"));
|
|
|
|
|
|
+ List<MaterialBatch> extendList = materialBatchService.list(new LambdaQueryWrapperX<MaterialBatch>().gt(MaterialBatch::getInventory,"0").eq(MaterialBatch::getDeleteFlag,"0"));
|
|
|
|
+ Map<Long,Material> materialMap = new HashMap<>();
|
|
|
|
+ //过期提醒
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ extendList.stream().filter(v -> v.getInventory() != null && v.getInventory().doubleValue() > 0 && v.getProductionDate() != null && v.getExpiryNum() != null)
|
|
|
|
+ .forEach(v ->{
|
|
|
|
+ if (DateUtils.differentDaysByMillisecond(v.getProductionDate(),new Date()) > (v.getExpiryNum() -30)){
|
|
|
|
+ String name = materialMapper.selectByPrimaryKey(v.getMaterialId()).getName();
|
|
|
|
+ String str = "商品名称:" + name
|
|
|
|
+ + ", 批次号:" + v.getBatchNumber()
|
|
|
|
+ + ", 条码:" + v.getBarCode()
|
|
|
|
+ + ", 生产日期:" + sdf.format(v.getProductionDate())
|
|
|
|
+ + ", 保质期:" + v.getExpiryNum() + "天"
|
|
|
|
+ + ", 库存:" + v.getInventory()
|
|
|
|
+ + ",即将要过期,请及时处理";
|
|
|
|
+ expirationReminders.add(str);
|
|
|
|
+ if (materialMap.get(v.getMaterialId()) == null){
|
|
|
|
+ materialMap.put(v.getMaterialId(),new Material().setId(v.getMaterialId()).setReminder("临期"));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ vo.setExpirationReminder(expirationReminders);
|
|
//无动销提醒
|
|
//无动销提醒
|
|
materials.stream().filter( v -> v.getMovingPinReminderCycle() != null && !"".equals(v.getMovingPinReminderCycle()))
|
|
materials.stream().filter( v -> v.getMovingPinReminderCycle() != null && !"".equals(v.getMovingPinReminderCycle()))
|
|
.forEach(v -> {
|
|
.forEach(v -> {
|
|
@@ -1668,6 +1691,11 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
//当前时间对比订单时间是否大于动销提醒周期
|
|
//当前时间对比订单时间是否大于动销提醒周期
|
|
String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
|
|
String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
|
|
noMovingPinReminders.add(str);
|
|
noMovingPinReminders.add(str);
|
|
|
|
+ if (materialMap.get(v.getId()) == null){
|
|
|
|
+ materialMap.put(v.getId(),new Material().setId(v.getId()).setReminder("无动销"));
|
|
|
|
+ }else {
|
|
|
|
+ materialMap.put(v.getId(),new Material().setId(v.getId()).setReminder(materialMap.get(v.getId()).getReminder() + ",无动销"));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
//获取商品批次信息
|
|
//获取商品批次信息
|
|
@@ -1675,33 +1703,22 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
if (DateUtils.differentDaysByMillisecond(m.getCreateTime(),new Date()) > Integer.valueOf(v.getMovingPinReminderCycle())){
|
|
if (DateUtils.differentDaysByMillisecond(m.getCreateTime(),new Date()) > Integer.valueOf(v.getMovingPinReminderCycle())){
|
|
String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
|
|
String str = "商品名称:" + v.getName() + ",在[无动销提醒周期]内,无动销,请及时处理";
|
|
noMovingPinReminders.add(str);
|
|
noMovingPinReminders.add(str);
|
|
|
|
+ if (materialMap.get(v.getId()) == null){
|
|
|
|
+ materialMap.put(v.getId(),new Material().setId(v.getId()).setReminder("无动销"));
|
|
|
|
+ }else {
|
|
|
|
+ materialMap.get(v.getId()).setRemark(materialMap.get(v.getId()).getReminder() + ",无动销");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
});
|
|
vo.setNoMovingPinReminder(noMovingPinReminders);
|
|
vo.setNoMovingPinReminder(noMovingPinReminders);
|
|
- //过期提醒
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
- extendList.stream().filter(v -> v.getInventory() != null && v.getInventory().doubleValue() > 0 && v.getProductionDate() != null && v.getExpiryNum() != null)
|
|
|
|
- .forEach(v ->{
|
|
|
|
- if (DateUtils.differentDaysByMillisecond(v.getProductionDate(),new Date()) > (v.getExpiryNum() -30)){
|
|
|
|
- String name = materialMapper.selectByPrimaryKey(v.getMaterialId()).getName();
|
|
|
|
- String str = "商品名称:" + name
|
|
|
|
- + ", 批次号:" + v.getBatchNumber()
|
|
|
|
- + ", 条码:" + v.getBarCode()
|
|
|
|
- + ", 生产日期:" + sdf.format(v.getProductionDate())
|
|
|
|
- + ", 保质期:" + v.getExpiryNum() + "天"
|
|
|
|
- + ", 库存:" + v.getInventory()
|
|
|
|
- + ",即将要过期,请及时处理";
|
|
|
|
- expirationReminders.add(str);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- vo.setExpirationReminder(expirationReminders);
|
|
|
|
//库存提醒
|
|
//库存提醒
|
|
MaterialInitialStockExample initialStockExample = new MaterialInitialStockExample();
|
|
MaterialInitialStockExample initialStockExample = new MaterialInitialStockExample();
|
|
initialStockExample.createCriteria().andDeleteFlagEqualTo("0");
|
|
initialStockExample.createCriteria().andDeleteFlagEqualTo("0");
|
|
-
|
|
|
|
List<MaterialInitialStock> initialStocks = materialInitialStockMapper.selectByExample(initialStockExample);
|
|
List<MaterialInitialStock> initialStocks = materialInitialStockMapper.selectByExample(initialStockExample);
|
|
|
|
+ List<Depot> depotList = depotService.list();
|
|
|
|
+ Map<Long,String> depotMap = depotList.stream().collect(Collectors.toMap(Depot::getId,Depot::getName));
|
|
initialStocks.stream().filter(v -> v.getLowSafeStock() != null && v.getLowSafeStock().doubleValue() > 0)
|
|
initialStocks.stream().filter(v -> v.getLowSafeStock() != null && v.getLowSafeStock().doubleValue() > 0)
|
|
.forEach(v -> {
|
|
.forEach(v -> {
|
|
//根据商品id和仓库id查询当前库存
|
|
//根据商品id和仓库id查询当前库存
|
|
@@ -1709,11 +1726,18 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
if (currentNumber.doubleValue() <= v.getLowSafeStock().doubleValue()){
|
|
if (currentNumber.doubleValue() <= v.getLowSafeStock().doubleValue()){
|
|
Material material = materialMapper.selectByPrimaryKey(v.getMaterialId());
|
|
Material material = materialMapper.selectByPrimaryKey(v.getMaterialId());
|
|
String str = "商品名称:" + material.getName()
|
|
String str = "商品名称:" + material.getName()
|
|
- + ",库存告警,请及时处理";
|
|
|
|
|
|
+ +depotMap.get(v.getDepotId()) + ",库存告警,请及时处理";
|
|
inventoryReminders.add(str);
|
|
inventoryReminders.add(str);
|
|
|
|
+ if (materialMap.get(v.getMaterialId()) == null){
|
|
|
|
+ materialMap.put(v.getMaterialId(),new Material().setId(v.getMaterialId()).setReminder("库存危险"));
|
|
|
|
+ }else if (!materialMap.get(v.getMaterialId()).getReminder().contains("库存危险")){
|
|
|
|
+ materialMap.get(v.getMaterialId()).setReminder(materialMap.get(v.getMaterialId()).getReminder() + ",库存危险");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
});
|
|
});
|
|
vo.setInventoryReminder(inventoryReminders);
|
|
vo.setInventoryReminder(inventoryReminders);
|
|
|
|
+ List<Material> materialList = new ArrayList<>(materialMap.values());
|
|
|
|
+ this.updateBatchById(materialList);
|
|
return vo;
|
|
return vo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1760,10 +1784,12 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
String enabled = ExcelUtils.getContent(src, i, 10); //状态
|
|
String enabled = ExcelUtils.getContent(src, i, 10); //状态
|
|
String enableSerialNumber = ExcelUtils.getContent(src, i, 11); //序列号
|
|
String enableSerialNumber = ExcelUtils.getContent(src, i, 11); //序列号
|
|
String barCode = ExcelUtils.getContent(src, i, 12); //商品条码
|
|
String barCode = ExcelUtils.getContent(src, i, 12); //商品条码
|
|
- String otherField1 = ExcelUtils.getContent(src, i, 13); //自定义1
|
|
|
|
- String otherField2 = ExcelUtils.getContent(src, i, 14); //自定义2
|
|
|
|
- String otherField3 = ExcelUtils.getContent(src, i, 15); //自定义3
|
|
|
|
- String remark = ExcelUtils.getContent(src, i, 16); //备注
|
|
|
|
|
|
+ String defaultPurchaseDecimal = ExcelUtils.getContent(src, i, 13); //默认销售价
|
|
|
|
+ String defaultWholesaleDecimal = ExcelUtils.getContent(src, i, 14); //默认采购价
|
|
|
|
+ String otherField1 = ExcelUtils.getContent(src, i, 15); //自定义1
|
|
|
|
+ String otherField2 = ExcelUtils.getContent(src, i, 16); //自定义2
|
|
|
|
+ String otherField3 = ExcelUtils.getContent(src, i, 17); //自定义3
|
|
|
|
+ String remark = ExcelUtils.getContent(src, i, 18); //备注
|
|
//校验字段
|
|
//校验字段
|
|
//名称为空
|
|
//名称为空
|
|
if(StringUtil.isEmpty(name)) {
|
|
if(StringUtil.isEmpty(name)) {
|
|
@@ -1824,6 +1850,26 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_CODE,
|
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_CODE,
|
|
String.format(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_MSG, barCode));
|
|
String.format(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_MSG, barCode));
|
|
}
|
|
}
|
|
|
|
+ //默认采购价为空
|
|
|
|
+ if(StringUtil.isEmpty(defaultPurchaseDecimal)) {
|
|
|
|
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_CODE,
|
|
|
|
+ String.format(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_MSG, i+1));
|
|
|
|
+ }
|
|
|
|
+ //校验默认采购价是否是数字(含小数)
|
|
|
|
+ if(!StringUtil.isPositiveBigDecimal(defaultPurchaseDecimal)) {
|
|
|
|
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_NOT_DECIMAL_CODE,
|
|
|
|
+ String.format(ExceptionConstants.MATERIAL_DEFAULT_PURCHASE_DECIMAL_NOT_DECIMAL_MSG, i+1));
|
|
|
|
+ }
|
|
|
|
+ //默认销售价为空
|
|
|
|
+ if(StringUtil.isEmpty(defaultWholesaleDecimal)) {
|
|
|
|
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_EMPTY_CODE,
|
|
|
|
+ String.format(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_EMPTY_MSG, i+1));
|
|
|
|
+ }
|
|
|
|
+ //校验默认销售价是否是数字(含小数)
|
|
|
|
+ if(!StringUtil.isPositiveBigDecimal(defaultWholesaleDecimal)) {
|
|
|
|
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_NOT_DECIMAL_CODE,
|
|
|
|
+ String.format(ExceptionConstants.MATERIAL_DEFAULT_WHOLESALE_DECIMAL_NOT_DECIMAL_MSG, i+1));
|
|
|
|
+ }
|
|
//批量校验excel中有无重复条码(1-文档自身校验,2-和数据库里面的商品校验)
|
|
//批量校验excel中有无重复条码(1-文档自身校验,2-和数据库里面的商品校验)
|
|
batchCheckExistBarCodeByParam(mList, barCode, null);
|
|
batchCheckExistBarCodeByParam(mList, barCode, null);
|
|
// Long depotId = null;
|
|
// Long depotId = null;
|
|
@@ -1862,6 +1908,10 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
Long serial_no = categoryId == null ? null : materialCategoryService.getMaterialCategory(m.getCategoryId()).getSerialNo();
|
|
Long serial_no = categoryId == null ? null : materialCategoryService.getMaterialCategory(m.getCategoryId()).getSerialNo();
|
|
//设置系统sku
|
|
//设置系统sku
|
|
m.setSystemSku(serial_no + DateUtils.dateTimeNow() + RandomHelper.getRandomStr(6));
|
|
m.setSystemSku(serial_no + DateUtils.dateTimeNow() + RandomHelper.getRandomStr(6));
|
|
|
|
+ //设置默认采购价
|
|
|
|
+ m.setDefaultPurchaseDecimal(StringUtil.isNotEmpty(defaultPurchaseDecimal) ? new BigDecimal(defaultPurchaseDecimal) : null);
|
|
|
|
+ //设置默认销售价
|
|
|
|
+ m.setDefaultWholesaleDecimal(StringUtil.isNotEmpty(defaultWholesaleDecimal) ? new BigDecimal(defaultWholesaleDecimal) : null);
|
|
m.setOtherField1(StringUtil.isNotEmpty(otherField1)?otherField1:null);
|
|
m.setOtherField1(StringUtil.isNotEmpty(otherField1)?otherField1:null);
|
|
m.setOtherField2(StringUtil.isNotEmpty(otherField2)?otherField2:null);
|
|
m.setOtherField2(StringUtil.isNotEmpty(otherField2)?otherField2:null);
|
|
m.setOtherField3(StringUtil.isNotEmpty(otherField3)?otherField3:null);
|
|
m.setOtherField3(StringUtil.isNotEmpty(otherField3)?otherField3:null);
|
|
@@ -2064,41 +2114,41 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
+ "-" + m.getUnit();
|
|
+ "-" + m.getUnit();
|
|
if (materialMap.get(str) == null) {
|
|
if (materialMap.get(str) == null) {
|
|
//商品主表不存在,创建商品主表
|
|
//商品主表不存在,创建商品主表
|
|
- Material material = new Material();
|
|
|
|
- //名称
|
|
|
|
- material.setName(m.getName());
|
|
|
|
- //型号
|
|
|
|
- material.setModel(m.getModel());
|
|
|
|
- //规格
|
|
|
|
- material.setStandard(m.getStandard());
|
|
|
|
- //品牌
|
|
|
|
- material.setBrand(m.getBrand());
|
|
|
|
- //助记码
|
|
|
|
- material.setMnemonic(m.getMnemonic());
|
|
|
|
- //颜色
|
|
|
|
- material.setColor(m.getColor());
|
|
|
|
- //商品类别
|
|
|
|
- material.setCategoryId(m.getCategoryId());
|
|
|
|
- //单位-单个
|
|
|
|
- material.setUnit(m.getUnit());
|
|
|
|
- //计量单位Id
|
|
|
|
- material.setUnitId(m.getUnitId());
|
|
|
|
- //备注
|
|
|
|
- material.setRemark(m.getRemark());
|
|
|
|
- //基础重量
|
|
|
|
- material.setWeight(m.getWeight());
|
|
|
|
- //启用 0-禁用 1-启用
|
|
|
|
- material.setEnabled(m.getEnabled());
|
|
|
|
- //自定义1
|
|
|
|
- material.setOtherField1(m.getOtherField1());
|
|
|
|
- //自定义2
|
|
|
|
- material.setOtherField2(m.getOtherField2());
|
|
|
|
- //自定义3
|
|
|
|
- material.setOtherField3(m.getOtherField3());
|
|
|
|
- //是否开启序列号
|
|
|
|
- material.setEnableSerialNumber(m.getEnableSerialNumber());
|
|
|
|
- //系统sku
|
|
|
|
- material.setSystemSku(m.getSystemSku());
|
|
|
|
|
|
+ Material material = m;
|
|
|
|
+// //名称
|
|
|
|
+// material.setName(m.getName());
|
|
|
|
+// //型号
|
|
|
|
+// material.setModel(m.getModel());
|
|
|
|
+// //规格
|
|
|
|
+// material.setStandard(m.getStandard());
|
|
|
|
+// //品牌
|
|
|
|
+// material.setBrand(m.getBrand());
|
|
|
|
+// //助记码
|
|
|
|
+// material.setMnemonic(m.getMnemonic());
|
|
|
|
+// //颜色
|
|
|
|
+// material.setColor(m.getColor());
|
|
|
|
+// //商品类别
|
|
|
|
+// material.setCategoryId(m.getCategoryId());
|
|
|
|
+// //单位-单个
|
|
|
|
+// material.setUnit(m.getUnit());
|
|
|
|
+// //计量单位Id
|
|
|
|
+// material.setUnitId(m.getUnitId());
|
|
|
|
+// //备注
|
|
|
|
+// material.setRemark(m.getRemark());
|
|
|
|
+// //基础重量
|
|
|
|
+// material.setWeight(m.getWeight());
|
|
|
|
+// //启用 0-禁用 1-启用
|
|
|
|
+// material.setEnabled(m.getEnabled());
|
|
|
|
+// //自定义1
|
|
|
|
+// material.setOtherField1(m.getOtherField1());
|
|
|
|
+// //自定义2
|
|
|
|
+// material.setOtherField2(m.getOtherField2());
|
|
|
|
+// //自定义3
|
|
|
|
+// material.setOtherField3(m.getOtherField3());
|
|
|
|
+// //是否开启序列号
|
|
|
|
+// material.setEnableSerialNumber(m.getEnableSerialNumber());
|
|
|
|
+// //系统sku
|
|
|
|
+// material.setSystemSku(m.getSystemSku());
|
|
List<MaterialExtend> list = new ArrayList<>();
|
|
List<MaterialExtend> list = new ArrayList<>();
|
|
material.setList(list);
|
|
material.setList(list);
|
|
material.setDepotMap(m.getDepotMap());
|
|
material.setDepotMap(m.getDepotMap());
|