diff --git a/HHWMS.Web/Areas/XWMS/Controllers/XWMSSHIPController.cs b/HHWMS.Web/Areas/XWMS/Controllers/XWMSSHIPController.cs index c6b1b4a..049302d 100644 --- a/HHWMS.Web/Areas/XWMS/Controllers/XWMSSHIPController.cs +++ b/HHWMS.Web/Areas/XWMS/Controllers/XWMSSHIPController.cs @@ -17,11 +17,8 @@ namespace HHWMS.Web.Controllers; [ActionDescription("地点间收货")] public class XWMSSHIPController : BaseController { - private readonly IUnitWork _unitWork; - - public XWMSSHIPController(IUnitWork unitWork) + public XWMSSHIPController() { - _unitWork = unitWork; } #region Search @@ -73,11 +70,57 @@ public class XWMSSHIPController : BaseController POHNUM_0 = x.Field("POHNUM_0"), POPLIN_0 = x.Field("POPLIN_0"), LOT_0 = x.Field("LOT_0"), - QTYSTU_0 = x.Field("QTYSTU_0") + QTYSTU_0 = x.Field("QTYSTU_0"), + STATUS = "" } ).ToList(); return JsonMore(list); } #endregion Search + + [HttpPost] + [FixConnection(CsName = "hangyong")] + public ActionResult Create(List 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(); + 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); + } } diff --git a/HHWMS.Web/Areas/XWMS/Views/XWMSPOH/Index.cshtml b/HHWMS.Web/Areas/XWMS/Views/XWMSPOH/Index.cshtml index 903845b..d3a0a24 100644 --- a/HHWMS.Web/Areas/XWMS/Views/XWMSPOH/Index.cshtml +++ b/HHWMS.Web/Areas/XWMS/Views/XWMSPOH/Index.cshtml @@ -394,7 +394,7 @@ _this.loading = false; }, error: function (json) { - this.$message.error("加载失败"); + _this.$message.error("加载失败"); } }); }, @@ -406,11 +406,14 @@ type: 'warning' }).then(() => { //加校验 + if (_this.multipleSelection.length == 0) { + _this.$message.error("至少选择一张单据!"); + return; + } if (_this.verify(_this.multipleSelection)) { _this.$message.error("请选择同一张采购单!"); - } else { - - + return; + } $.ajax({ type: "post", dataType: "json", @@ -431,7 +434,6 @@ _this.$message.error("创建失败!"); } }); - } }).catch(() => { this.$message({ type: 'info', diff --git a/HHWMS.Web/Areas/XWMS/Views/XWMSSHIP/Index.cshtml b/HHWMS.Web/Areas/XWMS/Views/XWMSSHIP/Index.cshtml index 5c8408c..9df0470 100644 --- a/HHWMS.Web/Areas/XWMS/Views/XWMSSHIP/Index.cshtml +++ b/HHWMS.Web/Areas/XWMS/Views/XWMSSHIP/Index.cshtml @@ -52,6 +52,8 @@ @@ -72,7 +74,18 @@ - + +
+ + + + +
{{foodLabel(scope.row.STATUS)}}
+
+
@@ -107,13 +120,24 @@ value: 'SBD', label: 'SBD' }], + options: [{ + value: 'A', + label: 'A' + }, { + value: 'Q', + label: 'Q' + }, { + value: 'R', + label: 'R' + }], + loading: false, tableData: [], currentPage: 1, // 当前页码 total: 20, // 总条数 pageSize: 20, // 每页的数据条数 multipleSelection: [], // 需要编辑的属性 - editProp: ['POHFCY_0'] + editProp: ['STATUS'] }; }, mounted: function () { @@ -134,7 +158,8 @@ computed: { foodLabel() { 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() { var _this = this; + _this.loading = true; $.ajax({ type: "post", dataType: "json", @@ -180,48 +206,63 @@ }, url: "/xwms/XWMSSHIP/Search", success: function (json) { - app.tableData = json.Data; + _this.tableData = json.Data; + _this.loading = false; }, error: function (json) { - alert("加载失败"); + _this.$message.error("加载失败"); + _this.loading = false; } }); }, create() { var _this = this; - - $.ajax({ - type: "post", - dataType: "json", - data: { - data: _this.multipleSelection - }, - url: "/xwms/XWMSSHIP/Create", - success: function (json) { - if (json.Code == 200) { - _this.$message({ - message: "创建成功!" - }); - _this.$refs.multipleTable.clearSelection(); - } - }, - error: function (json) { - alert("加载失败"); + _this.$confirm('注意:您确认要对此单据进行创建采购入库吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + //加校验 + if (_this.multipleSelection.length == 0) { + _this.$message.error("至少选择一张单据!"); + return; } + 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) { - const seen = new Set(); - - for(let i = 0; i tmp.add(x.POHNUM_0)); + return tmp.size > 1 ? true : false; } }, }); diff --git a/HHWMS.Web/Models/XWMS/XWMSSHIP.cs b/HHWMS.Web/Models/XWMS/XWMSSHIP.cs new file mode 100644 index 0000000..12d4a97 --- /dev/null +++ b/HHWMS.Web/Models/XWMS/XWMSSHIP.cs @@ -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; } + } +}