|
|
@@ -160,10 +160,16 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|
|
product.setTitle(row.getCell(1).getStringCellValue().trim());
|
|
|
}
|
|
|
|
|
|
- // 原厂型号
|
|
|
+ // 物料规格
|
|
|
if (row.getCell(2) != null) {
|
|
|
row.getCell(2).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- product.setCmpCode(row.getCell(2).getStringCellValue().trim());
|
|
|
+ product.setSpec(row.getCell(2).getStringCellValue().trim());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 原厂型号
|
|
|
+ if (row.getCell(3) != null) {
|
|
|
+ row.getCell(3).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
+ product.setCmpCode(row.getCell(3).getStringCellValue().trim());
|
|
|
if (product.getCode() == null) {
|
|
|
// 生成随机物料编码
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("mmsssss");
|
|
|
@@ -173,47 +179,49 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|
|
}
|
|
|
|
|
|
// 品牌
|
|
|
- if (row.getCell(3) != null) {
|
|
|
- row.getCell(3).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- product.setBrand(row.getCell(3).getStringCellValue().trim());
|
|
|
- }
|
|
|
-
|
|
|
- // 单位
|
|
|
if (row.getCell(4) != null) {
|
|
|
row.getCell(4).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- product.setUnit(row.getCell(4).getStringCellValue().trim());
|
|
|
+ product.setBrand(row.getCell(4).getStringCellValue().trim());
|
|
|
}
|
|
|
|
|
|
- // 最小包装量
|
|
|
+ // 单位
|
|
|
if (row.getCell(5) != null) {
|
|
|
row.getCell(5).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
if (null != row.getCell(5).getStringCellValue()
|
|
|
&& !row.getCell(5).getStringCellValue().trim().equals("")) {
|
|
|
- product.setMinPack(Double.valueOf(row.getCell(5).getStringCellValue()));
|
|
|
+ product.setUnit(row.getCell(5).getStringCellValue());
|
|
|
}
|
|
|
}
|
|
|
- // 最小订购量
|
|
|
+ // 最小包装量
|
|
|
if (row.getCell(6) != null) {
|
|
|
row.getCell(6).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
if (null != row.getCell(6).getStringCellValue().trim()
|
|
|
&& !row.getCell(6).getStringCellValue().trim().equals("")) {
|
|
|
- product.setMinOrder(Double.valueOf(row.getCell(6).getStringCellValue()));
|
|
|
+ product.setMinPack(Double.valueOf(row.getCell(6).getStringCellValue()));
|
|
|
}
|
|
|
}
|
|
|
- // 交货周期
|
|
|
+ // 最小订购量
|
|
|
if (row.getCell(7) != null) {
|
|
|
row.getCell(7).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
if (null != row.getCell(7).getStringCellValue().trim()
|
|
|
&& !row.getCell(7).getStringCellValue().trim().equals("")) {
|
|
|
- product.setLeadtime(Double.valueOf(row.getCell(7).getStringCellValue()));
|
|
|
+ product.setMinOrder(Double.valueOf(row.getCell(7).getStringCellValue()));
|
|
|
}
|
|
|
}
|
|
|
- // 交货提前期
|
|
|
+ // 交货周期
|
|
|
if (row.getCell(8) != null) {
|
|
|
row.getCell(8).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
if (null != row.getCell(8).getStringCellValue().trim()
|
|
|
&& !row.getCell(8).getStringCellValue().trim().equals("")) {
|
|
|
- product.setLtinstock(Double.valueOf(row.getCell(8).getStringCellValue()));
|
|
|
+ product.setLeadtime(Double.valueOf(row.getCell(8).getStringCellValue()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 交货提前期
|
|
|
+ if (row.getCell(9) != null) {
|
|
|
+ row.getCell(9).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
+ if (null != row.getCell(9).getStringCellValue().trim()
|
|
|
+ && !row.getCell(9).getStringCellValue().trim().equals("")) {
|
|
|
+ product.setLtinstock(Double.valueOf(row.getCell(9).getStringCellValue()));
|
|
|
}
|
|
|
}
|
|
|
// 判断是否存在
|
|
|
@@ -222,7 +230,19 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|
|
if (!CollectionUtils.isEmpty(prods)) {
|
|
|
// 如果存在且不是ERP传来的物料,允许修改
|
|
|
if (!"ERP".equals(prods.get(0).getSourceApp())) {
|
|
|
- product.setId(prods.get(0).getId());
|
|
|
+ Product temp = new Product();
|
|
|
+ BeanUtils.copyProperties(prods.get(0), temp);
|
|
|
+ temp.setCode(product.getCode());
|
|
|
+ temp.setTitle(product.getTitle());
|
|
|
+ temp.setSpec(product.getSpec());
|
|
|
+ temp.setCmpCode(product.getCmpCode());
|
|
|
+ temp.setBrand(product.getBrand());
|
|
|
+ temp.setUnit(product.getUnit());
|
|
|
+ temp.setMinPack(product.getMinPack());
|
|
|
+ temp.setMinOrder(product.getMinOrder());
|
|
|
+ temp.setLeadtime(product.getLeadtime());
|
|
|
+ temp.setLtinstock(product.getLtinstock());
|
|
|
+ BeanUtils.copyProperties(temp, product);
|
|
|
alters.add(product.getCode());
|
|
|
} else {
|
|
|
// ERP上传的物料不更新
|