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