地点间收货

This commit is contained in:
zgf committed 2023-12-24 15:53:22 +08:00
1 parent 6aeb151982
commit f327041e9a
4 files changed
+162 -45

No files matched your search

@@ -17,11 +17,8 @@ namespace HHWMS.Web.Controllers;
[ActionDescription("地点间收货")] [ActionDescription("地点间收货")]
public class XWMSSHIPController : BaseController public class XWMSSHIPController : BaseController
{ {
private readonly IUnitWork _unitWork; public XWMSSHIPController()
public XWMSSHIPController(IUnitWork unitWork)
{ {
_unitWork = unitWork;
} }
#region Search #region Search
@@ -73,11 +70,57 @@ public class XWMSSHIPController : BaseController
POHNUM_0 = x.Field<string>("POHNUM_0"), POHNUM_0 = x.Field<string>("POHNUM_0"),
POPLIN_0 = x.Field<Int64>("POPLIN_0"), POPLIN_0 = x.Field<Int64>("POPLIN_0"),
LOT_0 = x.Field<string>("LOT_0"), LOT_0 = x.Field<string>("LOT_0"),
QTYSTU_0 = x.Field<decimal>("QTYSTU_0") QTYSTU_0 = x.Field<decimal>("QTYSTU_0"),
STATUS = ""
} }
).ToList(); ).ToList();
return JsonMore(list); return JsonMore(list);
} }
#endregion Search #endregion Search
[HttpPost]
[FixConnection(CsName = "hangyong")]
public ActionResult Create(List<XWMSSHIP> data)
{
var _unitwork = new UnitWork(Wtm);
var receipt = new ReceiptHeader2();
receipt.Code = _unitwork.GetSerialNumber("CGR");
receipt.SourceCode = data.FirstOrDefault().POHNUM_0;
receipt.SupplierCode = data.FirstOrDefault().STOFCY_0;
receipt.SupplierName = data.FirstOrDefault().BPRNAM_0;
receipt.Type = "DDS";
receipt.FirstStatus = 0;
receipt.AppointmentTime = data.FirstOrDefault().SHIDAT_0;
receipt.UserDef2 = data.FirstOrDefault().FCY_0;
_unitwork.Add(receipt);
var detailList = new List<ReceiptDetail2>();
foreach (var item in data)
{
var detail = new ReceiptDetail2();
detail.ZoneCode = "L";
detail.ReceiptId = receipt.ID;
detail.ReceiptCode = receipt.Code;
detail.SourceCode = item.SDHNUM_0;
detail.SourceLine = item.SDDLIN_0.ToString();
detail.MaterialCode = item.ITMREF_0;
detail.MaterialName = item.ITMDES1_0;
detail.Lot = item.ITMDES2_0;
detail.Qty = item.QTYSTU_0;
detail.Unit = item.SAU_0;
detail.PurchasQty = item.QTY_0;
detail.PurchasUnits = item.SAU_0;
detail.InventoryStatus = item.STATUS;
detail.Batch = item.LOT_0;
detail.Status = 0;
detail.CreateTime = DateTime.Now;
detailList.Add(detail);
}
_unitwork.BatchAdd(detailList.ToArray());
return JsonMore(null);
}
} }
@@ -394,7 +394,7 @@
_this.loading = false; _this.loading = false;
}, },
error: function (json) { error: function (json) {
this.$message.error("加载失败"); _this.$message.error("加载失败");
} }
}); });
}, },
@@ -406,11 +406,14 @@
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
//加校验 //加校验
if (_this.multipleSelection.length == 0) {
_this.$message.error("至少选择一张单据!");
return;
}
if (_this.verify(_this.multipleSelection)) { if (_this.verify(_this.multipleSelection)) {
_this.$message.error("请选择同一张采购单!"); _this.$message.error("请选择同一张采购单!");
} else { return;
}
$.ajax({ $.ajax({
type: "post", type: "post",
dataType: "json", dataType: "json",
@@ -431,7 +434,6 @@
_this.$message.error("创建失败!"); _this.$message.error("创建失败!");
} }
}); });
}
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
@@ -52,6 +52,8 @@
<el-table :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)" height="650" stripe border <el-table :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)" height="650" stripe border
style="width: 100%" style="width: 100%"
size="small" size="small"
ref="tableData"
v-loading="loading"
@@cell-mouse-enter="handleCellEnter" @@cell-mouse-enter="handleCellEnter"
@@cell-mouse-leave="handleCellLeave" @@cell-mouse-leave="handleCellLeave"
@@selection-change="handleSelectionChange"> @@selection-change="handleSelectionChange">
@@ -72,7 +74,18 @@
<el-table-column label="数量" width="100" align="center" prop="QTY_0" show-overflow-tooltip></el-table-column> <el-table-column label="数量" width="100" align="center" prop="QTY_0" show-overflow-tooltip></el-table-column>
<el-table-column label="批次" width="150" align="center" prop="LOT_0"></el-table-column> <el-table-column label="批次" width="150" align="center" prop="LOT_0"></el-table-column>
<el-table-column label="批次数量" width="100" align="center" prop="QTYSTU_0"></el-table-column> <el-table-column label="批次数量" width="100" align="center" prop="QTYSTU_0"></el-table-column>
<el-table-column label="库存状态" width="100" align="center" prop="STATUS"></el-table-column> <el-table-column label="库存状态" width="100" align="center" prop="STATUS">
<div class="item" slot-scope="scope">
<el-select class="item__input" v-model="scope.row.STATUS" placeholder="请选择">
<el-option v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<div class="item__txt">{{foodLabel(scope.row.STATUS)}}</div>
</div>
</el-table-column>
<el-table-column label="销售单位" width="100" align="center" prop="SAU_0"></el-table-column> <el-table-column label="销售单位" width="100" align="center" prop="SAU_0"></el-table-column>
<el-table-column label="采购订单号" width="180" align="center" prop="POHNUM_0"></el-table-column> <el-table-column label="采购订单号" width="180" align="center" prop="POHNUM_0"></el-table-column>
<el-table-column label="订单行号" width="100" align="center" prop="POPLIN_0"></el-table-column> <el-table-column label="订单行号" width="100" align="center" prop="POPLIN_0"></el-table-column>
@@ -107,13 +120,24 @@
value: 'SBD', value: 'SBD',
label: 'SBD' label: 'SBD'
}], }],
options: [{
value: 'A',
label: 'A'
}, {
value: 'Q',
label: 'Q'
}, {
value: 'R',
label: 'R'
}],
loading: false,
tableData: [], tableData: [],
currentPage: 1, // 当前页码 currentPage: 1, // 当前页码
total: 20, // 总条数 total: 20, // 总条数
pageSize: 20, // 每页的数据条数 pageSize: 20, // 每页的数据条数
multipleSelection: [], multipleSelection: [],
// 需要编辑的属性 // 需要编辑的属性
editProp: ['POHFCY_0'] editProp: ['STATUS']
}; };
}, },
mounted: function () { mounted: function () {
@@ -134,7 +158,8 @@
computed: { computed: {
foodLabel() { foodLabel() {
return (val) => { return (val) => {
return this.options.find(o => o.value === val).label if(val!="")
return this.options.find(o => o.value === val).label
} }
} }
}, },
@@ -169,6 +194,7 @@
}, },
search() { search() {
var _this = this; var _this = this;
_this.loading = true;
$.ajax({ $.ajax({
type: "post", type: "post",
dataType: "json", dataType: "json",
@@ -180,48 +206,63 @@
}, },
url: "/xwms/XWMSSHIP/Search", url: "/xwms/XWMSSHIP/Search",
success: function (json) { success: function (json) {
app.tableData = json.Data; _this.tableData = json.Data;
_this.loading = false;
}, },
error: function (json) { error: function (json) {
alert("加载失败"); _this.$message.error("加载失败");
_this.loading = false;
} }
}); });
}, },
create() { create() {
var _this = this; var _this = this;
_this.$confirm('注意:您确认要对此单据进行创建采购入库吗?', '提示', {
$.ajax({ confirmButtonText: '确定',
type: "post", cancelButtonText: '取消',
dataType: "json", type: 'warning'
data: { }).then(() => {
data: _this.multipleSelection //加校验
}, if (_this.multipleSelection.length == 0) {
url: "/xwms/XWMSSHIP/Create", _this.$message.error("至少选择一张单据!");
success: function (json) { return;
if (json.Code == 200) {
_this.$message({
message: "创建成功!"
});
_this.$refs.multipleTable.clearSelection();
}
},
error: function (json) {
alert("加载失败");
} }
if (_this.verify(_this.multipleSelection)) {
_this.$message.error("请选择同一张采购单!");
return;
}
$.ajax({
type: "post",
dataType: "json",
data: {
data: _this.multipleSelection
},
url: "/xwms/XWMSSHIP/Create",
success: function (json) {
if (json.Code == 200) {
_this.$message("创建成功!");
_this.$refs.tableData.clearSelection();
}
else {
_this.$message.error("创建失败!" + json.Msg);
}
},
error: function (json) {
_this.$message.error("创建失败!");
}
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消!'
});
}); });
}, },
hasDuplicate(array) { verify(array) {
const seen = new Set(); const tmp = new Set();
array.forEach(x => tmp.add(x.POHNUM_0));
for(let i = 0; i<array.length; i++) { return tmp.size > 1 ? true : false;
const objString = JSON.stringify(array[i]);
if (seen.has(objString)) {
return true;
}
seen.add(objString);
}
return false;
} }
}, },
}); });
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Text;
using WalkingTec.Mvvm.Core;
namespace HHWMS.Web.Models
{
public class XWMSSHIP : TopBasePoco
{
public string SDHNUM_0 { get; set; }
public string FCY_0 { get; set; }
public string STOFCY_0 { get; set; }
public string BPRNAM_0 { get; set; }
public DateTime SHIDAT_0 { get; set; }
public int SDDLIN_0 { get; set; }
public string ITMREF_0 { get; set; }
public string ITMDES1_0 { get; set; }
public string ITMDES2_0 { get; set; }
public string ITMDES3_0 { get; set; }
public string YITMDES4_0 { get; set; }
public decimal QTY_0 { get; set; }
public string SAU_0 { get; set; }
public string POHNUM_0 { get; set; }
public int POPLIN_0 { get; set; }
public string LOT_0 { get; set; }
public decimal QTYSTU_0 { get; set; }
public string STATUS { get; set; }
}
}