地点间收货
This commit is contained in:
1 parent
6aeb151982
commit
f327041e9a
4 files changed
+162
-45
No files matched your search
@@ -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<string>("POHNUM_0"),
|
||||
POPLIN_0 = x.Field<Int64>("POPLIN_0"),
|
||||
LOT_0 = x.Field<string>("LOT_0"),
|
||||
QTYSTU_0 = x.Field<decimal>("QTYSTU_0")
|
||||
QTYSTU_0 = x.Field<decimal>("QTYSTU_0"),
|
||||
STATUS = ""
|
||||
}
|
||||
).ToList();
|
||||
return JsonMore(list);
|
||||
}
|
||||
|
||||
#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;
|
||||
},
|
||||
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',
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
<el-table :data="tableData.slice((currentPage-1)*pageSize,currentPage*pageSize)" height="650" stripe border
|
||||
style="width: 100%"
|
||||
size="small"
|
||||
ref="tableData"
|
||||
v-loading="loading"
|
||||
@@cell-mouse-enter="handleCellEnter"
|
||||
@@cell-mouse-leave="handleCellLeave"
|
||||
@@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="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="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="180" align="center" prop="POHNUM_0"></el-table-column>
|
||||
<el-table-column label="订单行号" width="100" align="center" prop="POPLIN_0"></el-table-column>
|
||||
@@ -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<array.length; i++) {
|
||||
const objString = JSON.stringify(array[i]);
|
||||
if (seen.has(objString)) {
|
||||
return true;
|
||||
}
|
||||
seen.add(objString);
|
||||
}
|
||||
|
||||
return false;
|
||||
verify(array) {
|
||||
const tmp = new Set();
|
||||
array.forEach(x => tmp.add(x.POHNUM_0));
|
||||
return tmp.size > 1 ? true : false;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user