diff --git a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/vo/MesSaleOrderTransferVo.java b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/vo/MesSaleOrderTransferVo.java index 4a880ea..945b9a6 100644 --- a/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/vo/MesSaleOrderTransferVo.java +++ b/hw-api/hw-api-mes/src/main/java/com/hw/mes/api/domain/vo/MesSaleOrderTransferVo.java @@ -33,5 +33,7 @@ public class MesSaleOrderTransferVo { @NotNull(message = "新销售订单Id必须输入") private Long newSaleOrderId; - + //物料ID + @NotNull(message = "物料Id必须输入") + private Long materialId; } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java index 0e77e20..5c53bdb 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/controller/MesApiController.java @@ -9,6 +9,7 @@ import com.hw.common.log.enums.BusinessType; import com.hw.common.security.annotation.RequiresPermissions; import com.hw.common.security.utils.SecurityUtils; import com.hw.mes.api.domain.MesBaseBarcodeInfo; +import com.hw.mes.api.domain.MesBaseMaterialInfo; import com.hw.mes.api.domain.MesBaseStationInfo; import com.hw.mes.domain.MesMaterialBom; import com.hw.mes.domain.MesProductPlan; @@ -344,4 +345,15 @@ public class MesApiController extends BaseController { return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds, MesConstants.MES_BARCODE_TYPE_PRODUCT,false,printNumber)); } + + + @GetMapping("/getMaterialInfoList") + public TableDataInfo getMaterialInfoList(MesBaseMaterialInfo mesBaseMaterialInfo) + { + startPage(); + List list = mesBaseMaterialInfoService.selectMesBaseMaterialInfoList(mesBaseMaterialInfo); + return getDataTable(list); + } + + } diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml index 7aa9fcf..fa81973 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesProductPlanMapper.xml @@ -359,7 +359,7 @@ and mpp.plan_status = #{planStatus} and mpp.plan_status in ('1','2') - order by mpp.plan_status,mpp.plan_begin_time + order by mpp.plan_begin_time diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java index f1acaee..253a471 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/controller/WmsApiController.java @@ -98,7 +98,7 @@ public class WmsApiController extends BaseController { */ @Log(title = "原材料退库记录", businessType = BusinessType.APPLY) @PostMapping(("/applyRawReturn")) - public AjaxResult applyRawReturn(@Validated @RequestBody List wmsRawReturns) { + public AjaxResult applyRawReturn(@RequestBody List wmsRawReturns) { return toAjax(wmsRawReturnService.applyRawReturn(wmsRawReturns)); } diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java index 17fc1ee..c2cf5e1 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsRawReturnServiceImpl.java @@ -494,39 +494,11 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { if (planAmount.compareTo(BigDecimal.ZERO) <= 0) { throw new ServiceException("数量需大于0"); } - String materialBarcode = rawReturn.getMaterialBarcode(); - R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); - if (baseBarcodeInfoR == null) { - throw new ServiceException("物料条码有误"); - } - MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); - if (baseBarcodeInfo == null) { - throw new ServiceException("物料条码有误"); - } - String batchFlag = baseBarcodeInfo.getBatchFlag(); - if (!batchFlag.equals(MesConstants.IS_BATCH)) { - if (planAmount.compareTo(BigDecimal.ONE) != 0) { - throw new ServiceException("非批次物料数量需等于1"); - } - } - - if (!baseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) { - throw new ServiceException("物料条码有误,此物料编码非原材料编码"); - } - - WmsRawStock existedRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode); - if (existedRawStock != null && existedRawStock.getTotalAmount().compareTo(BigDecimal.ZERO) > 0) { - throw new ServiceException("此物料条码在仓库中存在"); - } - rawReturn.setTaskCode(taskCode); rawReturn.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE); - rawReturn.setEndStationCode(baseWarehouse.getAgvPositionCode()); rawReturn.setOperationType(operationType); rawReturn.setAuditStatus(auditStatus); rawReturn.setReturnAmount(BigDecimal.ZERO); - rawReturn.setMaterialId(baseBarcodeInfo.getMaterialId()); - rawReturn.setBatchCode(baseBarcodeInfo.getBatchCode()); rawReturn.setApplyBy(userName); rawReturn.setApplyDate(currentDate); toInsertedRawReturns.add(rawReturn); @@ -538,6 +510,91 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService { } + +// /** +// * 申请退库 +// * +// * @param wmsRawReturns 原材料退库记录列表 +// * @return 结果 +// */ +// @Transactional(rollbackFor = Exception.class) +// @Override +// public int applyRawReturn(List wmsRawReturns) { +// //申请退库不指定库位,申请退库的多个物料生成多条退库记录,目前按每个条码物料申请退库 +// //根据仓库ID分组获取总申请数量 +//// Map> rawReturnsMap = wmsRawReturns.stream() +//// .collect(Collectors.groupingBy(WmsRawReturn::getWarehouseId)); +// WmsRawReturn firstWmsRawReturn = wmsRawReturns.get(0); +// Long warehouseId = firstWmsRawReturn.getWarehouseId(); +// WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId); +// String warehouseType = baseWarehouse.getWarehouseType(); +// String returnRequirement = baseWarehouse.getReturnRequirement(); +// String operationType = WmsConstants.OPERATION_TYPE_MAP.get(warehouseType); +// String auditStatus = ""; +// if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {//如果是普通仓库,需要校验审核标识 +// if (returnRequirement.equals(WmsConstants.WMS_WAREHOUSE_RETURN_REQUIREMENT_APPLY_AUDIT)) { +// auditStatus = WmsConstants.WMS_AUDIT_STATUS_TOAUDIT; +// } else { +// auditStatus = WmsConstants.WMS_AUDIT_STATUS_PASS; +// } +// } else { +// auditStatus = WmsConstants.WMS_AUDIT_STATUS_PASS; +// } +// +// List toInsertedRawReturns = new ArrayList<>(); +// Date currentDate = new Date(); +// String userName = SecurityUtils.getUsername(); +// String taskCode = Seq.getId(Seq.rawReturnSeqType, Seq.rawReturnCode); +// +// for (WmsRawReturn rawReturn : wmsRawReturns) { +// BigDecimal planAmount = rawReturn.getPlanAmount(); +// if (planAmount.compareTo(BigDecimal.ZERO) <= 0) { +// throw new ServiceException("数量需大于0"); +// } +// String materialBarcode = rawReturn.getMaterialBarcode(); +// R baseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER); +// if (baseBarcodeInfoR == null) { +// throw new ServiceException("物料条码有误"); +// } +// MesBaseBarcodeInfo baseBarcodeInfo = baseBarcodeInfoR.getData(); +// if (baseBarcodeInfo == null) { +// throw new ServiceException("物料条码有误"); +// } +// String batchFlag = baseBarcodeInfo.getBatchFlag(); +// if (!batchFlag.equals(MesConstants.IS_BATCH)) { +// if (planAmount.compareTo(BigDecimal.ONE) != 0) { +// throw new ServiceException("非批次物料数量需等于1"); +// } +// } +// +// if (!baseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) { +// throw new ServiceException("物料条码有误,此物料编码非原材料编码"); +// } +// +// WmsRawStock existedRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode); +// if (existedRawStock != null && existedRawStock.getTotalAmount().compareTo(BigDecimal.ZERO) > 0) { +// throw new ServiceException("此物料条码在仓库中存在"); +// } +// +// rawReturn.setTaskCode(taskCode); +// rawReturn.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE); +// rawReturn.setEndStationCode(baseWarehouse.getAgvPositionCode()); +// rawReturn.setOperationType(operationType); +// rawReturn.setAuditStatus(auditStatus); +// rawReturn.setReturnAmount(BigDecimal.ZERO); +// rawReturn.setMaterialId(baseBarcodeInfo.getMaterialId()); +// rawReturn.setBatchCode(baseBarcodeInfo.getBatchCode()); +// rawReturn.setApplyBy(userName); +// rawReturn.setApplyDate(currentDate); +// toInsertedRawReturns.add(rawReturn); +// } +// +// wmsRawReturnMapper.batchWmsRawReturn(toInsertedRawReturns); +// +// return 1; +// } + + /** * 直接退库(适合四楼激光切割工位板材退库) * diff --git a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java index 71551e6..c808d8d 100644 --- a/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java +++ b/hw-modules/hw-wms/src/main/java/com/hw/wms/service/impl/WmsStockTotalServiceImpl.java @@ -462,6 +462,7 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService { mesSaleOrderTransferVo.setTransferAmount(transferAmount); mesSaleOrderTransferVo.setOldSaleOrderId(wmsStockTotal.getSaleOrderId()); mesSaleOrderTransferVo.setNewSaleOrderId(saleOrderId); + mesSaleOrderTransferVo.setMaterialId(materialId); mesSaleOrderTransferVo.setMesBaseBarcodeInfos(mesBaseBarcodeInfos); R transferBaseBarcodeInfosResult = remoteMesService.transferSaleOrders(mesSaleOrderTransferVo, SecurityConstants.INNER); diff --git a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml index 12426a4..e6fd72d 100644 --- a/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml +++ b/hw-modules/hw-wms/src/main/resources/mapper/wms/WmsStockTotalMapper.xml @@ -27,6 +27,8 @@ + + @@ -245,7 +247,8 @@ wst.update_by, wst.update_date, wst.active_flag, - mso.saleorder_code + mso.saleorder_code, + mbmi.material_classfication from wms_stock_total wst left join wms_base_warehouse wbw on wbw.warehouse_id = wst.warehouse_id left join mes_base_material_info mbmi on mbmi.material_id = wst.material_id diff --git a/hw-ui/src/api/board/index.js b/hw-ui/src/api/board/index.js index 2caf054..40fdff1 100644 --- a/hw-ui/src/api/board/index.js +++ b/hw-ui/src/api/board/index.js @@ -357,3 +357,14 @@ export function getMaterialInfoByMaterialId(materialId) { method: 'get', }) } + + +// 查询物料信息列表 +export function getMaterialInfoList(query) { + return request({ + url: '/mes/api/getMaterialInfoList', + method: 'get', + params: query + }) +} + diff --git a/hw-ui/src/views/board/common/applyRawReturn.vue b/hw-ui/src/views/board/common/applyRawReturn.vue new file mode 100644 index 0000000..16a8c5f --- /dev/null +++ b/hw-ui/src/views/board/common/applyRawReturn.vue @@ -0,0 +1,380 @@ + + + + diff --git a/hw-ui/src/views/board/common/selectMaterial.vue b/hw-ui/src/views/board/common/selectMaterial.vue new file mode 100644 index 0000000..84ea098 --- /dev/null +++ b/hw-ui/src/views/board/common/selectMaterial.vue @@ -0,0 +1,188 @@ + + + diff --git a/hw-ui/src/views/board/fifthFloor/index.vue b/hw-ui/src/views/board/fifthFloor/index.vue index 6b84fea..75ec008 100644 --- a/hw-ui/src/views/board/fifthFloor/index.vue +++ b/hw-ui/src/views/board/fifthFloor/index.vue @@ -45,7 +45,8 @@ :disabled="form.planDetailStatus === '已完成' || !form.planDetailCode" @click="handleMaterialConfirmForm()">扫描 - 退料 取 消 - 退 库 + 退 库 @@ -440,6 +441,14 @@ + + + + + + +
@@ -496,10 +505,11 @@ import { getWarehouses, bindBarcode, applyRawBack, - assignTask, scanMaterial2Confirm, applyRawReturn, + assignTask, scanMaterial2Confirm, getNewestOutstockCabinet, updateBarcodePlan, completeCollectMaterials, completeReturnMaterials, continueRawInstock } from "@/api/board"; import applyRawOutstock from '@//views/board/common/applyRawOutstock.vue'; +import applyRawReturn from '@//views/board/common/applyRawReturn.vue'; import WorkshopNotice from "@/components/workshopNotice/index.vue"; import {noticeData} from "@/utils/notice" import ViewFile from "@/components/viewFile/index.vue"; @@ -521,6 +531,7 @@ export default { name: 'Board1', components: { 'apply-raw-outstock': applyRawOutstock, + 'apply-raw-return': applyRawReturn, Chart, PrintPage, WorkshopNotice, @@ -529,7 +540,8 @@ export default { dicts: ['wms_raw_return_task_type', 'mes_safe_flag'], provide() { return { - closeDialog: this.closeDialog + closeDialog: this.closeDialog, + closeRawReturnDialog:this.closeRawReturnDialog } }, mixins: [noticeData], @@ -557,6 +569,10 @@ export default { productPlanData: {}, form: {}, form1: {}, + + applyRawReturnTitle: '', + applyRawReturnVisible: false, + assignTaskForm: { materialBarcode: null, stationId: null @@ -1377,11 +1393,10 @@ export default { this.form.planDetailStatus = setState("3"); let productPlanRow = this.tableData.find(v => v.planCode === this.form.planCode); - productPlanRow.completeAmount = productPlanRow.completeAmount+1; + productPlanRow.completeAmount = productPlanRow.completeAmount + 1; } - // getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => { // this.tableData = e.rows // this.totalNum1 = Math.ceil(e.total / 5) @@ -1430,6 +1445,9 @@ export default { this.dialogVisible = false; }, + closeRawReturnDialog(){ + this.applyRawReturnVisible = false; + }, print() { getNewestOutstockCabinet({planDetailCode: this.form.planDetailCode}).then(response => { @@ -1699,6 +1717,33 @@ export default { }) }, + + // 申请退库页面 + handleApplyRawReturn() { + this.applyRawReturnTitle = "申请退库"; + this.applyRawReturnVisible = true; + + this.productPlanData = { + warehouseId: '', + planId: this.form?.planId, + planCode: this.form?.planCode, + dispatchCode: this.form?.dispatchCode, + planDetailCode: this.form?.planDetailCode, + saleOrderId: this.form?.saleOrderId, + productId: this.form?.materialId, + materialBomId: this.form?.materialBomId, + maxPlanAmount: this.maxPlanAmount, + applyReason: '', + taskType: this.taskType, + returnFlag: '0', + stationId: this.loginStationInfo.stationId, + stationCode: this.loginStationInfo.stationCode, + warehouseFloor: 5, + wmsRawReturnList: [] + } + }, + + } } diff --git a/hw-ui/src/views/board/firstFloor/index.vue b/hw-ui/src/views/board/firstFloor/index.vue index 042ff5d..5a313cc 100644 --- a/hw-ui/src/views/board/firstFloor/index.vue +++ b/hw-ui/src/views/board/firstFloor/index.vue @@ -236,7 +236,7 @@ 退库 @@ -419,6 +419,14 @@ + + + + + + +
@@ -445,11 +453,11 @@ import { completeProductPlanDetail, firstFloorProduceInstock, scanMaterial2Confirm, - applyRawReturn, selectMaterialInstallationCircumstance } from '@/api/board' import {getToken} from "@/utils/auth"; import applyRawOutstock from "@/views/board/common/applyRawOutstock.vue"; +import applyRawReturn from '@//views/board/common/applyRawReturn.vue'; import {getNowDateTime} from "@/utils/ruoyi"; import ViewFile from "@/components/viewFile/index.vue"; import {getDispatchSOPAttachList} from "@/api/mes/productplan"; @@ -460,11 +468,13 @@ export default { dicts: ['mes_plan_detail_status', 'wms_raw_return_task_type', "mes_safe_flag"], provide(){ return{ - closeDialog : this.closeDialog + closeDialog : this.closeDialog, + closeRawReturnDialog:this.closeRawReturnDialog } }, components: { 'apply-raw-outstock': applyRawOutstock, + 'apply-raw-return': applyRawReturn, Chart, PrintPage, WorkshopNotice, @@ -501,6 +511,8 @@ export default { warehouseList: [], form: {}, dialogVisible: false, + applyRawReturnVisible:false, + applyRawReturnTitle: '', tableData: [], tableData1: [], tableData2: [], @@ -1034,6 +1046,33 @@ export default { this.dialogVisible = false; }, + + // 申请退库页面 + handleApplyRawReturn(row) { + this.applyRawReturnTitle = "申请退库"; + this.applyRawReturnVisible = true; + + this.productPlanData = { + warehouseId: '', + planId: row.planId, + planCode: row.planCode, + dispatchCode: row.dispatchCode, + planDetailCode: row.planDetailCode, + saleOrderId: row.saleOrderId, + productId: this.productId, + materialBomId: this.materialBomId, + applyReason: '', + taskType: '', + warehouseFloor: 1, + wmsRawReturnList: [] + } + }, + + + closeRawReturnDialog(){ + this.applyRawReturnVisible = false; + }, + } } diff --git a/hw-ui/src/views/board/fourthFloor/assemble.vue b/hw-ui/src/views/board/fourthFloor/assemble.vue index da65a1c..4c57fbe 100644 --- a/hw-ui/src/views/board/fourthFloor/assemble.vue +++ b/hw-ui/src/views/board/fourthFloor/assemble.vue @@ -185,7 +185,7 @@ 退库 @@ -328,6 +328,15 @@ + + + + + + + +
@@ -352,10 +361,11 @@ import { fourthFloorProduceInstock, check4thFloorProduceOutstock, fourthFloorProduceOutstock, - scanMaterial2Confirm, applyRawReturn + scanMaterial2Confirm, } from "@/api/board"; import {monitorSerialData} from "@/utils/serial"; import applyRawOutstock from '@//views/board/common/applyRawOutstock.vue'; +import applyRawReturn from '@//views/board/common/applyRawReturn.vue'; import {getNowDateTime} from "@/utils/ruoyi"; import WorkshopNotice from "@/components/workshopNotice/index.vue"; import {noticeData} from "@/utils/notice" @@ -368,12 +378,14 @@ export default { dicts: ['mes_plan_detail_status', 'wms_raw_return_task_type', 'mes_safe_flag'], provide(){ return{ - closeDialog : this.closeDialog + closeDialog : this.closeDialog, + closeRawReturnDialog:this.closeRawReturnDialog } }, mixins: [monitorSerialData, noticeData], components: { 'apply-raw-outstock': applyRawOutstock, + 'apply-raw-return': applyRawReturn, Chart, PrintPage, WorkshopNotice, @@ -408,7 +420,8 @@ export default { dialogVisible: false, tableData: [], tableData1: [], - + applyRawReturnVisible:false, + applyRawReturnTitle: '', productInstockType: null,//类型,出库还是入库 PRODUCT_INSTOCK_TYPE: { INSTOCK: "1",//入库 @@ -1154,6 +1167,32 @@ export default { }, + + // 申请退库页面 + handleApplyRawReturn(row) { + this.applyRawReturnTitle = "申请退库"; + this.applyRawReturnVisible = true; + this.productPlanData = { + warehouseId: '', + planId: row.planId, + planCode: row.planCode, + dispatchCode: row.dispatchCode, + planDetailCode: row.planDetailCode, + saleOrderId: row.saleOrderId, + productId: this.productId, + materialBomId: this.materialBomId, + applyReason: '', + taskType: '', + mesAreaType: 3, + warehouseFloor: 4, + wmsRawReturnList: [] + } + }, + + closeRawReturnDialog(){ + this.applyRawReturnVisible = false; + }, + } } diff --git a/hw-ui/src/views/wms/info/stocktotal/index.vue b/hw-ui/src/views/wms/info/stocktotal/index.vue index c25eb2f..bf07842 100644 --- a/hw-ui/src/views/wms/info/stocktotal/index.vue +++ b/hw-ui/src/views/wms/info/stocktotal/index.vue @@ -139,7 +139,7 @@ size="mini" type="text" icon="el-icon-shopping-cart-1" - v-if="scope.row.batchFlag === BATCH_FLAG.NO && type === STOCK_TYPE.RAW" + v-if="scope.row.batchFlag === BATCH_FLAG.NO && type === STOCK_TYPE.RAW && scope.row.materialClassfication=== MATERIAL_CLASSFICATION.ERP" @click="handleStockTotalTransfer(scope.row)" v-hasPermi="['wms:stocktotal:transfer']" >转库存 @@ -148,7 +148,7 @@ size="mini" type="text" icon="el-icon-shopping-cart-1" - v-if="scope.row.batchFlag === BATCH_FLAG.NO && type === STOCK_TYPE.PRODUCT" + v-if="scope.row.batchFlag === BATCH_FLAG.NO && type === STOCK_TYPE.PRODUCT && scope.row.materialClassfication=== MATERIAL_CLASSFICATION.ERP" @click="handleStockTotalTransfer(scope.row)" v-hasPermi="['wms:stocktotal:transferProduct']" >转库存 @@ -190,7 +190,7 @@ - + @@ -209,7 +209,8 @@ {{ scope.row.saleOrderId === 0 ? "是" : "否" }} - + @@ -306,7 +307,7 @@ export default { components: { 'select-sale-order': selectSaleOrder }, - dicts: ['mes_safe_flag', 'wms_stock_complete_flag','mes_material_batch_flag'], + dicts: ['mes_safe_flag', 'wms_stock_complete_flag', 'mes_material_batch_flag'], data() { return { // 遮罩层 @@ -332,7 +333,7 @@ export default { open: false, //转库类型 transferType: '', - rowIndex:0, + rowIndex: 0, // 类型:原材料库存=1、成品库存=2 type: null, // 仓库List @@ -346,6 +347,7 @@ export default { label: "warehouseName" }, rawStockIds: [], + instockBatches: [], rawStockInfos: [], rawStockInfosStr: '', // 查询参数 @@ -402,6 +404,17 @@ export default { YES: "1", NO: "0" }, //是否显示选择销售订单弹出层 + + MATERIAL_CLASSFICATION: { + ERP: "1", + VIRTUAL: "2" + }, + + RAW_BARCODE_VIRTUAL:{ + EXTERNAL_VIRTUAL:"VR",//外部采购合并的虚拟物料条码标识 + INTERNAL_VIRTUAL:"RN",//内部生产合并的虚拟物料条码标识 + }, + selectSaleOrderVisible: false, }; }, @@ -423,7 +436,7 @@ export default { {key: 2, label: `库位编码`, visible: true}, {key: 3, label: `物料编码`, visible: true}, {key: 4, label: `物料名称`, visible: true}, - {key: 5, label: `物料条码`, visible: true, prop:'instockBatch'}, + {key: 5, label: `物料条码`, visible: true, prop: 'instockBatch'}, {key: 6, label: `托盘码`, visible: true}, {key: 7, label: `总数量`, visible: true}, {key: 8, label: `占用数量`, visible: true}, @@ -447,7 +460,7 @@ export default { {key: 2, label: `库位编码`, visible: true}, {key: 3, label: `物料编码`, visible: true}, {key: 4, label: `物料名称`, visible: true}, - {key: 5, label: `物料条码`, visible: true,prop:'productBatch'}, + {key: 5, label: `物料条码`, visible: true, prop: 'productBatch'}, {key: 6, label: `托盘码`, visible: true}, {key: 7, label: `总数量`, visible: true}, {key: 8, label: `占用数量`, visible: true}, @@ -588,15 +601,20 @@ export default { saleOrderId: null, stockTotalId: null, transferAmount: null, - index:null, + index: null, }; this.resetForm("form"); }, // 库位库存明细信息多选框选中数据 handleRawStockSelectionChange(selection) { - this.rawStockIds = selection.map((item, index) => index + "-" + item.rawStockId); - this.rawStockInfos = selection.map((item, index) => "序号:" + (index + 1) + " 物料编码:" + item.materialCode + " 物料名称:" + item.materialName + " 物料规格:" + item.materialSpec + " 数量:" + item.totalAmount + " 销售订单:" + (item.saleorderCode ? item.saleorderCode : "无")) + let index = 0; + selection.forEach(row => { + index = this.rawstockList.indexOf(row); + }); + this.instockBatches = selection.map((item, index1) => index + "-" + item.instockBatch); + this.rawStockIds = selection.map((item, index1) => index + "-" + item.rawStockId); + this.rawStockInfos = selection.map((item, index1) => "序号:" + (index + 1) + " 物料编码:" + item.materialCode + " 物料名称:" + item.materialName + " 物料规格:" + item.materialSpec + " 数量:" + item.totalAmount + " 销售订单:" + (item.saleorderCode ? item.saleorderCode : "无")) this.single = selection.length !== 1 this.multiple = !selection.length }, @@ -628,23 +646,33 @@ export default { this.form.saleorderCode = null; } - if (this.type === this.STOCK_TYPE.PRODUCT){ + if (this.type === this.STOCK_TYPE.PRODUCT) { transferProductStockTotal(this.form).then(response => { this.$modal.msgSuccess("转库存成功"); this.open = false; this.getList(); this.getTwoList(); }); - }else if (this.type === this.STOCK_TYPE.RAW){ - if(this.transferType==='1'){ + } else if (this.type === this.STOCK_TYPE.RAW) { + if (this.transferType === '1') { transferRawStockTotal(this.form).then(response => { this.$modal.msgSuccess("转库存成功"); this.open = false; this.getList(); this.getTwoList(); }); - }else if(this.transferType==='2'){ + } else if (this.transferType === '2') { this.form.indexStockIds = this.rawStockIds; + for(const instockBatchStr of this.instockBatches){ + let instockBatchStrArr = instockBatchStr.split("-"); + let instockBatchIndex = parseInt(instockBatchStrArr[0]); + let instockBatch = instockBatchStrArr[1]; + if(instockBatch.indexOf(this.RAW_BARCODE_VIRTUAL.EXTERNAL_VIRTUAL) >=0 || instockBatch.indexOf(this.RAW_BARCODE_VIRTUAL.INTERNAL_VIRTUAL) >=0){ + this.$modal.msgSuccess("序号:"+(instockBatchIndex+1)+",是虚拟合并的物料,不能转库存"); + return; + } + } + transferRaw(this.form).then(response => { this.$modal.msgSuccess("转库存成功"); this.open = false; @@ -655,7 +683,6 @@ export default { } - } }); }, @@ -664,9 +691,9 @@ export default { handleStockTotalTransfer(row) { this.reset(); this.transferType = "1"; - this.form.index = (this.stocktotalList.findIndex(item => item.stockTotalId === row.stockTotalId))+1; + this.form.index = (this.stocktotalList.findIndex(item => item.stockTotalId === row.stockTotalId)) + 1; this.form.stockTotalId = row.stockTotalId; - this.rawStockInfosStr = "序号:"+this.form.index+" 物料编码:" + row.materialCode + " 物料名称:" + row.materialName + " 物料规格:" + row.materialSpec + " 可转数量:" + (row.totalAmount - (row.occupyAmount ? row.occupyAmount : 0)) + " 销售订单:" + (row.saleorderCode ? row.saleorderCode : "无"); + this.rawStockInfosStr = "序号:" + this.form.index + " 物料编码:" + row.materialCode + " 物料名称:" + row.materialName + " 物料规格:" + row.materialSpec + " 可转数量:" + (row.totalAmount - (row.occupyAmount ? row.occupyAmount : 0)) + " 销售订单:" + (row.saleorderCode ? row.saleorderCode : "无"); this.open = true; }, @@ -675,7 +702,7 @@ export default { };