|
|
|
|
@ -16,6 +16,8 @@
|
|
|
|
|
package com.youchain.basicdata.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.poi.excel.ExcelReader;
|
|
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
|
|
|
import com.youchain.basicdata.domain.*;
|
|
|
|
|
import com.youchain.basicdata.repository.*;
|
|
|
|
|
import com.youchain.basicdata.service.*;
|
|
|
|
|
@ -30,6 +32,7 @@ import com.youchain.businessdata.domain.PickTicket;
|
|
|
|
|
import com.youchain.businessdata.service.*;
|
|
|
|
|
import com.youchain.config.FileProperties;
|
|
|
|
|
import com.youchain.exception.BadRequestException;
|
|
|
|
|
import com.youchain.modules.system.domain.Dept;
|
|
|
|
|
import com.youchain.modules.system.domain.DictDetail;
|
|
|
|
|
import com.youchain.modules.system.repository.DictDetailRepository;
|
|
|
|
|
import com.youchain.modules.system.repository.DictRepository;
|
|
|
|
|
@ -62,13 +65,9 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
private final BigItemRepository bigItemRepository;
|
|
|
|
|
private final AreaRepository areaRepository;
|
|
|
|
|
private final ItemRepository itemRepository;
|
|
|
|
|
private final DictDetailRepository dictDetailRepository;
|
|
|
|
|
private final PointRepository pointRepository;
|
|
|
|
|
private final PointService pointService;
|
|
|
|
|
private final AreaService areaService;
|
|
|
|
|
private final BomAccountRepository bomAccountRepository;
|
|
|
|
|
private final AreaMapper areaMapper;
|
|
|
|
|
private final PointMapper pointMapper;
|
|
|
|
|
private final ItemService itemService;
|
|
|
|
|
private final AsnDetailService asnDetailService;
|
|
|
|
|
private final AsnService asnService;
|
|
|
|
|
@ -78,58 +77,59 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
private final BigItemService bigItemService;
|
|
|
|
|
private final BomAccountService bomAccountService;
|
|
|
|
|
private final BomAccountLogService bomAccountLogService;
|
|
|
|
|
private final BatchCreateOrUpdate batchCreateOrUpdate;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void importBomAccount(int row,Map<String, Object> readAll) {
|
|
|
|
|
String bigItemCode =readAll.get("完成品品番")==null?null:readAll.get("完成品品番").toString();
|
|
|
|
|
String station_type =readAll.get("工位")==null?null:readAll.get("工位").toString();
|
|
|
|
|
String itemCode = readAll.get("部品品番")==null?null:readAll.get("部品品番").toString();
|
|
|
|
|
String ac = readAll.get("AC")==null?null:readAll.get("AC").toString();
|
|
|
|
|
String contents = readAll.get("加工内容")==null?null:readAll.get("加工内容").toString();
|
|
|
|
|
String single = readAll.get("单用")==null?null:readAll.get("单用").toString();
|
|
|
|
|
String r_area_name = readAll.get("入库库区")==null?null:readAll.get("入库库区").toString();
|
|
|
|
|
String c_area_name =readAll.get("出库库区")==null?null:readAll.get("出库库区").toString();
|
|
|
|
|
String z_point_code =readAll.get("制造库位")==null?null:readAll.get("制造库位").toString();
|
|
|
|
|
public void importBomAccount(int row, Map<String, Object> readAll) {
|
|
|
|
|
String bigItemCode = readAll.get("完成品品番") == null ? null : readAll.get("完成品品番").toString();
|
|
|
|
|
String station_type = readAll.get("工位") == null ? null : readAll.get("工位").toString();
|
|
|
|
|
String itemCode = readAll.get("部品品番") == null ? null : readAll.get("部品品番").toString();
|
|
|
|
|
String ac = readAll.get("AC") == null ? null : readAll.get("AC").toString();
|
|
|
|
|
String contents = readAll.get("加工内容") == null ? null : readAll.get("加工内容").toString();
|
|
|
|
|
String single = readAll.get("单用") == null ? null : readAll.get("单用").toString();
|
|
|
|
|
String r_area_name = readAll.get("入库库区") == null ? null : readAll.get("入库库区").toString();
|
|
|
|
|
String c_area_name = readAll.get("出库库区") == null ? null : readAll.get("出库库区").toString();
|
|
|
|
|
String z_point_code = readAll.get("制造库位") == null ? null : readAll.get("制造库位").toString();
|
|
|
|
|
// String c_point_code =readAll.get("暂存库位")==null?null:readAll.get("暂存库位").toString();
|
|
|
|
|
String out_type = readAll.get("出库类型")==null?null:readAll.get("出库类型").toString();
|
|
|
|
|
String supplier = readAll.get("供应商")==null?null:readAll.get("供应商").toString();
|
|
|
|
|
String bp_type = readAll.get("部品种类")==null?null:readAll.get("部品种类").toString();
|
|
|
|
|
String out_type = readAll.get("出库类型") == null ? null : readAll.get("出库类型").toString();
|
|
|
|
|
String supplier = readAll.get("供应商") == null ? null : readAll.get("供应商").toString();
|
|
|
|
|
String bp_type = readAll.get("部品种类") == null ? null : readAll.get("部品种类").toString();
|
|
|
|
|
|
|
|
|
|
BigItem bigItem = null;
|
|
|
|
|
if (bigItemCode.length() > 0) {
|
|
|
|
|
bigItem = bigItemRepository.findByCode(bigItemCode);
|
|
|
|
|
if (bigItem == null) {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+bigItemCode+"完成品品番无效");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + bigItemCode + "完成品品番无效");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入完成品品番");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + "请输入完成品品番");
|
|
|
|
|
}
|
|
|
|
|
Item item = null;
|
|
|
|
|
if (itemCode.length() > 0) {
|
|
|
|
|
item = itemRepository.findByCode(itemCode);
|
|
|
|
|
if (item == null) {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+itemCode+"部品品番无效");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + itemCode + "部品品番无效");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入部品品番");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + "请输入部品品番");
|
|
|
|
|
}
|
|
|
|
|
Area r_area = null;
|
|
|
|
|
if (r_area_name.length() > 0) {
|
|
|
|
|
r_area = areaRepository.getByName(r_area_name);
|
|
|
|
|
if (r_area == null) {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+r_area_name+"入库库区无效");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + r_area_name + "入库库区无效");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入入库库区");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + "请输入入库库区");
|
|
|
|
|
}
|
|
|
|
|
Area c_area = null;
|
|
|
|
|
if (c_area_name.length() > 0) {
|
|
|
|
|
c_area = areaRepository.getByName(c_area_name);
|
|
|
|
|
if (c_area == null) {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+c_area_name+"出库库区无效");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + c_area_name + "出库库区无效");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入出库库区");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + "请输入出库库区");
|
|
|
|
|
}
|
|
|
|
|
// Point c_point = null;
|
|
|
|
|
// if (c_point_code!=null&&!c_point_code.equals("")) {
|
|
|
|
|
@ -139,7 +139,7 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
Point z_point = null;
|
|
|
|
|
if (z_point_code!=null&&!z_point_code.equals("")) {
|
|
|
|
|
if (z_point_code != null && !z_point_code.equals("")) {
|
|
|
|
|
z_point = pointRepository.findByCode(z_point_code);
|
|
|
|
|
if (z_point == null) {
|
|
|
|
|
// z_point = pointService.createPoint(z_point_code, "ZZKW", r_area,c_point);
|
|
|
|
|
@ -147,9 +147,9 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row+"行"+"请输入制造库位");
|
|
|
|
|
throw new BadRequestException(HttpStatus.NOT_FOUND, row + "行" + "请输入制造库位");
|
|
|
|
|
}
|
|
|
|
|
Boolean isNew= Boolean.FALSE;
|
|
|
|
|
Boolean isNew = Boolean.FALSE;
|
|
|
|
|
BomAccount bomAccount = bomAccountRepository.findByOnly(bigItem.getId(), item.getId(), r_area.getId(), z_point.getId());
|
|
|
|
|
if (bomAccount == null) {
|
|
|
|
|
bomAccount = new BomAccount();
|
|
|
|
|
@ -159,7 +159,7 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
bomAccount.setDept(r_area.getDept());
|
|
|
|
|
bomAccount.setZPoint(z_point);
|
|
|
|
|
bomAccount.setBp_type(bp_type);
|
|
|
|
|
isNew=Boolean.TRUE;
|
|
|
|
|
isNew = Boolean.TRUE;
|
|
|
|
|
}
|
|
|
|
|
bomAccount.setStationType(station_type);
|
|
|
|
|
bomAccount.setCArea(c_area);
|
|
|
|
|
@ -169,57 +169,131 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
bomAccount.setSingles(Integer.parseInt(single));
|
|
|
|
|
bomAccount.setOutType(out_type);
|
|
|
|
|
bomAccount.setSupplier(supplier);
|
|
|
|
|
if(isNew){
|
|
|
|
|
if (isNew) {
|
|
|
|
|
bomAccountService.create(bomAccount);
|
|
|
|
|
bomAccountLogService.copyBomAccount(bomAccount.getId(),"import_add");
|
|
|
|
|
}else{
|
|
|
|
|
bomAccountLogService.copyBomAccount(bomAccount.getId(), "import_add");
|
|
|
|
|
} else {
|
|
|
|
|
bomAccountService.update(bomAccount);
|
|
|
|
|
bomAccountLogService.copyBomAccount(bomAccount.getId(),"import_update");
|
|
|
|
|
bomAccountLogService.copyBomAccount(bomAccount.getId(), "import_update");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String importItem(Map<String, Object> readAll) {
|
|
|
|
|
String re = "";
|
|
|
|
|
String code = readAll.get("品番")==null?null:readAll.get("品番").toString();
|
|
|
|
|
String name = readAll.get("品名")==null?null:readAll.get("品名").toString();
|
|
|
|
|
String specs = readAll.get("规格")==null?null:readAll.get("规格").toString();
|
|
|
|
|
String unit = readAll.get("单位")==null?null:readAll.get("单位").toString();
|
|
|
|
|
String hz = readAll.get("荷资")==null?null:readAll.get("荷资").toString();
|
|
|
|
|
String srs =readAll.get("收容数")==null?null:readAll.get("收容数").toString();
|
|
|
|
|
if (code.length() > 0) {
|
|
|
|
|
Item item = itemRepository.findByAllCode(code);
|
|
|
|
|
if (item == null) {
|
|
|
|
|
re = "a";
|
|
|
|
|
item = new Item();
|
|
|
|
|
item.setDept(UserUtils.getDept());
|
|
|
|
|
item.setCode(code);
|
|
|
|
|
} else {
|
|
|
|
|
re = "b";
|
|
|
|
|
public String importItem(MultipartFile multipartFile) {
|
|
|
|
|
//编码、名称、物料类型
|
|
|
|
|
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
|
|
|
|
|
String suffix = FileUtil.getExtensionName(multipartFile.getOriginalFilename());
|
|
|
|
|
String type = FileUtil.getFileType(suffix);
|
|
|
|
|
File file = FileUtil.upload(multipartFile, properties.getPath().getPath() + type + File.separator);
|
|
|
|
|
Dept dept = UserUtils.getDept();
|
|
|
|
|
ExcelReader reader = ExcelUtil.getReader(file);
|
|
|
|
|
List<Map<String, Object>> readAll = reader.readAll();
|
|
|
|
|
Set<String> itemCodes = new HashSet<>();//物料集合
|
|
|
|
|
for (Map<String, Object> record : readAll) {
|
|
|
|
|
String itemCode = record.get("料号").toString().trim();
|
|
|
|
|
if (!StringUtils.isEmpty(itemCode)) {
|
|
|
|
|
itemCodes.add(itemCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
item.setName(name);
|
|
|
|
|
|
|
|
|
|
if (unit!=null&&!unit.equals("")) {
|
|
|
|
|
DictDetail dictDetail = dictDetailRepository.findByDictAndLabel("item_unit", unit);
|
|
|
|
|
item.setUnit(dictDetail.getValue());
|
|
|
|
|
}
|
|
|
|
|
if (re.equals("a")){
|
|
|
|
|
itemRepository.save(item);
|
|
|
|
|
}else if (re.equals("b")){
|
|
|
|
|
itemService.update(item);
|
|
|
|
|
|
|
|
|
|
//获取已存在的物料
|
|
|
|
|
Map<String, Item> existingPoint = itemService.findByCodes(itemCodes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Item> itemsToInsert= new ArrayList<>();//新增物料集合
|
|
|
|
|
List<Item> itemsToUpdate = new ArrayList<>();//修改物料集合
|
|
|
|
|
for (Map<String, Object> record : readAll) {
|
|
|
|
|
String itemCode = record.get("料号").toString().trim();
|
|
|
|
|
//判断是否已存在物料
|
|
|
|
|
if (existingPoint.containsKey(itemCode)) {
|
|
|
|
|
Item item = existingPoint.get(itemCode);
|
|
|
|
|
//更新物料
|
|
|
|
|
itemsToUpdate.add(updateItems(item, dept, record));
|
|
|
|
|
} else {
|
|
|
|
|
//新增点位
|
|
|
|
|
itemsToInsert.add(createItem(dept, record));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return re;
|
|
|
|
|
|
|
|
|
|
//批量新增物料
|
|
|
|
|
if (!itemsToInsert.isEmpty()) {
|
|
|
|
|
batchCreateOrUpdate.batchInsert(itemsToInsert);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//批量更新物料
|
|
|
|
|
if (!itemsToUpdate.isEmpty()) {
|
|
|
|
|
batchCreateOrUpdate.batchUpdate(itemsToUpdate);
|
|
|
|
|
}
|
|
|
|
|
return ("导入成功:" + " 新增(" + itemsToInsert.size() + ")修改(" + itemsToUpdate.size() + ")");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Item updateItems(Item item, Dept dept, Map<String, Object> record) {
|
|
|
|
|
item.setDept(dept);
|
|
|
|
|
item.setName(record.get("物料描述").toString().trim());
|
|
|
|
|
item.setPackageType(record.get("包装类型").toString().trim());
|
|
|
|
|
item.setSpecQuantity(record.get("规格数量") == null ? 0 : Double.parseDouble(record.get("规格数量").toString()));
|
|
|
|
|
item.setSpecWeight(record.get("规格重量") == null ? 0 : Double.parseDouble(record.get("规格重量").toString()));
|
|
|
|
|
item.setGrossWeight(record.get("毛重") == null ? 0 : Double.parseDouble(record.get("毛重").toString()));
|
|
|
|
|
item.setLength(record.get("长") == null ? 0 : Double.parseDouble(record.get("长").toString()));
|
|
|
|
|
item.setWidth(record.get("宽") == null ? 0 : Double.parseDouble(record.get("宽").toString()));
|
|
|
|
|
item.setHeight(record.get("高") == null ? 0 : Double.parseDouble(record.get("高").toString()));
|
|
|
|
|
item.setVolume(record.get("体积") == null ? 0 : Double.parseDouble(record.get("体积").toString()));
|
|
|
|
|
item.setUnit(record.get("单位").toString().trim());
|
|
|
|
|
item.setType(record.get("类型").toString().trim());
|
|
|
|
|
item.setValueGrade(record.get("物料价值等级").toString().trim());
|
|
|
|
|
item.setValidPeriod(record.get("保质期") == null ? 0 : Integer.parseInt(record.get("保质期").toString()));
|
|
|
|
|
item.setAlertDays(record.get("预警天数") == null ? 0 : Integer.parseInt(record.get("预警天数").toString()));
|
|
|
|
|
item.setIsBatch("是".equals(record.get("是否批次").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsSerial("是".equals(record.get("是否序列号").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsValidPeriod("是".equals(record.get("是否有效期").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsHazardous("是".equals(record.get("是否危化品").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsInvAvailable("是".equals(record.get("是否有库存").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsSapMaterial("是".equals(record.get("是否SAP料号").toString().trim()) ? true : false);
|
|
|
|
|
item.setHeatValue(record.get("热度值") == null ? 0 : Integer.parseInt(record.get("热度值").toString()));
|
|
|
|
|
item.setDescription(record.get("备注").toString().trim());
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Item createItem(Dept dept, Map<String, Object> record) {
|
|
|
|
|
Item item = new Item();
|
|
|
|
|
item.setCode(record.get("料号").toString().trim());
|
|
|
|
|
item.setName(record.get("物料描述").toString().trim());
|
|
|
|
|
item.setPackageType(record.get("包装类型").toString().trim());
|
|
|
|
|
item.setSpecQuantity(record.get("规格数量") == null ? 0 : Double.parseDouble(record.get("规格数量").toString()));
|
|
|
|
|
item.setSpecWeight(record.get("规格重量") == null ? 0 : Double.parseDouble(record.get("规格重量").toString()));
|
|
|
|
|
item.setGrossWeight(record.get("毛重") == null ? 0 : Double.parseDouble(record.get("毛重").toString()));
|
|
|
|
|
item.setLength(record.get("长") == null ? 0 : Double.parseDouble(record.get("长").toString()));
|
|
|
|
|
item.setWidth(record.get("宽") == null ? 0 : Double.parseDouble(record.get("宽").toString()));
|
|
|
|
|
item.setHeight(record.get("高") == null ? 0 : Double.parseDouble(record.get("高").toString()));
|
|
|
|
|
item.setVolume(record.get("体积") == null ? 0 : Double.parseDouble(record.get("体积").toString()));
|
|
|
|
|
item.setUnit(record.get("单位").toString().trim());
|
|
|
|
|
item.setType(record.get("类型").toString().trim());
|
|
|
|
|
item.setValueGrade(record.get("物料价值等级").toString().trim());
|
|
|
|
|
item.setValidPeriod(record.get("保质期") == null ? 0 : Integer.parseInt(record.get("保质期").toString()));
|
|
|
|
|
item.setAlertDays(record.get("预警天数") == null ? 0 : Integer.parseInt(record.get("预警天数").toString()));
|
|
|
|
|
item.setIsBatch("是".equals(record.get("是否批次").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsSerial("是".equals(record.get("是否序列号").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsValidPeriod("是".equals(record.get("是否有效期").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsHazardous("是".equals(record.get("是否危化品").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsInvAvailable("是".equals(record.get("是否有库存").toString().trim()) ? true : false);
|
|
|
|
|
item.setIsSapMaterial("是".equals(record.get("是否SAP料号").toString().trim()) ? true : false);
|
|
|
|
|
item.setHeatValue(record.get("热度值") == null ? 0 : Integer.parseInt(record.get("热度值").toString()));
|
|
|
|
|
item.setDescription(record.get("备注").toString().trim());
|
|
|
|
|
item.setDept(dept);
|
|
|
|
|
item.setEnabled(true);
|
|
|
|
|
return item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String importBigItem(Map<String, Object> readAll) {
|
|
|
|
|
String re = "";
|
|
|
|
|
String code =readAll.get("完成品品番")==null?null:readAll.get("完成品品番").toString().trim();
|
|
|
|
|
String name = readAll.get("完成品型式名")==null?null:readAll.get("完成品型式名").toString().trim();
|
|
|
|
|
String models =readAll.get("机种")==null?null:readAll.get("机种").toString().trim();
|
|
|
|
|
String country =readAll.get("国别")==null?null:readAll.get("国别").toString().trim();
|
|
|
|
|
String outboundType =readAll.get("出库类型")==null?null:readAll.get("出库类型").toString().trim();
|
|
|
|
|
String code = readAll.get("完成品品番") == null ? null : readAll.get("完成品品番").toString().trim();
|
|
|
|
|
String name = readAll.get("完成品型式名") == null ? null : readAll.get("完成品型式名").toString().trim();
|
|
|
|
|
String models = readAll.get("机种") == null ? null : readAll.get("机种").toString().trim();
|
|
|
|
|
String country = readAll.get("国别") == null ? null : readAll.get("国别").toString().trim();
|
|
|
|
|
String outboundType = readAll.get("出库类型") == null ? null : readAll.get("出库类型").toString().trim();
|
|
|
|
|
if (code.length() > 0) {
|
|
|
|
|
BigItem bigItem = bigItemRepository.findByCode(code);
|
|
|
|
|
if (bigItem == null) {
|
|
|
|
|
@ -228,16 +302,17 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
bigItem.setCode(code);
|
|
|
|
|
bigItem.setDeptId(UserUtils.getDept().getId());
|
|
|
|
|
} else {
|
|
|
|
|
re = "b";
|
|
|
|
|
//新增物料
|
|
|
|
|
//itemsToCreate.add(createItem(dept, record));
|
|
|
|
|
}
|
|
|
|
|
bigItem.setModels(models);
|
|
|
|
|
bigItem.setName(name);
|
|
|
|
|
bigItem.setCountry(country);
|
|
|
|
|
bigItem.setOutboundType(outboundType);
|
|
|
|
|
bigItem.setEnabled(true);
|
|
|
|
|
if (re.equals("a")){
|
|
|
|
|
if (re.equals("a")) {
|
|
|
|
|
bigItemService.create(bigItem);
|
|
|
|
|
}else if (re.equals("b")){
|
|
|
|
|
} else if (re.equals("b")) {
|
|
|
|
|
bigItemService.update(bigItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -247,23 +322,23 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
@Override
|
|
|
|
|
public String importAsnDetail(Map<String, Object> readAll, Asn asn) {
|
|
|
|
|
String re = "";
|
|
|
|
|
String code =readAll.get("品番")==null?null:readAll.get("品番").toString();
|
|
|
|
|
String qty = readAll.get("数量")==null?null:readAll.get("数量").toString();
|
|
|
|
|
String zzkw = readAll.get("制造库位")==null?null:readAll.get("制造库位").toString();
|
|
|
|
|
String code = readAll.get("品番") == null ? null : readAll.get("品番").toString();
|
|
|
|
|
String qty = readAll.get("数量") == null ? null : readAll.get("数量").toString();
|
|
|
|
|
String zzkw = readAll.get("制造库位") == null ? null : readAll.get("制造库位").toString();
|
|
|
|
|
if (code.length() > 0) {
|
|
|
|
|
Item item = itemRepository.findByCode(code);
|
|
|
|
|
if (item == null) {
|
|
|
|
|
return "部品品番无效";
|
|
|
|
|
}
|
|
|
|
|
Point point=pointService.getPoint(zzkw,null,null,null);
|
|
|
|
|
if(point==null){
|
|
|
|
|
Point point = pointService.getPoint(zzkw, null, null, null);
|
|
|
|
|
if (point == null) {
|
|
|
|
|
return "制造库位无效";
|
|
|
|
|
}
|
|
|
|
|
List<BomAccount> boms= bomAccountRepository.queryBomUnique(asn.getArea().getId(),item.getId(), point.getId());
|
|
|
|
|
if(boms.size()<=0){
|
|
|
|
|
List<BomAccount> boms = bomAccountRepository.queryBomUnique(asn.getArea().getId(), item.getId(), point.getId());
|
|
|
|
|
if (boms.size() <= 0) {
|
|
|
|
|
return "BOM工位清单不存在";
|
|
|
|
|
}
|
|
|
|
|
AsnDetail asnDetail=new AsnDetail();
|
|
|
|
|
AsnDetail asnDetail = new AsnDetail();
|
|
|
|
|
asnDetail.setAsn(asn);
|
|
|
|
|
asnDetail.setDept(UserUtils.getDept());
|
|
|
|
|
asnDetail.setStatus(BizStatus.OPEN);
|
|
|
|
|
@ -271,7 +346,7 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
asnDetail.setPoint(point);
|
|
|
|
|
asnDetail.setOrderQty(Double.parseDouble(qty));
|
|
|
|
|
asnDetailService.create(asnDetail);
|
|
|
|
|
asn.setOrderQuantity(asn.getOrderQuantity()+asnDetail.getOrderQty());
|
|
|
|
|
asn.setOrderQuantity(asn.getOrderQuantity() + asnDetail.getOrderQty());
|
|
|
|
|
asnService.update(asn);
|
|
|
|
|
}
|
|
|
|
|
return re;
|
|
|
|
|
@ -289,24 +364,24 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
if (item == null) {
|
|
|
|
|
return "部品品番无效";
|
|
|
|
|
}
|
|
|
|
|
Point point=pointService.getPoint(zzkw,null,null,null);
|
|
|
|
|
Long zzkwId=null;
|
|
|
|
|
if(point==null){
|
|
|
|
|
if(pickTicket.getArea().getBexb()) {
|
|
|
|
|
Point point = pointService.getPoint(zzkw, null, null, null);
|
|
|
|
|
Long zzkwId = null;
|
|
|
|
|
if (point == null) {
|
|
|
|
|
if (pickTicket.getArea().getBexb()) {
|
|
|
|
|
return "制造库位无效";
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
zzkwId=point.getId();
|
|
|
|
|
} else {
|
|
|
|
|
zzkwId = point.getId();
|
|
|
|
|
}
|
|
|
|
|
// List<BomAccount> boms= bomAccountRepository.queryBomUnique(pickTicket.getArea().getId(),item.getId(), point.getId());
|
|
|
|
|
// if(boms.size()<=0){
|
|
|
|
|
// return "BOM工位清单不存在";
|
|
|
|
|
// }
|
|
|
|
|
Double xbQty=inventoryService.getInvQty(item.getId(),pickTicket.getArea().getId(),zzkwId);
|
|
|
|
|
if(xbQty.intValue()<Double.parseDouble(qty)){
|
|
|
|
|
Double xbQty = inventoryService.getInvQty(item.getId(), pickTicket.getArea().getId(), zzkwId);
|
|
|
|
|
if (xbQty.intValue() < Double.parseDouble(qty)) {
|
|
|
|
|
return "库存不足";
|
|
|
|
|
}
|
|
|
|
|
PickDetail pickDetail=new PickDetail();
|
|
|
|
|
PickDetail pickDetail = new PickDetail();
|
|
|
|
|
pickDetail.setPickTicket(pickTicket);
|
|
|
|
|
pickDetail.setDept(UserUtils.getDept());
|
|
|
|
|
pickDetail.setStatus(BizStatus.OPEN);
|
|
|
|
|
@ -316,7 +391,7 @@ public class ImportDataServiceImpl implements ImportDataService {
|
|
|
|
|
pickDetail.setArea(pickTicket.getArea());
|
|
|
|
|
pickDetail.setOrderQty(Double.parseDouble(qty));
|
|
|
|
|
pickDetailService.create(pickDetail);
|
|
|
|
|
pickTicket.setOrderQuantity(pickTicket.getOrderQuantity()+pickDetail.getOrderQty());
|
|
|
|
|
pickTicket.setOrderQuantity(pickTicket.getOrderQuantity() + pickDetail.getOrderQty());
|
|
|
|
|
pickTicketService.update(pickTicket);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|