feat(采购到货拆批):1.修正[采购到货拆批]后台方法
This commit is contained in:
parent
007e18e6de
commit
6c4248f2c6
@ -70,54 +70,54 @@ public class DocumentController {
|
||||
@ApiOperation(value = "采购到货提交", notes = "采购到货提交")
|
||||
@SysLog("采购入库提交")
|
||||
@PostMapping("/procurementStorageSubmit")
|
||||
@PreAuthorize("@pms.hasPermission('wms_document_return')")
|
||||
// @PreAuthorize("@pms.hasPermission('wms_document_return')")
|
||||
public R procurementStorageSubmit(@RequestBody List<DocumentDetailedDto> documentDetailedList) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
Map<String, Set<String>> printMap = documentService.procurementStorageSubmit(documentDetailedList);
|
||||
//打印
|
||||
String printerX = documentDetailedList.get(0).getPrinterX();
|
||||
String printerD = documentDetailedList.get(0).getPrinterD();
|
||||
if (!printMap.isEmpty()) {
|
||||
boolean printXerror = false, printDerror = false, btsError = false;
|
||||
String printXerrorMsg = null, printDerrorMsg = null, btsErrorMsg = null;
|
||||
try {
|
||||
if (StrUtil.isBlank(printerX)) {
|
||||
throw BusinessException.build("小条码打印机未维护");
|
||||
} else {
|
||||
Set<String> printList = printMap.get("X");
|
||||
if (CollectionUtil.isNotEmpty(printList)) {
|
||||
wmsCarrierService.labelRePrint(site, printList.stream().map(o -> {
|
||||
Carrier carrier = new Carrier();
|
||||
carrier.setCarrier(o);
|
||||
return carrier;
|
||||
}).collect(Collectors.toList()), printerX);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
printXerror = true;
|
||||
printXerrorMsg = "小条码打印异常:" + e.getMessage();
|
||||
}
|
||||
try {
|
||||
if (StrUtil.isBlank(printerD)) {
|
||||
throw BusinessException.build("大条码打印机未维护");
|
||||
} else {
|
||||
Set<String> printList = printMap.get("D");
|
||||
if (CollectionUtil.isNotEmpty(printList)) {
|
||||
barCodeQueryService.batchPrint(printList, printerD);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
printDerror = true;
|
||||
printDerrorMsg = "大条码打印异常:" + e.getMessage();
|
||||
}
|
||||
if (printXerror || printDerror) {
|
||||
throw BusinessException.build(StrUtil.blankToDefault(printXerrorMsg, "")
|
||||
.concat((printXerror && printDerror) ? "\n" : "")
|
||||
.concat(StrUtil.blankToDefault(printDerrorMsg, ""))
|
||||
.concat((printXerror && printDerror && btsError) ? "\n" : "")
|
||||
.concat(StrUtil.blankToDefault(btsErrorMsg, "")));
|
||||
}
|
||||
}
|
||||
// String printerX = documentDetailedList.get(0).getPrinterX();
|
||||
// String printerD = documentDetailedList.get(0).getPrinterD();
|
||||
// if (!printMap.isEmpty()) {
|
||||
// boolean printXerror = false, printDerror = false, btsError = false;
|
||||
// String printXerrorMsg = null, printDerrorMsg = null, btsErrorMsg = null;
|
||||
// try {
|
||||
// if (StrUtil.isBlank(printerX)) {
|
||||
// throw BusinessException.build("小条码打印机未维护");
|
||||
// } else {
|
||||
// Set<String> printList = printMap.get("X");
|
||||
// if (CollectionUtil.isNotEmpty(printList)) {
|
||||
// wmsCarrierService.labelRePrint(site, printList.stream().map(o -> {
|
||||
// Carrier carrier = new Carrier();
|
||||
// carrier.setCarrier(o);
|
||||
// return carrier;
|
||||
// }).collect(Collectors.toList()), printerX);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// printXerror = true;
|
||||
// printXerrorMsg = "小条码打印异常:" + e.getMessage();
|
||||
// }
|
||||
// try {
|
||||
// if (StrUtil.isBlank(printerD)) {
|
||||
// throw BusinessException.build("大条码打印机未维护");
|
||||
// } else {
|
||||
// Set<String> printList = printMap.get("D");
|
||||
// if (CollectionUtil.isNotEmpty(printList)) {
|
||||
// barCodeQueryService.batchPrint(printList, printerD);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// printDerror = true;
|
||||
// printDerrorMsg = "大条码打印异常:" + e.getMessage();
|
||||
// }
|
||||
// if (printXerror || printDerror) {
|
||||
// throw BusinessException.build(StrUtil.blankToDefault(printXerrorMsg, "")
|
||||
// .concat((printXerror && printDerror) ? "\n" : "")
|
||||
// .concat(StrUtil.blankToDefault(printDerrorMsg, ""))
|
||||
// .concat((printXerror && printDerror && btsError) ? "\n" : "")
|
||||
// .concat(StrUtil.blankToDefault(btsErrorMsg, "")));
|
||||
// }
|
||||
// }
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -340,11 +340,11 @@ public class DocumentController {
|
||||
* @param documentNo id
|
||||
* @return R
|
||||
*/
|
||||
/*@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@GetMapping("/{documentNo}")
|
||||
public R getById(@PathVariable("documentNo") String documentNo) {
|
||||
return R.ok(documentService.getDocumentDetail(documentNo));
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过库存或载具查询数量
|
||||
|
||||
@ -17,17 +17,17 @@ import java.util.Set;
|
||||
|
||||
public interface DocumentService extends IService<Document> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param frontPage
|
||||
* @return
|
||||
*/
|
||||
IPage<Document> selectPage(Page<Document> frontPage, Document document);
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param frontPage
|
||||
* @return
|
||||
*/
|
||||
IPage<Document> selectPage(Page<Document> frontPage, Document document);
|
||||
|
||||
List<Document> selectList(Document document);
|
||||
|
||||
IPage<Document> getDocumentList(IPage iPage, String site, String status, String documentType, String searchText);
|
||||
IPage<Document> getDocumentList(IPage iPage, String site, String status, String documentType, String searchText);
|
||||
|
||||
List<Map<String, Object>> getWarehouse(String site);
|
||||
|
||||
@ -59,7 +59,7 @@ public interface DocumentService extends IService<Document> {
|
||||
*/
|
||||
boolean checkReject(List<String> list);
|
||||
|
||||
//List<DocumentDetailed> getDocumentDetail(String documentNo);
|
||||
List<DocumentDetailed> getDocumentDetail(String documentNo);
|
||||
|
||||
/**
|
||||
* 扫描条码查询库存
|
||||
|
||||
@ -13,8 +13,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.common.utils.HandleBoProcessor;
|
||||
import com.foreverwin.iep.prd.domain.GenerateNextNumberRequest;
|
||||
import com.foreverwin.iep.prd.domain.GenerateNextNumberResponse;
|
||||
import com.foreverwin.iep.prd.domain.QmsQcPlanTarget;
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
import com.foreverwin.iep.prd.entity.SupplierBasis;
|
||||
import com.foreverwin.iep.prd.feign.RemoteNextNumberService;
|
||||
import com.foreverwin.iep.qms.domain.CreateAndCollectInspectDataSourceResponse;
|
||||
import com.foreverwin.iep.qms.domain.InspecJobExtend;
|
||||
import com.foreverwin.iep.qms.feign.RemoteQmsInspecJobService;
|
||||
import com.foreverwin.iep.sys.constant.HandleEnum;
|
||||
import com.foreverwin.iep.sys.entity.FastCodeDetail;
|
||||
import com.foreverwin.iep.sys.service.FastCodeService;
|
||||
@ -111,6 +116,11 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
private final FastCodeService fastCodeService;
|
||||
private final RemoteNextNumberService remoteNextNumberService;
|
||||
private final RemoteTenantService remoteTenantService;
|
||||
private final RemoteQmsInspecJobService remoteQmsInspecJobService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public IPage<Document> selectPage(Page<Document> frontPage, Document document) {
|
||||
@ -126,7 +136,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
return super.list(queryWrapper);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
@Override
|
||||
public List<DocumentDetailed> getDocumentDetail(String documentNo) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String documentBo = Document.genHandle(site, documentNo);
|
||||
@ -140,7 +150,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
}
|
||||
List<DocumentDetailed> list = documentDetailedMapper.getDetailedList(documentBo);
|
||||
return list;
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ -2009,7 +2019,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
String user = SecurityUtils.getUserName();
|
||||
String documentNo = itemList.get(0).getDocumentNo();
|
||||
String documentBo = Document.genHandle(site, documentNo);
|
||||
String freezeLocation = itemList.get(0).getFreezeLocation();
|
||||
// String freezeLocation = itemList.get(0).getFreezeLocation();
|
||||
Set<String> printListX = new HashSet<>();
|
||||
Set<String> printListD = new TreeSet<>();
|
||||
Set<String> sfcSet = new HashSet<>();
|
||||
@ -2017,313 +2027,111 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
if (!Constant.DOCUMENT_STATUS_SUBMIT.equals(byCode.getState())) {
|
||||
throw BusinessException.build("单据状态不可提交");
|
||||
} else {
|
||||
String documentType = byCode.getDocumentType();
|
||||
// String documentType = byCode.getDocumentType();
|
||||
String poNumber = byCode.getExternalDocumentNo();
|
||||
// Map<String, ErpMm006ItemRequestBodyDTO> interfaceMap = Constant.DOCUMENT_HIGH_VALUE.equals(documentType) ? new HashMap<>() : null;
|
||||
// for (DocumentDetailedDto detailedDto : itemList) {
|
||||
// BigDecimal requestQty = BigDecimal.ZERO;
|
||||
// String seq = detailedDto.getSeq();
|
||||
// String receiveStorageLocation = detailedDto.getTargetWarehouse();
|
||||
// String item = detailedDto.getItem();
|
||||
//
|
||||
// Item selectCurrent = itemService.selectCurrent(site, item);
|
||||
// String customItemType = customFieldsService.getCustomFieldsValue(selectCurrent.getHandle(), "CUSTOM_ITEM_TYPE");
|
||||
// if (StringUtil.isEmpty(customItemType)) {
|
||||
// throw BusinessException.build("物料自定义物料类型未维护");
|
||||
// } else {
|
||||
// //校验行项目状态
|
||||
// List<DocumentInventoryDto> inventoryList = detailedDto.getInventoryList();
|
||||
// if (inventoryList.isEmpty()) {
|
||||
// throw BusinessException.build("行项目" + seq + "库存列表不能为空");
|
||||
// } else if (StringUtil.isEmpty(receiveStorageLocation)) {
|
||||
// throw BusinessException.build("行项目" + seq + "目标不能为空");
|
||||
// } else {
|
||||
// DocumentDetailed itemSelect = documentDetailedService.getOne(Wrappers.lambdaQuery(DocumentDetailed.class)
|
||||
// .eq(DocumentDetailed::getSeq, seq)
|
||||
// .eq(DocumentDetailed::getDocumentNo, documentNo)
|
||||
// .eq(DocumentDetailed::getSite, site));
|
||||
// String itemSelectStatus = itemSelect.getState();
|
||||
// BigDecimal applicationsQuantity = itemSelect.getApplicationsQuantity();
|
||||
// String targetWarehouse = itemSelect.getTargetWarehouse();
|
||||
// if (itemSelectStatus.equals("CLOSE")) {
|
||||
// throw BusinessException.build("单据已完成");
|
||||
// } else {
|
||||
// if (MaterialTypeEnum.KMAT.getCode().equals(customItemType) || MaterialTypeEnum.FERT.getCode().equals(customItemType)) {
|
||||
// //采购批次库存扣减
|
||||
// procurementStorageCancel(detailedDto, user);
|
||||
// }
|
||||
// String group = null, groupNo = null;
|
||||
// for (DocumentInventoryDto inventoryDto : inventoryList) {
|
||||
// BigDecimal inventoryQty = inventoryDto.getInventoryQty();
|
||||
// String inventoryStorageLocation = inventoryDto.getStorageLocation();
|
||||
// String inventoryIdOrCarrier = inventoryDto.getInventoryIdOrCarrier();
|
||||
// //3位小数
|
||||
// boolean matches = inventoryQty.toString().matches("[+]?[0-9]+(\\.[0-9]{1,3})?");
|
||||
// if (!matches) {
|
||||
// throw BusinessException.build("数量" + inventoryQty.toString() + "不合法");
|
||||
// } else {
|
||||
// if (MaterialTypeEnum.KMAT.getCode().equals(customItemType)) {
|
||||
// String storageLocation = detailedDto.getStorageLocation();
|
||||
// StorageLocation byId = storageLocationService.getById(StorageLocation.genHandle(site, storageLocation));
|
||||
// if (byId == null) {
|
||||
// throw BusinessException.build("存储位置不存在");
|
||||
// } else if (!byId.getErpStorageLocation().equals(targetWarehouse)) {
|
||||
// throw BusinessException.build("存储位置与目标仓库不一致");
|
||||
// } else {
|
||||
// StorageBin storageBin = storageLocationService.getStorageBin(site, storageLocation);
|
||||
// //五金备件
|
||||
// requestQty = requestQty.add(inventoryQty);
|
||||
// if (requestQty.compareTo(applicationsQuantity) != 0) {
|
||||
// throw BusinessException.build("行项目" + seq + "五金备件不允许拆批");
|
||||
// } else {
|
||||
// String inventoryId = item + storageLocation;
|
||||
// String parentInventoryId = documentNo + detailedDto.getSeq() + item;
|
||||
// Inventory parentInventory = Optional.ofNullable(inventoryService.getByCode(site, parentInventoryId))
|
||||
// .orElseThrow(() -> BusinessException.build("未找到父库存" + parentInventoryId));
|
||||
// String parentInventoryStatus = parentInventory.getStatus();
|
||||
// if (StringUtil.isEmpty(freezeLocation)) {
|
||||
// if (!parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1001)) {
|
||||
// throw BusinessException.build("库存未检验合格");
|
||||
// }
|
||||
// } else {
|
||||
// List<String> freezeLocationList = Arrays.asList(freezeLocation.split(","));
|
||||
// if (freezeLocationList.contains(storageLocation) && !parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1005)) {
|
||||
// throw BusinessException.build("非冻结库存不能选择冻结区");
|
||||
// } else if (!freezeLocationList.contains(storageLocation) && parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1005)) {
|
||||
// throw BusinessException.build("冻结库存应选择冻结区");
|
||||
// } else if (parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1004)) {
|
||||
// throw BusinessException.build("库存未检验");
|
||||
// }
|
||||
// }
|
||||
// Inventory inventoryByCode = inventoryService.getByCode(site, inventoryId);
|
||||
// if (inventoryByCode == null) {
|
||||
// //新建库存
|
||||
// inventoryService.createInventory(site, user, inventoryId, item, Constant.INVENTORY_STSTUS_1001, inventoryQty,
|
||||
// null, null, null, null, null, null, null, null, null, null);
|
||||
// storageBinBindInventoryService.inventoryBind(user, storageBin.getStorageBin(), inventoryId);
|
||||
// //记日志
|
||||
// inventoryLogService.saveLog(user, inventoryId, documentNo, null, byCode.getDocumentType(),
|
||||
// null, null, storageBin.getHandle());
|
||||
// } else {
|
||||
// inventoryService.updateQty(user, inventoryId, inventoryByCode.getQtyOnHand().add(inventoryQty));
|
||||
// if (BigDecimal.ZERO.compareTo(inventoryByCode.getQtyOnHand()) == 0) {
|
||||
// storageBinBindInventoryService.inventoryBind(user, storageBin.getStorageBin(), inventoryId);
|
||||
// }
|
||||
// //记日志
|
||||
// inventoryLogService.saveLog(user, inventoryId, documentNo, inventoryByCode.getStatus(), byCode.getDocumentType(),
|
||||
// storageBin.getHandle(), inventoryByCode.getQtyOnHand(), storageBin.getHandle());
|
||||
// }
|
||||
// DocumentSfc documentSfc = new DocumentSfc();
|
||||
// documentSfc.setSite(site);
|
||||
// documentSfc.setDocumentNo(documentNo);
|
||||
// documentSfc.setSeq(seq);
|
||||
// documentSfc.setItem(item);
|
||||
// documentSfc.setInventoryIdOrCarrier(inventoryId);
|
||||
// documentSfc.setSfc(inventoryId);
|
||||
// documentSfc.setTargetBin(storageBin.getStorageBin());
|
||||
// documentSfc.setTargetLocation(storageLocation);
|
||||
// documentSfc.setTargetWarehouse(itemSelect.getTargetWarehouse());
|
||||
// documentSfc.setQty(requestQty);
|
||||
// documentSfc.setDocumentType(byCode.getDocumentType());
|
||||
// documentSfc.setCreateDateTime(LocalDateTime.now());
|
||||
// documentSfc.setCreateUser(user);
|
||||
// documentSfcService.save(documentSfc);
|
||||
// sfcSet.add(inventoryId);
|
||||
// }
|
||||
// }
|
||||
// } else if (MaterialTypeEnum.ROH.getCode().equals(customItemType) || MaterialTypeEnum.VERP.getCode().equals(customItemType)) {
|
||||
// //原材
|
||||
// StorageLocation byId = storageLocationService.getById(StorageLocation.genHandle(site, inventoryStorageLocation));
|
||||
// if (byId == null) {
|
||||
// throw BusinessException.build("存储位置不存在");
|
||||
// } else if (!byId.getErpStorageLocation().equals(targetWarehouse)) {
|
||||
// throw BusinessException.build("存储位置与目标仓库不一致");
|
||||
// } else {
|
||||
// StorageBin storageBin = storageLocationService.getStorageBin(site, inventoryStorageLocation);
|
||||
// //库存拆分
|
||||
// String parentInventoryId = documentNo + detailedDto.getSeq() + item;
|
||||
// Inventory parentInventory = Optional.ofNullable(inventoryService.getByCode(site, parentInventoryId))
|
||||
// .orElseThrow(() -> BusinessException.build("未找到父库存" + parentInventoryId));
|
||||
// String parentInventoryStatus = parentInventory.getStatus();
|
||||
// if (StringUtil.isEmpty(freezeLocation)) {
|
||||
// if (!parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1001)) {
|
||||
// throw BusinessException.build("库存未检验合格");
|
||||
// }
|
||||
// } else {
|
||||
// List<String> freezeLocationList = Arrays.asList(freezeLocation.split(","));
|
||||
// if (freezeLocationList.contains(inventoryStorageLocation) && !parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1005)) {
|
||||
// throw BusinessException.build("非冻结库存不能选择冻结区");
|
||||
// } else if (!freezeLocationList.contains(inventoryStorageLocation) && parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1005)) {
|
||||
// throw BusinessException.build("冻结库存应选择冻结区");
|
||||
// } else if (parentInventoryStatus.equals(Constant.INVENTORY_STSTUS_1004)) {
|
||||
// throw BusinessException.build("库存未检验");
|
||||
// }
|
||||
// }
|
||||
// //库存拆分
|
||||
// String inventoryId = inventoryService.splitInventory(site, user, parentInventoryId, inventoryQty, 1, documentNo, byCode.getDocumentType(), storageBin.getHandle()).get(0);
|
||||
// if (StrUtil.isNotBlank(inventoryDto.getGroup())) {
|
||||
// if (!inventoryDto.getGroup().equals(group)) {
|
||||
// group = inventoryDto.getGroup();
|
||||
// groupNo = carrierService.createCarrierWithMes("GROUP", "GROUP", "Y", 1).get(0);
|
||||
// }
|
||||
// InventoryGroup inventoryGroup = new InventoryGroup();
|
||||
// inventoryGroup.setHandle(UUID.randomUUID().toString());
|
||||
// inventoryGroup.setSite(site);
|
||||
// inventoryGroup.setInventoryBo(Inventory.genHandle(site, inventoryId));
|
||||
// inventoryGroup.setCarrierBo(Carrier.genHandle(site, groupNo));
|
||||
// inventoryGroup.setCreateTime(LocalDateTime.now());
|
||||
// inventoryGroup.setCreator(user);
|
||||
// inventoryGroupService.save(inventoryGroup);
|
||||
// inventoryGroupLogService.saveLogs(user, Collections.singletonList(inventoryGroup), true);
|
||||
// printListX.add(groupNo);
|
||||
// }
|
||||
// printListD.add(inventoryId);
|
||||
// requestQty = requestQty.add(inventoryQty);
|
||||
// DocumentSfc documentSfc = new DocumentSfc();
|
||||
// documentSfc.setSite(site);
|
||||
// documentSfc.setDocumentNo(documentNo);
|
||||
// documentSfc.setSeq(seq);
|
||||
// documentSfc.setItem(item);
|
||||
// documentSfc.setBatchNumber(parentInventory.getBatchNo());
|
||||
// documentSfc.setVendorBatch(parentInventory.getVendorBatchNo());
|
||||
// documentSfc.setInventoryIdOrCarrier(inventoryId);
|
||||
// documentSfc.setSfc(inventoryId);
|
||||
// documentSfc.setTargetBin(storageBin.getStorageBin());
|
||||
// documentSfc.setTargetLocation(inventoryStorageLocation);
|
||||
// documentSfc.setTargetWarehouse(itemSelect.getTargetWarehouse());
|
||||
// documentSfc.setQty(inventoryQty);
|
||||
// documentSfc.setDocumentType(byCode.getDocumentType());
|
||||
// documentSfc.setCreateDateTime(LocalDateTime.now());
|
||||
// documentSfc.setCreateUser(user);
|
||||
// documentSfc.setGradeThrCarrier(groupNo);
|
||||
// documentSfcService.save(documentSfc);
|
||||
// sfcSet.add(inventoryId);
|
||||
// if (interfaceMap != null) {
|
||||
// String unitOfMeasure = parentInventory.getUnitOfMeasure();
|
||||
// String batch = parentInventory.getBatchNo();
|
||||
// ErpMm006ItemRequestBodyDTO mm006RequestDetail = interfaceMap.computeIfAbsent(seq.concat("$").concat(item).concat("$").concat(Optional.ofNullable(batch).orElse(""))
|
||||
// , t -> generateCallMM001Request(documentType, site, seq, item, BigDecimal.ZERO, unitOfMeasure, itemSelect.getSourceWarehouse(), itemSelect.getTargetWarehouse(), batch, null, null, false, null));
|
||||
// mm006RequestDetail.setErfmg(mm006RequestDetail.getErfmg().add(inventoryQty));
|
||||
// }
|
||||
// }
|
||||
// } else if (MaterialTypeEnum.FERT.getCode().equals(customItemType)) {
|
||||
// StorageLocation byId = storageLocationService.getDefaultLocation(site, targetWarehouse);
|
||||
// String storageLocation = byId.getStorageLocation();
|
||||
// StorageBin storageBin = storageLocationService.getStorageBin(site, storageLocation);
|
||||
// List<DocumentAdvanceBind> documentAdvanceBindList = documentAdvanceBindService.list(Wrappers.lambdaQuery(DocumentAdvanceBind.class)
|
||||
// .eq(DocumentAdvanceBind::getSite, site)
|
||||
// .eq(DocumentAdvanceBind::getDocumentNo, documentNo)
|
||||
// .eq(DocumentAdvanceBind::getTray, inventoryIdOrCarrier));
|
||||
// if (documentAdvanceBindList.isEmpty()) {
|
||||
// throw BusinessException.build("条码" + inventoryIdOrCarrier + "绑定信息不存在,请核查");
|
||||
// } else {
|
||||
// Map<String, List<String>> boxInvMap = new HashMap<>();
|
||||
// Map<String, Set<String>> trayBoxMap = new HashMap<>();
|
||||
// for (DocumentAdvanceBind documentAdvanceBind : documentAdvanceBindList) {
|
||||
// String inventoryId = documentAdvanceBind.getInventoryId();
|
||||
// String box = documentAdvanceBind.getBox();
|
||||
// String tray = documentAdvanceBind.getTray();
|
||||
// BigDecimal qty = documentAdvanceBind.getQty();
|
||||
// Inventory inventoryGetById = inventoryService.getById(Inventory.genHandle(site, inventoryId));
|
||||
// if (inventoryGetById == null) {
|
||||
// inventoryGetById = inventoryService.buildInventory(site, user, inventoryId, documentAdvanceBind.getItem(), Constant.INVENTORY_STSTUS_1001, qty, documentAdvanceBind.getBatch()
|
||||
// , documentAdvanceBind.getVendorBatch(), documentAdvanceBind.getProductionDate(), null, documentAdvanceBind.getGroes(), documentAdvanceBind.getQualityInspectionStatus()
|
||||
// , documentAdvanceBind.getCurrentLength(), documentAdvanceBind.getWidth(), documentAdvanceBind.getBismt(), null, null, documentAdvanceBind.getUpgradeFlag(), documentAdvanceBind.getStandardLength(), documentAdvanceBind.getProductionBase()
|
||||
// , null, documentAdvanceBind.getQmsSpecialMarking(), null);
|
||||
// inventoryGetById.setNote("采购到货");
|
||||
// inventoryService.save(inventoryGetById);
|
||||
// inventoryLogService.saveLog(user, inventoryId, documentNo, null, byCode.getDocumentType(),
|
||||
// null, BigDecimal.ZERO, storageBin.getHandle());
|
||||
// } else {
|
||||
// String preStatus = inventoryGetById.getStatus();
|
||||
// BigDecimal preQtyOnHand = inventoryGetById.getQtyOnHand();
|
||||
// inventoryGetById.setStatus(Constant.INVENTORY_STSTUS_1001);
|
||||
// inventoryGetById.setQtyOnHand(qty);
|
||||
// inventoryGetById.setUnitOfMeasure(documentAdvanceBind.getUnit());
|
||||
// inventoryGetById.setBatchNo(documentAdvanceBind.getBatch());
|
||||
// inventoryGetById.setVendorBatchNo(documentAdvanceBind.getVendorBatch());
|
||||
// inventoryGetById.setGroes(documentAdvanceBind.getGroes());
|
||||
// inventoryGetById.setProductionDate(documentAdvanceBind.getProductionDate());
|
||||
// inventoryGetById.setQualityInspectionStatus(documentAdvanceBind.getQualityInspectionStatus());
|
||||
// inventoryGetById.setUpgradeFlag(documentAdvanceBind.getUpgradeFlag());
|
||||
// inventoryGetById.setStandardLength(documentAdvanceBind.getStandardLength());
|
||||
// inventoryGetById.setLength(documentAdvanceBind.getCurrentLength());
|
||||
// inventoryGetById.setWidth(documentAdvanceBind.getWidth());
|
||||
// inventoryGetById.setBismt(documentAdvanceBind.getBismt());
|
||||
// inventoryGetById.setProductionBase(documentAdvanceBind.getProductionBase());
|
||||
// inventoryGetById.setQmsSpecialMarking(documentAdvanceBind.getQmsSpecialMarking());
|
||||
// inventoryGetById.setUpdater(user);
|
||||
// inventoryGetById.setUpdateTime(LocalDateTime.now());
|
||||
// inventoryGetById.setErpStorageLocation(byId.getErpStorageLocation());
|
||||
// inventoryGetById.setNote("采购到货");
|
||||
// inventoryService.updateById(inventoryGetById);
|
||||
// inventoryLogService.saveLog(user, inventoryId, documentNo, preStatus, byCode.getDocumentType(),
|
||||
// null, preQtyOnHand, storageBin.getHandle());
|
||||
// }
|
||||
// DocumentSfc documentSfc = new DocumentSfc();
|
||||
// documentSfc.setSite(site);
|
||||
// documentSfc.setDocumentNo(documentNo);
|
||||
// documentSfc.setSeq(seq);
|
||||
// documentSfc.setItem(item);
|
||||
// documentSfc.setTargetWarehouse(itemSelect.getTargetWarehouse());
|
||||
// documentSfc.setSourceWarehouse(itemSelect.getSourceWarehouse());
|
||||
// documentSfc.setBatchNumber(inventoryGetById.getBatchNo());
|
||||
// documentSfc.setVendorBatch(inventoryGetById.getVendorBatchNo());
|
||||
// documentSfc.setTargetBin(storageBin.getStorageBin());
|
||||
// documentSfc.setTargetLocation(storageLocation);
|
||||
// documentSfc.setInventoryIdOrCarrier(inventoryIdOrCarrier);
|
||||
// documentSfc.setSfc(inventoryId);
|
||||
// documentSfc.setQty(qty);
|
||||
// documentSfc.setDocumentType(byCode.getDocumentType());
|
||||
// documentSfc.setCreateDateTime(LocalDateTime.now());
|
||||
// documentSfc.setCreateUser(user);
|
||||
// documentSfc.setGradeOneCarrier(tray);
|
||||
// documentSfc.setGradeTwoCarrier(box);
|
||||
// documentSfc.setQualityInspectionStatus(documentAdvanceBind.getQualityInspectionStatus());
|
||||
// documentSfcService.save(documentSfc);
|
||||
// sfcSet.add(inventoryId);
|
||||
// requestQty = requestQty.add(qty);
|
||||
// //箱-卷
|
||||
// boxInvMap.computeIfAbsent(box, t -> new ArrayList<>()).add(inventoryId);
|
||||
// //托-箱
|
||||
// trayBoxMap.computeIfAbsent(tray, t -> new HashSet<>()).add(box);
|
||||
// }
|
||||
// boxInvMap.forEach((key, value) -> carrierMemberService.bindBatch(key, value, "Y"));
|
||||
// trayBoxMap.forEach((key, value) -> carrierMemberService.bindBatch(key, value, "Y"));
|
||||
// storageBinBindInventoryService.carrierBind(storageBin.getStorageBin(), inventoryIdOrCarrier);
|
||||
// }
|
||||
// } else {
|
||||
// throw BusinessException.build("不支持的物料类型" + customItemType);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
for (DocumentDetailedDto detailedDto : itemList) {
|
||||
BigDecimal requestQty = BigDecimal.ZERO;
|
||||
Integer seq = detailedDto.getSeq();
|
||||
String receiveStorageLocation = detailedDto.getTargetWarehouse();
|
||||
String item = detailedDto.getItem();
|
||||
|
||||
//校验行项目状态
|
||||
List<DocumentInventoryDto> inventoryList = detailedDto.getInventoryList();
|
||||
if (inventoryList.isEmpty()) {
|
||||
throw BusinessException.build("行项目" + seq + "库存列表不能为空");
|
||||
} else if (StringUtil.isEmpty(receiveStorageLocation)) {
|
||||
throw BusinessException.build("行项目" + seq + "目标不能为空");
|
||||
} else {
|
||||
DocumentDetailed itemSelect = documentDetailedService.getOne(Wrappers.lambdaQuery(DocumentDetailed.class)
|
||||
.eq(DocumentDetailed::getSeq, seq)
|
||||
.eq(DocumentDetailed::getDocumentNo, documentNo)
|
||||
.eq(DocumentDetailed::getSite, site));
|
||||
String itemSelectStatus = itemSelect.getState();
|
||||
BigDecimal applicationsQuantity = itemSelect.getApplicationsQuantity();
|
||||
String targetWarehouse = itemSelect.getTargetWarehouse();
|
||||
if (itemSelectStatus.equals("CLOSE")) {
|
||||
throw BusinessException.build("单据已完成");
|
||||
} else {
|
||||
for (DocumentInventoryDto inventoryDto : inventoryList) {
|
||||
BigDecimal inventoryQty = inventoryDto.getInventoryQty();
|
||||
String inventoryStorageLocation = inventoryDto.getStorageLocation();
|
||||
//3位小数
|
||||
boolean matches = inventoryQty.toString().matches("[+]?[0-9]+(\\.[0-9]{1,3})?");
|
||||
if (!matches) {
|
||||
throw BusinessException.build("数量" + inventoryQty.toString() + "不合法");
|
||||
} else {
|
||||
//库存拆分
|
||||
String parentInventoryId = documentNo +"-" + detailedDto.getSeq() + "-" + item;
|
||||
Inventory parentInventory = Optional.ofNullable(inventoryService.getByCode(site, parentInventoryId))
|
||||
.orElseThrow(() -> BusinessException.build("未找到父库存" + parentInventoryId));
|
||||
// String parentInventoryStatus = parentInventory.getStatus();
|
||||
|
||||
//库存拆分
|
||||
String inventoryId = inventoryService.splitInventory(site, user, parentInventoryId, inventoryQty, 1, documentNo, byCode.getDocumentType(),null).get(0);
|
||||
|
||||
printListD.add(inventoryId);
|
||||
requestQty = requestQty.add(inventoryQty);
|
||||
DocumentSfc documentSfc = new DocumentSfc();
|
||||
documentSfc.setSite(site);
|
||||
documentSfc.setDocumentNo(documentNo);
|
||||
documentSfc.setSeq(seq);
|
||||
documentSfc.setItem(item);
|
||||
documentSfc.setBatchNumber(parentInventory.getBatchNo());
|
||||
documentSfc.setVendorBatch(parentInventory.getVendorBatchNo());
|
||||
documentSfc.setInventoryIdOrCarrier(inventoryId);
|
||||
documentSfc.setSfc(inventoryId);
|
||||
// documentSfc.setTargetBin(storageBin.getStorageBin());
|
||||
documentSfc.setTargetLocation(inventoryStorageLocation);
|
||||
documentSfc.setTargetWarehouse(itemSelect.getTargetWarehouse());
|
||||
documentSfc.setQty(inventoryQty);
|
||||
documentSfc.setDocumentType(byCode.getDocumentType());
|
||||
documentSfc.setCreateDateTime(LocalDateTime.now());
|
||||
documentSfc.setCreateUser(user);
|
||||
// documentSfc.setGradeThrCarrier(groupNo);
|
||||
documentSfcService.save(documentSfc);
|
||||
sfcSet.add(inventoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (requestQty.compareTo(applicationsQuantity) != 0) {
|
||||
throw BusinessException.build("行项目" + seq + "入库数量与申请数量不相同");
|
||||
} else {
|
||||
String poSeq = String.valueOf(seq / 10 * 10);
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
// 根据站点+物料号查询 ERP_ITEM
|
||||
Item itemEntity = selectCurrentItem(site, item);
|
||||
if (itemEntity == null) {
|
||||
throw BusinessException.build("物料" + item + "不存在");
|
||||
}
|
||||
String matnr = itemEntity.getErpItem();
|
||||
|
||||
String poOrderDetailHandle = PoOrderDetail.genHandle(PoOrder.genHandle(site, poNumber), matnr, poSeq);
|
||||
PoOrderDetail poOrderDetail = poOrderDetailService.getOne(Wrappers.lambdaQuery(PoOrderDetail.class).eq(PoOrderDetail::getHandle, poOrderDetailHandle)
|
||||
.select(PoOrderDetail::getHandle, PoOrderDetail::getCompletedQty));
|
||||
if (poOrderDetail != null) {
|
||||
poOrderDetailService.update(Wrappers.lambdaUpdate(PoOrderDetail.class)
|
||||
.eq(PoOrderDetail::getHandle, poOrderDetail.getHandle())
|
||||
.set(PoOrderDetail::getCompletedQty, Optional.ofNullable(poOrderDetail.getCompletedQty()).orElse(BigDecimal.ZERO).add(requestQty))
|
||||
.set(PoOrderDetail::getUpdateDate, LocalDateTime.now())
|
||||
.set(PoOrderDetail::getUpdateUser, user));
|
||||
}
|
||||
// else if (!Constant.DOCUMENT_HIGH_VALUE.equals(documentType)) {
|
||||
// throw BusinessException.build("未找到对应的PO单行项目");
|
||||
// }
|
||||
// if (requestQty.compareTo(applicationsQuantity) != 0) {
|
||||
// throw BusinessException.build("行项目" + seq + "入库数量与申请数量不相同");
|
||||
// } else {
|
||||
// String poSeq = String.valueOf(Integer.parseInt(seq) / 10 * 10);
|
||||
// //----------------------------------------------------------------------------------------------------
|
||||
// PoOrderDetail poOrderDetail = poOrderDetailService.getOne(Wrappers.lambdaQuery(PoOrderDetail.class).eq(PoOrderDetail::getHandle, com.foreverwin.mom.wms.enums.HandleEnum.WMS_PO_ORDER_DETAIL.getHandle(site, poNumber, poSeq))
|
||||
// .select(PoOrderDetail::getHandle, PoOrderDetail::getCompletedQty));
|
||||
// if (poOrderDetail != null) {
|
||||
// poOrderDetailService.update(Wrappers.lambdaUpdate(PoOrderDetail.class)
|
||||
// .eq(PoOrderDetail::getHandle, poOrderDetail.getHandle())
|
||||
// .set(PoOrderDetail::getCompletedQty, Optional.ofNullable(poOrderDetail.getCompletedQty()).orElse(BigDecimal.ZERO).add(requestQty))
|
||||
// .set(PoOrderDetail::getUpdateDateTime, LocalDateTime.now())
|
||||
// .set(PoOrderDetail::getUpdateUser, user));
|
||||
// } else if (!Constant.DOCUMENT_HIGH_VALUE.equals(documentType)) {
|
||||
// throw BusinessException.build("未找到对应的PO单行项目");
|
||||
// }
|
||||
// //更新行项目状态
|
||||
// itemSelect.setActualQuantity(applicationsQuantity);
|
||||
// itemSelect.setModifyDateTime(LocalDateTime.now());
|
||||
// itemSelect.setModifyUser(user);
|
||||
// itemSelect.setState(Constant.DOCUMENT_STATUS_CLOSE);
|
||||
// documentDetailedService.updateById(itemSelect);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//更新行项目状态
|
||||
itemSelect.setActualQuantity(applicationsQuantity);
|
||||
itemSelect.setUpdateDate(LocalDateTime.now());
|
||||
itemSelect.setUpdateUser(user);
|
||||
itemSelect.setState(Constant.DOCUMENT_STATUS_CLOSE);
|
||||
documentDetailedService.updateById(itemSelect);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
long count = documentDetailedService.count(Wrappers.lambdaQuery(DocumentDetailed.class)
|
||||
.eq(DocumentDetailed::getDocumentBo, documentBo)
|
||||
.eq(DocumentDetailed::getState, Constant.DOCUMENT_STATUS_SUBMIT));
|
||||
@ -2339,27 +2147,143 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
printMap.put("D", printListD);
|
||||
printMap.put("S", sfcSet);
|
||||
|
||||
// if (Constant.DOCUMENT_HIGH_VALUE.equals(documentType) && StrUtil.isNotBlank(byCode.getExternalDocumentNo())) {
|
||||
// StringWithMapDTO stringWithMapDTO = new StringWithMapDTO<String, Object>();
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("documentNo", documentNo);
|
||||
// stringWithMapDTO.setStr(byCode.getExternalDocumentNo());
|
||||
// stringWithMapDTO.setMap(map);
|
||||
// remoteTaskService.wmsCompleteFlow(stringWithMapDTO);
|
||||
// }
|
||||
|
||||
// if (CollectionUtil.isNotEmpty(interfaceMap)) {
|
||||
// ErpMm006RequestBodyDTO erpMm006RequestBodyDTO = new ErpMm006RequestBodyDTO();
|
||||
// erpMm006RequestBodyDTO.setZywlx(InterfaceCodeConstant.MM_001_Z15);
|
||||
// erpMm006RequestBodyDTO.setLfsnr(documentNo);
|
||||
// erpMm006RequestBodyDTO.setItem(interfaceMap.values());
|
||||
// erpInterfanceService.wmsCallErp(InterfaceCodeConstant.MM_001, erpMm006RequestBodyDTO, null);
|
||||
// }
|
||||
// 当采购到货拆批执行完后,会调用质量模块 创建来料检验任务
|
||||
createAndCollecttInspectDataSource(itemList);
|
||||
|
||||
return printMap;
|
||||
}
|
||||
}
|
||||
|
||||
@GlobalTransactional
|
||||
private void createAndCollecttInspectDataSource(List<DocumentDetailedDto> itemList) {
|
||||
// 循环遍历
|
||||
for (DocumentDetailedDto item : itemList) {
|
||||
String documentDetailedBO = item.getHandle();
|
||||
// 根据 documentDetailedBO 查询单据明细表
|
||||
DocumentDetailed documentDetailed = documentDetailedService.getOne(Wrappers.lambdaQuery(DocumentDetailed.class)
|
||||
.eq(DocumentDetailed::getHandle, documentDetailedBO));
|
||||
if (documentDetailed == null) {
|
||||
throw BusinessException.build("根据单据明细主键"+ documentDetailedBO+"未找到单据明细");
|
||||
} else {
|
||||
String iqcResults = documentDetailed.getIqcResults();
|
||||
// 如果 iqcResults 等于 BJ报检时,才会调用质量模块来创建来料检验任务
|
||||
if ("BJ".equals(iqcResults)) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
// 获取单据号
|
||||
String documentNo = item.getDocumentNo();
|
||||
// 根据单据号查询单据表
|
||||
String documentBo = Document.genHandle(site, documentNo);
|
||||
Document document = getById(documentBo);
|
||||
if (document == null) {
|
||||
throw BusinessException.build("根据单据号"+ documentNo +"未找到单据");
|
||||
}
|
||||
// 外部单号,即采购订单号
|
||||
String externalDocumentNo = document.getExternalDocumentNo();
|
||||
// 根据 po 单号,查询 wms_po_order
|
||||
PoOrder poOrder = poOrderService.getOne(Wrappers.lambdaQuery(PoOrder.class)
|
||||
.eq(PoOrder::getSite, site)
|
||||
.eq(PoOrder::getPo, externalDocumentNo)
|
||||
);
|
||||
if (poOrder == null) {
|
||||
throw BusinessException.build("根据外部单号"+ externalDocumentNo +"未找到PO单");
|
||||
}
|
||||
// 获取供应商编码
|
||||
String supplierNo = poOrder.getCustomerNo();
|
||||
// 供应商基础数据主键[备注:供应商编码不会在 supplier_basis 供应商主数据表存在,这里只是根据业务要求拼接一下传给PMS]
|
||||
String supplierBasisBo = SupplierBasis.genHandle(site, supplierNo);
|
||||
|
||||
// 获取物料号
|
||||
String itemNo = item.getItem();
|
||||
// 根据 父库存 查询库存表
|
||||
String parentInventoryId = documentNo + "-" + item.getSeq() + "-" + itemNo;
|
||||
Inventory parentInventory = Optional.ofNullable(inventoryService.getByCode(site, parentInventoryId))
|
||||
.orElseThrow(() -> BusinessException.build("未找到父库存" + parentInventoryId));
|
||||
// 获取 供应商批号
|
||||
String vendorBatchNo = parentInventory.getVendorBatchNo();
|
||||
// 获取 SAP批次
|
||||
String batchNo = parentInventory.getBatchNo();
|
||||
// 收货批次= 物料号+SAP批次
|
||||
String receiveBatchNo = itemNo + batchNo;
|
||||
// 托数
|
||||
Long dragQuantity = (long) item.getInventoryList().size();
|
||||
|
||||
Item itemEntity = selectCurrentItem(site, itemNo);
|
||||
if (itemEntity == null) {
|
||||
throw BusinessException.build("物料" + itemNo + "不存在");
|
||||
}
|
||||
|
||||
String itemBo = itemEntity.getHandle();
|
||||
|
||||
// 根据 物料主键查询 QmsQcPlanTarget,查询结果为List<QmsQcPlanTarget>
|
||||
List<QmsQcPlanTarget> qmsQcPlanTargetList = documentMapper.selectQmsQcPlanTargetList(itemBo);
|
||||
|
||||
if (qmsQcPlanTargetList.size() == 0) {
|
||||
throw BusinessException.build("物料" + itemNo + "未配置IQC检验计划");
|
||||
}
|
||||
|
||||
for (QmsQcPlanTarget qmsQcPlanTarget : qmsQcPlanTargetList) {
|
||||
InspecJobExtend inspecJobExtend = new InspecJobExtend();
|
||||
// 站点
|
||||
inspecJobExtend.setSite(site);
|
||||
// 物料主键
|
||||
inspecJobExtend.setItemBo(itemEntity.getHandle());
|
||||
// 检验级别
|
||||
inspecJobExtend.setInspectLevel(qmsQcPlanTarget.getInspectLevel());
|
||||
// 检验对象主键
|
||||
inspecJobExtend.setTargetBo(qmsQcPlanTarget.getTargetBo());
|
||||
// 收料总量
|
||||
inspecJobExtend.setReceiptQuantity(item.getApplicationsQuantity());
|
||||
// 供应商基础数据主键
|
||||
inspecJobExtend.setSupplierBasisBo(supplierBasisBo);
|
||||
// 供应商批号
|
||||
inspecJobExtend.setSupplierBatch(vendorBatchNo);
|
||||
// 供应商编号
|
||||
inspecJobExtend.setSupplierNo(supplierNo);
|
||||
// 检验类型 1:IQC
|
||||
inspecJobExtend.setInspecType("1");
|
||||
// 项次号
|
||||
inspecJobExtend.setItemNumber(item.getSeq().toString());
|
||||
// 收料单号
|
||||
inspecJobExtend.setReceiptNo(item.getDocumentNo());
|
||||
// 采购订单号 EXTERNAL_DOCUMENT_NO
|
||||
inspecJobExtend.setPurchaseNo(externalDocumentNo);
|
||||
// 收料托数
|
||||
inspecJobExtend.setDragQuantity(dragQuantity);
|
||||
// SAP批次
|
||||
inspecJobExtend.setSapBatch(batchNo);
|
||||
// 收货批次= 物料号+SAP批次
|
||||
inspecJobExtend.setReceiptBatch(receiveBatchNo);
|
||||
// 状态
|
||||
inspecJobExtend.setStatus("Y");
|
||||
// 创建人
|
||||
inspecJobExtend.setCreator(user);
|
||||
// 创建时间
|
||||
inspecJobExtend.setDateCreate(LocalDateTime.now());
|
||||
// 更新人
|
||||
inspecJobExtend.setUpdater(user);
|
||||
// 更新时间
|
||||
inspecJobExtend.setDateUpdate(LocalDateTime.now());
|
||||
R<List<CreateAndCollectInspectDataSourceResponse>> iqcR= remoteQmsInspecJobService.createAndCollecttInspectDataSource(inspecJobExtend);
|
||||
|
||||
if (iqcR.getCode() != 0) {
|
||||
throw BusinessException.build("调用质量模块创建来料检验任务失败");
|
||||
}
|
||||
List<CreateAndCollectInspectDataSourceResponse> dataSourceList = iqcR.getData();
|
||||
String jobNo = dataSourceList.get(0).getJobNo();
|
||||
// 更新单据明细表的检验单号
|
||||
documentDetailedService.update(Wrappers.lambdaUpdate(DocumentDetailed.class)
|
||||
.set(DocumentDetailed::getInspectionOrderNo, jobNo)
|
||||
.eq(DocumentDetailed::getHandle, documentDetailedBO));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@GlobalTransactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Map<String, List<String>> saleReturnSubmit(List<DocumentDetailedDto> itemList) {
|
||||
|
||||
@ -2,6 +2,7 @@ package com.foreverwin.mom.wms.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.foreverwin.iep.prd.domain.QmsQcPlanTarget;
|
||||
import com.foreverwin.mom.common.data.datascope.MomBaseMapper;
|
||||
import com.foreverwin.mom.wms.dto.DocumentWithPoOrderDTO;
|
||||
import com.foreverwin.mom.wms.dto.WipShopOrderDto;
|
||||
@ -59,4 +60,6 @@ public interface DocumentMapper extends MomBaseMapper<Document> {
|
||||
String getDocumentPrefix(@Param("site")String site, @Param("value")String value);
|
||||
|
||||
IPage<WipShopOrderDto> selectShopOrderInfo(IPage iPage, @Param("wipShopOrderDto") WipShopOrderDto wipShopOrderDto);
|
||||
|
||||
List<QmsQcPlanTarget> selectQmsQcPlanTargetList(@Param("targetBo") String targetBo);
|
||||
}
|
||||
|
||||
@ -145,10 +145,10 @@
|
||||
<select id="getDetailedList" resultType="com.foreverwin.mom.wms.dto.DocumentDetailedDto">
|
||||
select zdd.* ,case when cf.`FIELD_VALUE` ='VERP' then 'Y' when cf.`FIELD_VALUE` ='KMAT' then 'Y' else 'N' end IS_PACk,zd.`SALES_BATCH`,zd.`CUSTOMER`
|
||||
,cf.`FIELD_VALUE` as ITEM_TYPE
|
||||
from z_document_detailed zdd
|
||||
join z_document zd on zd.`HANDLE`=zdd.`DOCUMENT_BO`
|
||||
join item i on i.`ITEM`=zdd.`ITEM` and zdd.`SITE`=i.`SITE` and i.`CURRENT_REVISION`='Y'
|
||||
left join custom_fields cf on i.`HANDLE`=cf.`HANDLE` and cf.`FIELD_NAME`='CUSTOM_ITEM_TYPE'
|
||||
from wms.z_document_detailed zdd
|
||||
join wms.z_document zd on zd.`HANDLE`=zdd.`DOCUMENT_BO`
|
||||
join wip.item i on i.`ITEM`=zdd.`ITEM` and zdd.`SITE`= i.`SITE` and i.`CURRENT_REVISION`='Y'
|
||||
left join wip.custom_fields cf on i.`HANDLE`=cf.`HANDLE` and cf.`FIELD_NAME`='CUSTOM_ITEM_TYPE'
|
||||
where zdd.`DOCUMENT_BO`=#{documentBo}
|
||||
order by convert(zdd.`SEQ`,unsigned) asc
|
||||
</select>
|
||||
|
||||
@ -208,5 +208,19 @@
|
||||
and cf2.FIELD_VALUE like concat('%', #{wipShopOrderDto.salesOrderSeq}, '%');
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectQmsQcPlanTargetList" resultType="com.foreverwin.iep.prd.domain.QmsQcPlanTarget">
|
||||
select
|
||||
qqpt.HANDLE
|
||||
,qqpt.SITE
|
||||
,qqpt.QC_PLAN
|
||||
,qqpt.SEQ
|
||||
,qqpt.TARGET_BO
|
||||
,qqpt.DATE_CREATE
|
||||
,qqpt.DATE_UPDATE
|
||||
,qqpt.CREATOR
|
||||
,qqpt.UPDATER
|
||||
,qqpt.INSPECT_LEVEL
|
||||
from wip.qms_qc_plan_target qqpt where qqpt.TARGET_BO = #{targetBo}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user