fix:发货管理(指定发货)
parent
9ee56a83a7
commit
d0d6919b11
|
|
@ -285,8 +285,33 @@ export default {
|
||||||
// }
|
// }
|
||||||
},
|
},
|
||||||
handleSelectPurchaseBeforeAssign() {
|
handleSelectPurchaseBeforeAssign() {
|
||||||
|
// 指定发货直接使用当前选中的采购单号
|
||||||
|
if (!this.activePurchaseNo) {
|
||||||
|
this.$message.error('请先选择一个采购单标签页');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从已绑定的采购单列表中找到当前选中的采购单信息
|
||||||
|
const currentPurchase = this.filteredPurchaseOrderList.find(
|
||||||
|
purchase => purchase.purchaseNo === this.activePurchaseNo
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!currentPurchase) {
|
||||||
|
this.$message.error('未找到当前选中的采购单信息');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置采购单信息
|
||||||
|
this.warehouseId = currentPurchase.warehouseId;
|
||||||
|
this.warehouseName = currentPurchase.warehouseName;
|
||||||
|
this.price = currentPurchase.price;
|
||||||
|
this.taxRate = currentPurchase.taxRate;
|
||||||
|
this.form.purchaseNo = currentPurchase.purchaseNo;
|
||||||
|
this.form.itemId = currentPurchase.itemId;
|
||||||
|
|
||||||
|
// 直接触发文件选择
|
||||||
this.isAssignMode = true;
|
this.isAssignMode = true;
|
||||||
this.purchaseOrderSelectVisible = true;
|
this.handleAssign();
|
||||||
},
|
},
|
||||||
handlePurchaseOrderSelect(order) {
|
handlePurchaseOrderSelect(order) {
|
||||||
// 如果是指定发货模式,需要验证选择的采购单是否在已绑定列表中
|
// 如果是指定发货模式,需要验证选择的采购单是否在已绑定列表中
|
||||||
|
|
@ -365,7 +390,6 @@ export default {
|
||||||
formData.append('productCode', this.productData.productCode);
|
formData.append('productCode', this.productData.productCode);
|
||||||
formData.append('orderType', this.productData.orderType);
|
formData.append('orderType', this.productData.orderType);
|
||||||
formData.append('purchaseNo', this.form.purchaseNo);
|
formData.append('purchaseNo', this.form.purchaseNo);
|
||||||
formData.append('itemId', this.form.itemId);
|
|
||||||
|
|
||||||
assignDeliverySnData(formData).then(response => {
|
assignDeliverySnData(formData).then(response => {
|
||||||
this.$message.success('指定发货导入成功');
|
this.$message.success('指定发货导入成功');
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,7 @@ public class VueInventoryOuterController extends BaseController
|
||||||
public AjaxResult assignDeliveryData(@RequestPart("file") MultipartFile file,
|
public AjaxResult assignDeliveryData(@RequestPart("file") MultipartFile file,
|
||||||
@RequestParam(value = "productCode") String productCode,
|
@RequestParam(value = "productCode") String productCode,
|
||||||
@RequestParam(value = "orderType", defaultValue = "1") String orderType,
|
@RequestParam(value = "orderType", defaultValue = "1") String orderType,
|
||||||
@RequestParam(value = "purchaseNo") String purchaseNo,
|
@RequestParam(value = "purchaseNo") String purchaseNo) {
|
||||||
@RequestParam(value = "itemId") Long itemId) {
|
|
||||||
ExcelUtil<InventoryInfoExcelDto> util = new ExcelUtil<InventoryInfoExcelDto>(InventoryInfoExcelDto.class);
|
ExcelUtil<InventoryInfoExcelDto> util = new ExcelUtil<InventoryInfoExcelDto>(InventoryInfoExcelDto.class);
|
||||||
|
|
||||||
try (InputStream inputStream = file.getInputStream()) {
|
try (InputStream inputStream = file.getInputStream()) {
|
||||||
|
|
@ -152,7 +151,7 @@ public class VueInventoryOuterController extends BaseController
|
||||||
return AjaxResult.error("导入数据为空");
|
return AjaxResult.error("导入数据为空");
|
||||||
}
|
}
|
||||||
return AjaxResult.success(innerService.validateAndGetAssignDeliveryList(
|
return AjaxResult.success(innerService.validateAndGetAssignDeliveryList(
|
||||||
inventoryInfoExcelDtoList, productCode, orderType, purchaseNo, itemId));
|
inventoryInfoExcelDtoList, productCode, orderType, purchaseNo));
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ServiceException("读取excel错误,请联系管理员");
|
throw new ServiceException("读取excel错误,请联系管理员");
|
||||||
|
|
|
||||||
|
|
@ -66,5 +66,5 @@ public interface IOmsInventoryInnerService
|
||||||
|
|
||||||
void importByOuter(List<InventoryInfo> inventoryInfoList, String productCode, String purchaseNo,Long itemId);
|
void importByOuter(List<InventoryInfo> inventoryInfoList, String productCode, String purchaseNo,Long itemId);
|
||||||
Map<String,Object> getInventoryInfoList(List<InventoryInfoExcelDto> inventoryInfoExcelDtoList, String productCode, String orderType);
|
Map<String,Object> getInventoryInfoList(List<InventoryInfoExcelDto> inventoryInfoExcelDtoList, String productCode, String orderType);
|
||||||
Map<String,Object> validateAndGetAssignDeliveryList(List<InventoryInfoExcelDto> inventoryInfoExcelDtoList, String productCode, String orderType, String purchaseNo, Long itemId);
|
Map<String,Object> validateAndGetAssignDeliveryList(List<InventoryInfoExcelDto> inventoryInfoExcelDtoList, String productCode, String orderType, String purchaseNo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -374,7 +374,7 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> validateAndGetAssignDeliveryList(List<InventoryInfoExcelDto> inventoryInfoExcelDtoList,
|
public Map<String, Object> validateAndGetAssignDeliveryList(List<InventoryInfoExcelDto> inventoryInfoExcelDtoList,
|
||||||
String productCode, String orderType, String purchaseNo, Long itemId) {
|
String productCode, String orderType, String purchaseNo) {
|
||||||
|
|
||||||
// 1. 判断文件中所有数据的产品编码是否相同
|
// 1. 判断文件中所有数据的产品编码是否相同
|
||||||
long distinctProductCodeCount = inventoryInfoExcelDtoList.stream()
|
long distinctProductCodeCount = inventoryInfoExcelDtoList.stream()
|
||||||
|
|
@ -406,16 +406,17 @@ public class OmsInventoryInnerServiceImpl implements IOmsInventoryInnerService {
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElseThrow(() -> new ServiceException("文件中未找到入库价"));
|
.orElseThrow(() -> new ServiceException("文件中未找到入库价"));
|
||||||
|
|
||||||
// 3. 判断当前选择的采购单中是否存在这个产品编码
|
// 3. 通过purchaseNo和productCode查询采购单明细
|
||||||
List<OmsPurchaseOrderItem> purchaseOrderItems = purchaseOrderService.listByItemId(itemId);
|
OmsPurchaseOrderItemDto query = new OmsPurchaseOrderItemDto();
|
||||||
|
query.setPurchaseNo(purchaseNo);
|
||||||
|
query.setProductCode(productCode);
|
||||||
|
List<OmsPurchaseOrderItemDto> purchaseOrderItems = purchaseOrderService.listItem(query);
|
||||||
|
|
||||||
if (CollUtil.isEmpty(purchaseOrderItems)) {
|
if (CollUtil.isEmpty(purchaseOrderItems)) {
|
||||||
throw new ServiceException("未找到采购单明细信息");
|
throw new ServiceException("未找到采购单明细信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
OmsPurchaseOrderItem matchedItem = purchaseOrderItems.stream()
|
OmsPurchaseOrderItemDto matchedItem = purchaseOrderItems.get(0);
|
||||||
.filter(item -> item.getProductCode().equals(productCode))
|
|
||||||
.findFirst()
|
|
||||||
.orElseThrow(() -> new ServiceException("采购单中不存在产品编码:" + productCode));
|
|
||||||
|
|
||||||
// 4. 判断采购单中对应的产品价格是否和文件中的入库价相同
|
// 4. 判断采购单中对应的产品价格是否和文件中的入库价相同
|
||||||
BigDecimal purchasePrice = matchedItem.getPrice();
|
BigDecimal purchasePrice = matchedItem.getPrice();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue