diff --git a/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue b/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue index 2d02f930..e778c462 100644 --- a/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue +++ b/klp-ui/src/components/KLPService/RawMaterialSelect/index.vue @@ -25,16 +25,7 @@ + \ No newline at end of file diff --git a/klp-ui/src/views/wms/print/scaner.vue b/klp-ui/src/views/wms/print/scaner.vue new file mode 100644 index 00000000..e69de29b diff --git a/klp-ui/src/views/wms/purchasePlan/index.vue b/klp-ui/src/views/wms/purchasePlan/index.vue index 06df6e1c..a983c820 100644 --- a/klp-ui/src/views/wms/purchasePlan/index.vue +++ b/klp-ui/src/views/wms/purchasePlan/index.vue @@ -117,8 +117,8 @@ /> - - + + diff --git a/klp-ui/src/views/wms/purchasePlan/panels/CreatePurchasePanel.vue b/klp-ui/src/views/wms/purchasePlan/panels/CreatePurchasePanel.vue index f60a8ade..a45e4f3e 100644 --- a/klp-ui/src/views/wms/purchasePlan/panels/CreatePurchasePanel.vue +++ b/klp-ui/src/views/wms/purchasePlan/panels/CreatePurchasePanel.vue @@ -8,56 +8,16 @@ - + -
- - -
原料区(待筛选)
-
- - 筛选 -
- - - - - - - -
- -
- 添加到采购 >> - << 移除 -
+
- +
采购单明细
- - + + + @@ -206,7 +206,7 @@ /> - - + -->
@@ -297,13 +297,13 @@ export default { detailDialogVisible: false, detailStockIo: null, // 条码打印抽屉相关 - drawerBarcodeVisible: false, - drawerBarcodeData: { - barcodes: [], - perRow: 3, - barcodeWidth: 180, - barcodeHeight: 60 - }, + // drawerBarcodeVisible: false, + // drawerBarcodeData: { + // barcodes: [], + // perRow: 3, + // barcodeWidth: 180, + // barcodeHeight: 60 + // }, }; }, created() { @@ -438,22 +438,22 @@ export default { // 刷新列表 this.getList(); }, - async handleShowBarcodeDrawer(row) { - // 获取明细列表 - const res = await listStockIoDetail({ stockIoId: row.stockIoId }); - const details = res.data || res.rows || []; - // 拼接条码内容 stockIoId_warehouseId_materialId_quantity - const barcodes = details.filter(el => el.recordType == 0).map(item => { - return encodeURIComponent(`${row.stockIoId}_${item.warehouseId || ''}_${item.itemId || ''}_${item.quantity || ''}`); - }); - this.drawerBarcodeData = { - barcodes, - perRow: 3, - barcodeWidth: 180, - barcodeHeight: 60 - }; - this.drawerBarcodeVisible = true; - }, + // async handleShowBarcodeDrawer(row) { + // // 获取明细列表 + // const res = await listStockIoDetail({ stockIoId: row.stockIoId }); + // const details = res.data || res.rows || []; + // // 拼接条码内容 stockIoId_warehouseId_materialId_quantity + // const barcodes = details.filter(el => el.recordType == 0).map(item => { + // return encodeURIComponent(`${row.stockIoId}_${item.warehouseId || ''}_${item.itemId || ''}_${item.quantity || ''}`); + // }); + // // this.drawerBarcodeData = { + // // barcodes, + // // perRow: 3, + // // barcodeWidth: 180, + // // barcodeHeight: 60 + // // }; + // // this.drawerBarcodeVisible = true; + // }, getIoTypeTagType(type) { if (type === 'in') return 'success'; if (type === 'out') return 'primary'; diff --git a/klp-ui/src/views/wms/stockIo/panels/barcode.vue b/klp-ui/src/views/wms/stockIo/panels/barcode.vue index b12002b7..8574f9d1 100644 --- a/klp-ui/src/views/wms/stockIo/panels/barcode.vue +++ b/klp-ui/src/views/wms/stockIo/panels/barcode.vue @@ -12,7 +12,7 @@
- +
@@ -21,12 +21,9 @@ - + - - - @@ -52,13 +49,13 @@ - +
条码 {{ idx + 1 }}
- - + + - + @@ -156,14 +153,7 @@ export default { barcodes: { handler(newVal) { // 初始化barcodeConfigs - this.barcodeConfigs = newVal.map((b, i) => { - const old = this.barcodeConfigs[i] || {}; - return { - code: b, - count: old.count || 1, - textTpl: typeof old.textTpl === 'string' ? old.textTpl : b - }; - }); + this.barcodeConfigs = newVal; this.$nextTick(this.renderPreviewIframe); }, immediate: true diff --git a/klp-wms/src/main/java/com/klp/domain/vo/WmsPurchasePlanDetailVo.java b/klp-wms/src/main/java/com/klp/domain/vo/WmsPurchasePlanDetailVo.java index 964cc324..2db753c0 100644 --- a/klp-wms/src/main/java/com/klp/domain/vo/WmsPurchasePlanDetailVo.java +++ b/klp-wms/src/main/java/com/klp/domain/vo/WmsPurchasePlanDetailVo.java @@ -73,5 +73,16 @@ public class WmsPurchasePlanDetailVo { @ExcelProperty(value = "原材料编码") private String rawMaterialCode; - + /** + * 需求量 + */ + private BigDecimal demand; + /** + * 库存量 + */ + private BigDecimal inventory; + /** + * 在途量 + */ + private BigDecimal onTheWay; } diff --git a/klp-wms/src/main/java/com/klp/mapper/WmsPurchasePlanDetailMapper.java b/klp-wms/src/main/java/com/klp/mapper/WmsPurchasePlanDetailMapper.java index 8ee0c34e..4951cd50 100644 --- a/klp-wms/src/main/java/com/klp/mapper/WmsPurchasePlanDetailMapper.java +++ b/klp-wms/src/main/java/com/klp/mapper/WmsPurchasePlanDetailMapper.java @@ -9,6 +9,8 @@ import com.klp.domain.vo.WmsPurchasePlanDetailVo; import com.klp.common.core.mapper.BaseMapperPlus; import org.apache.ibatis.annotations.Param; +import java.math.BigDecimal; + /** * 采购计划明细Mapper接口 * @@ -18,4 +20,9 @@ import org.apache.ibatis.annotations.Param; public interface WmsPurchasePlanDetailMapper extends BaseMapperPlus { Page selectVoPagePlus(Page page, @Param("ew") Wrapper wrapper); + + /** + * 查在途的原材料 + */ + BigDecimal getByRawMaterialIdAndOnTheWay(Long rawMaterialId); } diff --git a/klp-wms/src/main/java/com/klp/service/impl/WmsPurchasePlanServiceImpl.java b/klp-wms/src/main/java/com/klp/service/impl/WmsPurchasePlanServiceImpl.java index 30c1c2b5..7004e090 100644 --- a/klp-wms/src/main/java/com/klp/service/impl/WmsPurchasePlanServiceImpl.java +++ b/klp-wms/src/main/java/com/klp/service/impl/WmsPurchasePlanServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.klp.common.utils.StringUtils; import com.klp.domain.WmsProductBom; import com.klp.domain.WmsPurchasePlanDetail; +import com.klp.domain.WmsRawMaterial; import com.klp.domain.vo.WmsOrderDetailVo; import com.klp.domain.vo.WmsPurchasePlanDetailVo; import com.klp.mapper.WmsPurchasePlanDetailMapper; @@ -80,23 +81,38 @@ public class WmsPurchasePlanServiceImpl implements IWmsPurchasePlanService { List bomList = wmsProductBomService.listByProductId(detail.getProductId()); for (WmsProductBom bom : bomList) { BigDecimal needQty = bom.getQuantity().multiply(detail.getQuantity()); - WmsPurchasePlanDetailVo vo = materialMap.getOrDefault(bom.getRawMaterialId(), new WmsPurchasePlanDetailVo()); + WmsPurchasePlanDetailVo vo = + materialMap.getOrDefault(bom.getRawMaterialId(), new WmsPurchasePlanDetailVo()); vo.setRawMaterialId(bom.getRawMaterialId()); vo.setQuantity(vo.getQuantity() == null ? needQty : vo.getQuantity().add(needQty)); vo.setUnit(bom.getUnit()); - vo.setRawMaterialName(wmsRawMaterialMapper.selectById(bom.getRawMaterialId()).getRawMaterialName()); - vo.setRawMaterialCode(wmsRawMaterialMapper.selectById(bom.getRawMaterialId()).getRawMaterialCode()); + // 挂载原材料名称编号 + WmsRawMaterial wmsRawMaterial = wmsRawMaterialMapper.selectById(bom.getRawMaterialId()); + vo.setRawMaterialName(wmsRawMaterial.getRawMaterialName()); + vo.setRawMaterialCode(wmsRawMaterial.getRawMaterialCode()); materialMap.put(bom.getRawMaterialId(), vo); } } // 3. 查询库存并计算推荐采购量 for (WmsPurchasePlanDetailVo vo : materialMap.values()) { + // 需求量 + vo.setDemand(vo.getQuantity()); BigDecimal stockQty = wmsStockService.getStockByItemId(vo.getRawMaterialId()); - // 要是物料不是产品 - BigDecimal recommendQty = BigDecimal.ZERO; - if (stockQty != null) { - recommendQty = vo.getQuantity().subtract(stockQty); + // 库存量 + if(stockQty == null){ + stockQty = BigDecimal.ZERO; } + vo.setInventory(stockQty); + // 在途量 + BigDecimal onTheWayQty = BigDecimal.ZERO; + BigDecimal byRawMaterialIdAndOnTheWay = + wmsPurchasePlanDetailMapper.getByRawMaterialIdAndOnTheWay(vo.getRawMaterialId()); + if (byRawMaterialIdAndOnTheWay != null) { + onTheWayQty = byRawMaterialIdAndOnTheWay; + } + vo.setOnTheWay(onTheWayQty); + // 计算推荐采购量 + BigDecimal recommendQty = vo.getQuantity().subtract(onTheWayQty).subtract(stockQty); vo.setQuantity(recommendQty.compareTo(BigDecimal.ZERO) > 0 ? recommendQty : BigDecimal.ZERO); } // 4. 组装主VO @@ -182,9 +198,11 @@ public class WmsPurchasePlanServiceImpl implements IWmsPurchasePlanService { */ @Override public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { - if(isValid){ - //TODO 做一些业务上的校验,判断是否需要校验 - } + // 逻辑删除采购明细 + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.in(WmsPurchasePlanDetail::getPlanId, ids); + wmsPurchasePlanDetailMapper.delete(lqw); + // 逻辑删除采购计划主表 return baseMapper.deleteBatchIds(ids) > 0; } } diff --git a/klp-wms/src/main/resources/mapper/klp/WmsPurchasePlanDetailMapper.xml b/klp-wms/src/main/resources/mapper/klp/WmsPurchasePlanDetailMapper.xml index 9fbc2725..619cf68f 100644 --- a/klp-wms/src/main/resources/mapper/klp/WmsPurchasePlanDetailMapper.xml +++ b/klp-wms/src/main/resources/mapper/klp/WmsPurchasePlanDetailMapper.xml @@ -31,5 +31,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${ew.customSqlSegment} + +