From 550ae4989da1ce9ca874a00aec7423d252b67a27 Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 02 十二月 2025 08:25:21 +0800
Subject: [PATCH] 提交
---
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue | 346 ++++++++++++++++++++++++++++++++++++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs | 24 ++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs | 49 ++++-
项目代码/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue | 3
项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue | 2
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/WIDESEA_StockService.csproj | 1
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs | 2
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 51 +++++
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs | 41 +++-
9 files changed, 489 insertions(+), 30 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue"
new file mode 100644
index 0000000..4733980
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/AllocateStockSelect.vue"
@@ -0,0 +1,346 @@
+<template>
+ <div>
+ <vol-box
+ v-model="showDetialBox"
+ :lazy="true"
+ width="60%"
+ :padding="15"
+ title="鎸囧畾搴撳瓨"
+ >
+ <div class="box-head">
+ <el-alert :closable="false" style="width: 100%">
+ <el-row>
+ <el-col :span="16">
+ <span class="less-style">鐗╂枡鍚嶇О锛� {{ row.materielName }} </span>
+ <el-divider direction="vertical"></el-divider>
+ <span class="less-style">鐗╂枡缂栧彿锛� {{ row.materielCode }} </span>
+ <el-divider direction="vertical"></el-divider>
+ <span class="less-style">闇�姹傛暟閲忥細 {{ row.orderQuantity }} </span>
+ <el-divider direction="vertical"></el-divider>
+ <span :class="selectionClass">宸查�夋暟閲忥細 {{ selectionSum }} </span>
+ </el-col>
+ <el-col :span="8">
+ <el-link
+ type="primary"
+ size="small"
+ style="float: right; height: 20px; margin-right: 10px"
+ @click="getData"
+ >鍒锋柊</el-link
+ >
+ <el-link
+ type="primary"
+ size="small"
+ style="float: right; height: 20px; margin-right: 10px"
+ @click="openOutboundDialog"
+ >鐩存帴鍑哄簱</el-link
+ >
+ </el-col>
+ </el-row>
+ </el-alert>
+ </div>
+ <div class="box-table" style="margin-top: 1%">
+ <el-table
+ ref="singleTable"
+ :data="tableData"
+ style="width: 100%; height: 100%"
+ highlight-current-row
+ @row-click="handleRowClick"
+ height="500px"
+ @selection-change="handleSelectionChange"
+ >
+ <el-table-column type="selection" width="55"> </el-table-column>
+ <el-table-column
+ label="搴忓彿"
+ type="index"
+ fixed="left"
+ width="55"
+ align="center"
+ ></el-table-column>
+ <el-table-column
+ v-for="(item, index) in tableColumns.filter((x) => !x.hidden)"
+ :key="index"
+ :prop="item.prop"
+ :label="item.title"
+ :width="item.width"
+ align="center"
+ >
+ <template #default="scoped" v-if="item.type == 'icon'">
+ <el-tooltip
+ class="item"
+ effect="dark"
+ :content="item.title"
+ placement="bottom"
+ ><el-button
+ type="text"
+ @click="tableButtonClick(scoped.row, item)"
+ ><i :class="item.icon" style="font-size: 22px"></i></el-button
+ ></el-tooltip>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ <template #footer>
+ <el-button type="danger" size="small" @click="showDetialBox = false"
+ >鍏抽棴</el-button
+ >
+ </template>
+ </vol-box>
+
+ <!-- 鍑哄簱绔欏彴閫夋嫨寮圭獥锛堥潤鎬佹ā鏉垮疄鐜帮級 -->
+ <el-dialog
+ v-model="showOutboundDialog"
+ title="鍑哄簱鎿嶄綔 - 閫夋嫨鍑哄簱绔欏彴"
+ width="500px"
+ :append-to-body="true"
+ >
+ <el-form
+ :model="outboundForm"
+ :rules="outboundRules"
+ ref="outboundFormRef"
+ label-width="100px"
+ style="padding: 0 20px"
+ >
+ <el-form-item label="鍑哄簱绔欏彴" prop="selectedPlatform" style="margin-bottom: 24px">
+ <el-select
+ v-model="outboundForm.selectedPlatform"
+ placeholder="璇烽�夋嫨鍑哄簱绔欏彴锛�3-12锛�"
+ style="width: 100%; height: 40px"
+ >
+ <el-option
+ v-for="platform in platformOptions"
+ :key="platform.value"
+ :label="platform.label"
+ :value="platform.value"
+ ></el-option>
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <el-button @click="showOutboundDialog = false" style="margin-right: 8px">鍙栨秷</el-button>
+ <el-button type="primary" @click="confirmOutbound">纭畾鍑哄簱</el-button>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script>
+import VolBox from "@/components/basic/VolBox.vue";
+import { ElMessage } from "element-plus";
+
+export default {
+ components: { VolBox },
+ data() {
+ return {
+ row: null,
+ showDetialBox: false,
+ tableData: [],
+ tableColumns: [
+ { prop: "materielCode", title: "鐗╂枡缂栧彿", type: "string", width: 150 },
+ { prop: "barcode", title: "鐗╂枡鏉$爜", type: "string", width: 150 },
+ { prop: "palletCode", title: "鎵樼洏缂栧彿", type: "string", width: 150 },
+ { prop: "locationCode", title: "璐т綅缂栧彿", type: "string", width: 180 },
+ { prop: "useableQuantity", title: "鍙敤鏁伴噺", type: "string" },
+ ],
+ selection: [],
+ selectionSum: 0,
+ selectionClass: "less-style",
+ originalQuantity: 0,
+
+ // 鍑哄簱寮圭獥鐩稿叧鏁版嵁
+ showOutboundDialog: false,
+ outboundForm: { selectedPlatform: "" }, // 琛ㄥ崟缁戝畾鏁版嵁
+ outboundRules: {
+ selectedPlatform: [
+ { required: true, message: "璇烽�夋嫨鍑哄簱绔欏彴", trigger: "change" },
+ ],
+ },
+ platformOptions: [
+ { label: "绔欏彴2", value: "2-1" },
+ { label: "绔欏彴3", value: "3-1" },
+ ],
+ };
+ },
+ methods: {
+ open(row) {
+ this.row = row;
+ this.showDetialBox = true;
+ this.getData();
+ this.updateSelectionClass(); // 鍒濆鍖栧凡閫夋暟閲忔牱寮�
+ },
+
+ lockStock() {
+ this.http
+ .post(
+ "api/OutboundOrderDetail/LockOutboundStock?id=" + this.row.id,
+ this.selection,
+ "鏁版嵁澶勭悊涓�"
+ )
+ .then((x) => {
+ if (!x.status) return ElMessage.error(x.message);
+ ElMessage.success("鎿嶄綔鎴愬姛");
+ this.showDetialBox = false;
+ this.$emit("parentCall", ($vue) => {
+ $vue.getData();
+ });
+ });
+ },
+
+ // 鎵撳紑鍑哄簱寮圭獥
+ openOutboundDialog() {
+ if (this.selection.length === 0) {
+ return ElMessage.error("璇烽�夋嫨鍗曟嵁鏄庣粏");
+ }
+ // 閲嶇疆琛ㄥ崟閬垮厤娈嬬暀鍊�
+ this.outboundForm.selectedPlatform = "";
+ this.showOutboundDialog = true;
+ },
+
+ // 纭鍑哄簱鎿嶄綔
+ confirmOutbound() {
+ this.$refs.outboundFormRef.validate((valid) => {
+ if (!valid) return;
+
+
+ if (this.selection.length <= 0) {
+ return this.$message.error("璇峰嬀閫�");
+ }
+ let url = this.pkcx
+ ? "api/Task/GenerateOutboundTask?orderDetailId="
+ : "api/Task/GenerateOutboundTask?orderDetailId=";
+ this.http
+ .post(url + this.row.id, this.selection, "鏁版嵁澶勭悊涓�")
+ .then((x) => {
+ if (!x.status) return this.$message.error(x.message);
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.showDetialBox = false;
+ this.$emit("parentCall", ($vue) => {
+ $vue.getData();
+ });
+ });
+
+ });
+ },
+
+ // 鍥哄畾鏌ヨ绔嬪簱搴撳瓨
+ getData() {
+ const url = "api/StockInfo/GetAllocateStockSelect?materielCode=";
+ this.http
+ .post(
+ url + this.row.materielCode + "&orderId=" + this.row.orderId,
+ null,
+ "鏌ヨ涓�"
+ )
+ .then((x) => {
+ this.tableData = x;
+ // 鍒锋柊鍚庢竻绌轰箣鍓嶇殑閫夋嫨鍜岃鏁�
+ this.clearSelection();
+ this.selectionSum = 0;
+ this.originalQuantity = 0;
+ this.updateSelectionClass();
+ });
+ },
+
+ revokeAssign() {
+ this.http
+ .post(
+ "api/OutboundOrderDetail/RevokeLockOutboundStock?id=" + this.row.id,
+ null,
+ "鏁版嵁澶勭悊涓�"
+ )
+ .then((x) => {
+ if (!x.status) return ElMessage.error(x.message);
+ ElMessage.success("鎿嶄綔鎴愬姛");
+ this.showDetialBox = false;
+ this.$emit("parentCall", ($vue) => {
+ $vue.getData();
+ });
+ });
+ },
+
+ handleSelectionChange(val) {
+ this.selection = val;
+ // 璁$畻宸查�夋暟閲忥紙杞暟瀛楅伩鍏嶅瓧绗︿覆鎷兼帴锛�
+ this.selectionSum = val.reduce(
+ (acc, curr) => acc + Number(curr.useableQuantity || 0),
+ 0
+ ) + this.originalQuantity;
+ this.updateSelectionClass();
+ },
+
+ // 鏇存柊宸查�夋暟閲忔牱寮�
+ updateSelectionClass() {
+ if (!this.row) return;
+ if (this.selectionSum === this.row.orderQuantity) {
+ this.selectionClass = "equle-style";
+ } else if (this.selectionSum < this.row.orderQuantity) {
+ this.selectionClass = "less-style";
+ } else {
+ this.selectionClass = "more-style";
+ }
+ },
+
+ toggleSelection(rows) {
+ rows ? rows.forEach((row) => this.$refs.singleTable.toggleRowSelection(row)) : this.clearSelection();
+ },
+
+ clearSelection() {
+ if (this.$refs.singleTable) {
+ this.$refs.singleTable.clearSelection();
+ }
+ },
+
+ handleRowClick(row) {
+ this.$refs.singleTable.toggleRowSelection(row);
+ },
+
+ // 鍥炬爣鎸夐挳鐐瑰嚮鍗犱綅鏂规硶锛堝彲鏍规嵁闇�姹傛墿灞曪級
+ tableButtonClick(row, item) {
+ console.log("鍥炬爣鎸夐挳鐐瑰嚮锛�", item.title, row);
+ },
+ },
+};
+</script>
+
+<style scoped>
+.less-style {
+ color: black;
+}
+
+.equle-style {
+ color: green;
+}
+
+.more-style {
+ color: red;
+}
+</style>
+
+<style>
+.text-button:hover {
+ background-color: #f0f9eb !important;
+}
+
+.el-table .warning-row {
+ background: oldlace;
+}
+
+.box-table .el-table tbody tr:hover > td {
+ background-color: #d8e0d4 !important;
+}
+
+.box-table .el-table tbody tr.current-row > td {
+ background-color: #f0f9eb !important;
+}
+
+.el-table .success-row {
+ background: #f0f9eb;
+}
+
+.box-table .el-table {
+ border: 1px solid #ebeef5;
+}
+
+.box-head .el-alert__content {
+ width: 100%;
+}
+</style>
\ No newline at end of file
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue"
index f685705..67fec1f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/allocateOrderDetail.vue"
@@ -108,7 +108,7 @@
<script>
import VolBox from "@/components/basic/VolBox.vue";
import VolForm from "@/components/basic/VolForm.vue";
-import StockSelect from "./StockSelect.vue";
+import StockSelect from "./AllocateStockSelect.vue";
import SelectedStock from "./SelectedStock.vue";
import { h,createVNode, render,reactive } from 'vue';
import { ElDialog , ElForm, ElFormItem, ElSelect,ElOption, ElButton, ElMessage } from 'element-plus';
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
index 8649eec..b73d987 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
@@ -592,6 +592,9 @@
});
if (res.status) {
+ if(res.data && res.data.length>0){
+ this.$refs.childs.open(res.data);
+ }
this.splitForm.materielCode = res.data.materielCode;
this.splitForm.maxQuantity = res.data.remainQuantity;
this.splitForm.splitQuantity = Math.min(1, this.splitForm.maxQuantity);
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs"
index 1ce63f5..d6d8cc2 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs"
@@ -1,4 +1,5 @@
-锘縰sing Microsoft.Extensions.Logging;
+锘縰sing Dm.filter;
+using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Org.BouncyCastle.Asn1.Ocsp;
using SqlSugar;
@@ -36,11 +37,11 @@
private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
private readonly IRepository<Dt_StockInfo> _stockInfoRepository;
private readonly IRepository<Dt_InboundOrder> _inboundOrderRepository;
-
+ private readonly IMaterialUnitService _materialUnitService;
private readonly IOutboundOrderService _outboundOrderService;
private readonly IOutboundOrderDetailService _outboundOrderDetailService;
private readonly IOutStockLockInfoService _outStockLockInfoService;
- public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService)
+ public InvokeMESService(IHttpClientFactory httpClientFactory, ILogger<InvokeMESService> logger, IRepository<Dt_FeedbackToMes> feedbacktomesRepository, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService, IOutStockLockInfoService outStockLockInfoService, IMaterialUnitService materialUnitService)
{
_httpClientFactory = httpClientFactory;
_logger = logger;
@@ -51,6 +52,7 @@
_outboundOrderService = outboundOrderService;
_outboundOrderDetailService = outboundOrderDetailService;
_outStockLockInfoService = outStockLockInfoService;
+ _materialUnitService = materialUnitService;
}
/// <summary>
@@ -429,7 +431,6 @@
.Where(x => x.OrderNo == orderNo && detailids.Contains(x.OrderDetailId) &&
x.Status == (int)OutLockStockStatusEnum.鎷i�夊畬鎴�)
.ToListAsync();
-
var detailModel = new FeedbackOutboundDetailsModel
{
materialCode = detail.MaterielCode,
@@ -438,16 +439,32 @@
qty = detail.BarcodeQty, // 浣跨敤璁㈠崟鏄庣粏鐨勫凡鍑哄簱鏁伴噺
currentDeliveryQty = detail.BarcodeQty,
unit = detail.BarcodeUnit,
- barcodes = detailLocks.Select(lockInfo => new WIDESEA_DTO.Outbound.BarcodesModel
- {
- barcode = lockInfo.CurrentBarcode,
- supplyCode = lockInfo.SupplyCode,
- batchNo = lockInfo.BatchNo,
- unit = lockInfo.BarcodeUnit,
- qty = lockInfo.BarcodeQty // 鏉$爜绾у埆鐨勬暟閲忎粛鐢ㄩ攣瀹氳褰�
- }).ToList()
+ barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel> ()
};
+ if (detailLocks.Any(x => x.BarcodeUnit != x.Unit))
+ {
+ foreach (var item in detailLocks)
+ {
+ var barmodel = new WIDESEA_DTO.Outbound.BarcodesModel
+ {
+ barcode = item.CurrentBarcode,
+ supplyCode = item.SupplyCode,
+ batchNo = item.BatchNo,
+ unit = item.BarcodeUnit,
+ qty = item.BarcodeQty // 鏉$爜绾у埆鐨勬暟閲忎粛鐢ㄩ攣瀹氳褰�
+ };
+ if (item.BarcodeUnit != item.Unit)
+ {
+ var issueoStockResult = await _materialUnitService.ConvertAsync(item.MaterielCode, item.BarcodeQty, item.Unit,item.BarcodeUnit);
+ barmodel.unit = issueoStockResult.Unit;
+ barmodel.qty = issueoStockResult.Quantity;
+ }
+ detailModel.qty = barmodel.qty;
+ detailModel.currentDeliveryQty = barmodel.qty;
+ detailModel.barcodes.Add(barmodel);
+ }
+ }
feedmodel.details.Add(detailModel);
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs"
index c6e7d33..5a208d0 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs"
@@ -21,5 +21,7 @@
List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode);
List<StockSelectViewDTO> GetSelectViewDTOs(string orderNo, string materielCode);
+
+ List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, string materielCode);
}
}
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
index 3142415..c294770 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs"
@@ -1,5 +1,6 @@
锘縰sing Autofac.Core;
using AutoMapper;
+using MailKit.Search;
using SqlSugar;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.StockEnum;
@@ -7,6 +8,7 @@
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Stock;
+using WIDESEA_IAllocateService;
using WIDESEA_IBasicService;
using WIDESEA_IOutboundService;
using WIDESEA_IRecordService;
@@ -24,14 +26,17 @@
private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
private readonly IOutboundOrderService _outboundOrderService;
//private readonly IOutboundOrderDetailService _outboundOrderDetailService;
+
+ private readonly IRepository<Dt_AllocateOrder> _allocateRepository;
private readonly ILocationInfoService _locationInfoService;
- public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService) : base(BaseDal)
+ public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService, IRepository<Dt_AllocateOrder> allocateRepository) : base(BaseDal)
{
_mapper = mapper;
_stockInfoDetailRepository = stockInfoDetailRepository;
_recordService = recordService;
_locationInfoService = locationInfoService;
_outboundOrderService = outboundOrderService;
+ _allocateRepository = allocateRepository;
//_outboundOrderDetailService = outboundOrderDetailService;
}
@@ -119,7 +124,7 @@
if (stockTotalQuantity < needQuantity)
{
residueQuantity = needQuantity - stockTotalQuantity;
-
+
}
else
{
@@ -156,7 +161,7 @@
residueQuantity = remainingNeed;
return (outStocks, stockAllocations);
}
-
+
/// <summary>
/// 鏍规嵁鏉$爜鑾峰彇搴撳瓨淇℃伅
/// </summary>
@@ -187,7 +192,7 @@
public List<Dt_StockInfo> GetStockInfos(string materielCode, string lotNo, string supplyCode, List<string> locationCodes)
{
var query = Db.Queryable<Dt_StockInfo>()
- .Where(x => locationCodes.Contains(x.LocationCode) && x.StockStatus==StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()
+ .Where(x => locationCodes.Contains(x.LocationCode) && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()
// && x.StockStatus == (int)StockStatusEmun.姝e父)
).Includes(x => x.Details);
@@ -204,9 +209,9 @@
if (!string.IsNullOrEmpty(supplyCode))
{
query = query.Where(x => x.Details.Any(d => d.SupplyCode == supplyCode));
- }
+ }
- return query.OrderBy(x => x.CreateDate).ToList();
+ return query.OrderBy(x => x.CreateDate).ToList();
//ISugarQueryable<Dt_LocationInfo> sugarQueryable = Db.Queryable<Dt_LocationInfo>().Where(x => locationCodes.Contains(x.LocationCode));
//ISugarQueryable<Dt_StockInfo> sugarQueryable1 = Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.Details.Any(v => v.MaterielCode == materielCode));
//return sugarQueryable.InnerJoin(sugarQueryable1, (a, b) => a.LocationCode == b.LocationCode).Select((a, b) => b).OrderBy(a => a.CreateDate).Includes(a => a.Details).ToList();
@@ -216,7 +221,7 @@
{
List<string> locationCodes = _locationInfoService.GetCanOutLocationCodes();
- return GetStockInfos(materielCode, batchNo,supplyCode, locationCodes);
+ return GetStockInfos(materielCode, batchNo, supplyCode, locationCodes);
}
public Dt_StockInfo GetPalletStockInfo(int locationType)
@@ -279,11 +284,29 @@
// return null;
// }
- //}
- public List<StockSelectViewDTO> GetSelectViewDTOs(string orderNo,string materielCode)
+ //}
+
+ public List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, string materielCode)
+ {
+ var dballocate = _allocateRepository.Db.Queryable<Dt_AllocateOrder>().First(x => x.Id == orderId);
+ if (dballocate == null)
+ {
+ throw new Exception($"鏈壘鍒板崟鎹紪鍙蜂负{dballocate.OrderNo}鐨勫崟淇℃伅");
+
+ }
+
+ var outboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Where(x => x.OrderNo == dballocate.OrderNo).First();
+ if (outboundOrder == null)
+ {
+ throw new Exception($"鏈壘鍒板崟鎹紪鍙蜂负{dballocate.OrderNo}鐨勫嚭搴撳崟淇℃伅");
+ }
+ return GetStockSelectViews(outboundOrder.Id, materielCode);
+ }
+
+ public List<StockSelectViewDTO> GetSelectViewDTOs(string orderNo, string materielCode)
{
var outboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == orderNo).First();
- if(outboundOrder == null)
+ if (outboundOrder == null)
{
throw new Exception($"鏈壘鍒板崟鎹紪鍙蜂负{orderNo}鐨勫嚭搴撳崟淇℃伅");
}
@@ -319,7 +342,7 @@
.Includes(x => x.Details);
// 鎵ц鏌ヨ骞舵寜鍏堣繘鍏堝嚭鎺掑簭
- var Qstocks = stockQuery.Where(x => x.Details.Any(d => d.MaterielCode == materielCode &&d.StockQuantity > d.OutboundQuantity));
+ var Qstocks = stockQuery.Where(x => x.Details.Any(d => d.MaterielCode == materielCode && d.StockQuantity > d.OutboundQuantity));
if (!string.IsNullOrEmpty(orderDetail.BatchNo))
{
@@ -334,7 +357,7 @@
}
- var stocks= Qstocks.OrderBy(x => x.CreateDate) .ToList();
+ var stocks = Qstocks.OrderBy(x => x.CreateDate).ToList();
foreach (var stock in stocks)
{
@@ -353,7 +376,7 @@
result.Add(new StockSelectViewDTO
{
LocationCode = stock.LocationCode,
- MaterielCode = firstDetail. MaterielCode,
+ MaterielCode = firstDetail.MaterielCode,
MaterielName = firstDetail.MaterielName,
BatchNo = orderDetail.BatchNo,
SupplyCode = orderDetail.SupplyCode,
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/WIDESEA_StockService.csproj" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/WIDESEA_StockService.csproj"
index eb20a18..48c1140 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/WIDESEA_StockService.csproj"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/WIDESEA_StockService.csproj"
@@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
+ <ProjectReference Include="..\WIDESEA_IAllocateService\WIDESEA_IAllocateService.csproj" />
<ProjectReference Include="..\WIDESEA_IBasicService\WIDESEA_IBasicService.csproj" />
<ProjectReference Include="..\WIDESEA_IOutboundService\WIDESEA_IOutboundService.csproj" />
<ProjectReference Include="..\WIDESEA_IRecordService\WIDESEA_IRecordService.csproj" />
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 04a0dbf..8962cac 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -27,6 +27,7 @@
using System.Reflection.Emit;
using System.Threading.Tasks;
using System.Xml.Linq;
+using WIDESEA_Common.AllocateEnum;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.LocationEnum;
using WIDESEA_Common.OrderEnum;
@@ -285,7 +286,7 @@
{
ReqCode = Guid.NewGuid().ToString(),
ReqTime = DateTime.Now.ToString(),
- BusinessType = "3",
+ BusinessType = BusinessTypeEnum.澶栭儴浠撳簱璋冩櫤浠�.ObjToInt().ToString(),
FactoryArea = inboundOrder.FactoryArea,
OperationType = 1,
Operator = inboundOrder.Operator,
@@ -311,7 +312,7 @@
Qty = row.BarcodeQty,
BatchNo = row.BatchNo,
SupplyCode = row.SupplyCode,
- Unit = row.Unit
+ Unit = row.BarcodeUnit
}).ToList()
}).ToList();
allocatefeedmodel.Details = groupedData;
@@ -334,7 +335,53 @@
{
_logger.LogInformation($"InboundTaskCompleted 鍥炲啓MES : {inboundOrder.InboundOrderNo } ,ordertype: {InOrderTypeEnum.InternalAllocat.ObjToInt()} " );
// BusinessTypeEnum.鏅轰粨璋冩櫤浠�
+ if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
+ {
+ var allocate = _allocateService.Repository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo).First();
+ var allocatefeedmodel = new AllocateDto
+ {
+ ReqCode = Guid.NewGuid().ToString(),
+ ReqTime = DateTime.Now.ToString(),
+ BusinessType = BusinessTypeEnum.鏅轰粨璋冩櫤浠�.ObjToInt().ToString(),
+ FactoryArea = inboundOrder.FactoryArea,
+ OperationType = 1,
+ Operator = inboundOrder.Operator,
+ OrderNo = inboundOrder.UpperOrderNo,
+ fromWarehouse = allocate?.FromWarehouse ?? "",
+ toWarehouse = allocate?.ToWarehouse ?? "",
+ Details = new List<AllocateDtoDetail>()
+ };
+
+ var groupedData = inboundOrder.Details.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
+ .Select(group => new AllocateDtoDetail
+ {
+ MaterialCode = group.Key.MaterielCode,
+ LineNo = group.Key.lineNo,
+ WarehouseCode = group.Key.WarehouseCode,
+ Qty = group.Sum(x => x.BarcodeQty),
+ // warehouseCode= "1072",
+ Unit = group.Key.BarcodeUnit,
+ Barcodes = group.Select(row => new BarcodeInfo
+ {
+ Barcode = row.Barcode,
+ Qty = row.BarcodeQty,
+ BatchNo = row.BatchNo,
+ SupplyCode = row.SupplyCode,
+ Unit = row.BarcodeUnit
+ }).ToList()
+ }).ToList();
+ allocatefeedmodel.Details = groupedData;
+
+ var result = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
+ if (result != null && result.code == 200)
+ {
+ _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
+ .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
+ _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
+ .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
+ }
+ }
}
else
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs"
index 880b502..7759dcc 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs"
@@ -25,7 +25,7 @@
/// <param name="orderId"></param>
/// <param name="materielCode"></param>
/// <returns></returns>
- [HttpPost, HttpGet, Route("GetStockSelectViews"),AllowAnonymous]
+ [HttpPost, HttpGet, Route("GetStockSelectViews"), AllowAnonymous]
public List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode)
{
return Service.GetStockSelectViews(orderId, materielCode);
@@ -44,10 +44,30 @@
{
return Service.GetSelectViewDTOs(orderNo, materielCode);
}
- catch(Exception ex)
+ catch (Exception ex)
{
return new List<StockSelectViewDTO>();
}
}
+
+ /// <summary>
+ /// /
+ /// </summary>
+ /// <param name="orderNo"></param>
+ /// <param name="materielCode"></param>
+ /// <returns></returns>
+ [HttpPost, HttpGet, Route("GetAllocateStockSelect"), AllowAnonymous]
+ public List<StockSelectViewDTO> GetAllocateSelectViewDTOs(int orderId, string materielCode)
+ {
+ try
+ {
+ return Service.GetAllocateSelectViewDTOs(orderId, materielCode);
+ }
+ catch (Exception ex)
+ {
+ return new List<StockSelectViewDTO>();
+ }
+ }
+
}
}
--
Gitblit v1.9.3