feat: 新增库存批次和Lot查询功能,优化入库界面和报表处理

refactor: 重构SimpleReceiptIn界面,增加历史记录和自动完成功能

fix: 修复报表参数处理和SQL解码问题

perf: 优化WCS接口调用和库存计算逻辑

style: 清理无用代码和调整格式

chore: 更新数据库连接配置和调试模式设置
This commit is contained in:
zhougf committed 2025-09-27 23:10:21 +08:00
1 parent 5a04ca9d59
commit 48c63bb15d
13 files changed
+360 -198

No files matched your search

+10 -1
View File
@@ -387,7 +387,7 @@ namespace HHWMS.Web
var material = var material =
_unitWork.FindSingle<Material>(x => x.MaterialCode == inventory.MaterialCode); _unitWork.FindSingle<Material>(x => x.MaterialCode == inventory.MaterialCode);
inventory.Qty = (request.Weight * 100 - ContainerWeight - inventory.TaskQty * SmallContainerWeight) / (material.Qty ?? 1); inventory.Qty = (int)((request.Weight * 100 - ContainerWeight - inventory.TaskQty * SmallContainerWeight) / (material.Qty ?? 1));
inventory.Qty = inventory.Qty > 0 ? inventory.Qty : 0; inventory.Qty = inventory.Qty > 0 ? inventory.Qty : 0;
} }
@@ -402,10 +402,13 @@ namespace HHWMS.Web
ContainerCode = task.ContainerCode, ContainerCode = task.ContainerCode,
LocationCode = task.ToLocation, LocationCode = task.ToLocation,
MaterialCode = inventory.MaterialCode, MaterialCode = inventory.MaterialCode,
MaterialType = inventory.MaterialType,
MaterialName = inventory.MaterialName, MaterialName = inventory.MaterialName,
MaterialSpec = inventory.MaterialSpec, MaterialSpec = inventory.MaterialSpec,
MaterialUnit = inventory.MaterialUnit, MaterialUnit = inventory.MaterialUnit,
Batch = inventory.Batch,
Qty = inventory.Qty, Qty = inventory.Qty,
Status = inventory.Status,
CreateTime = DateTime.Now CreateTime = DateTime.Now
}; };
invTrans.Add(invTransaction); invTrans.Add(invTransaction);
@@ -422,7 +425,10 @@ namespace HHWMS.Web
MaterialName = inventory.MaterialName, MaterialName = inventory.MaterialName,
MaterialSpec = inventory.MaterialSpec, MaterialSpec = inventory.MaterialSpec,
MaterialUnit = inventory.MaterialUnit, MaterialUnit = inventory.MaterialUnit,
MaterialType = inventory.MaterialType,
Batch = inventory.Batch,
Qty = inventory.Qty, Qty = inventory.Qty,
Status = inventory.Status,
CreateTime = DateTime.Now CreateTime = DateTime.Now
}; };
invTrans.Add(invTransaction); invTrans.Add(invTransaction);
@@ -436,7 +442,10 @@ namespace HHWMS.Web
MaterialName = inventory.MaterialName, MaterialName = inventory.MaterialName,
MaterialSpec = inventory.MaterialSpec, MaterialSpec = inventory.MaterialSpec,
MaterialUnit = inventory.MaterialUnit, MaterialUnit = inventory.MaterialUnit,
MaterialType = inventory.MaterialType,
Batch = inventory.Batch,
Qty = inventory.Qty, Qty = inventory.Qty,
Status = inventory.Status,
CreateTime = DateTime.Now CreateTime = DateTime.Now
}; };
invTrans.Add(invTransaction2); invTrans.Add(invTransaction2);
@@ -18,7 +18,7 @@
<script> <script>
let template = let template =
{"panels":[{"index":0,"height":60,"width":100,"paperHeader":43.5,"paperFooter":170.07874015748033,"printElements":[{"options":{"left":55.5,"top":25.5,"height":106.5,"width":142.5,"title":"code","testData":"C0006","field":"code","fontSize":18,"textAlign":"center","lineHeight":24,"textType":"barcode"},"printElementType":{"type":"text"}}],"paperNumberLeft":258,"paperNumberTop":144,"paperNumberDisabled":true}]}; {"panels":[{"index":0,"height":30,"width":60,"paperHeader":0,"paperFooter":85.03937007874016,"printElements":[{"options":{"left":10,"top":9,"height":55,"width":145,"title":"code","testData":"C0006","field":"code","fontSize":12,"textAlign":"center","lineHeight":12,"textType":"barcode"},"printElementType":{"type":"text"}}],"paperNumberLeft":140,"paperNumberTop":63,"paperNumberDisabled":true}]}
let printData = []; let printData = [];
@@ -13,6 +13,30 @@ namespace HHWMS.Web
{ {
public partial class InventoryListVM : BasePagedListVM<Inventory_View, InventorySearcher> public partial class InventoryListVM : BasePagedListVM<Inventory_View, InventorySearcher>
{ {
public List<ComboSelectListItem> CurrentProcessList { get; set; }
public List<ComboSelectListItem> NextProcessList { get; set; }
protected override void InitVM()
{
var vm = Wtm.CreateVM<InventoryVM>();
CurrentProcessList = DC.Set<Inventory>()
.Where(x => !string.IsNullOrEmpty(x.Batch))
.Distinct(x => x.Batch)
.Select(x => new ComboSelectListItem
{
Text = x.Batch,
Value = x.Batch
}).ToList();
NextProcessList = DC.Set<Inventory>()
.Where(x => !string.IsNullOrEmpty(x.Lot))
.Distinct(x => x.Lot)
.Select(x => new ComboSelectListItem
{
Text = x.Lot,
Value = x.Lot
}).ToList();
}
protected override List<GridAction> InitGridAction() protected override List<GridAction> InitGridAction()
{ {
return new List<GridAction> return new List<GridAction>
@@ -42,6 +66,11 @@ namespace HHWMS.Web
this.MakeGridHeader(x => x.LocationCode).SetWidth(130), this.MakeGridHeader(x => x.LocationCode).SetWidth(130),
this.MakeGridHeader(x => x.MaterialCode).SetWidth(90), this.MakeGridHeader(x => x.MaterialCode).SetWidth(90),
this.MakeGridHeader(x => x.MaterialType).SetWidth(100), this.MakeGridHeader(x => x.MaterialType).SetWidth(100),
this.MakeGridHeader(x => x.Qty).SetWidth(100)
.SetFormat((a, b) =>
{
return (int?)a.Qty ?? 0;
}),
this.MakeGridHeader(x => x.SupplierCode).SetWidth(100), this.MakeGridHeader(x => x.SupplierCode).SetWidth(100),
this.MakeGridHeader(x => x.Batch).SetWidth(100), this.MakeGridHeader(x => x.Batch).SetWidth(100),
this.MakeGridHeader(x => x.Lot).SetWidth(100), this.MakeGridHeader(x => x.Lot).SetWidth(100),
@@ -59,11 +88,6 @@ namespace HHWMS.Web
this.MakeGridHeader(x => x.MaterialSpec).SetHide().SetWidth(150), this.MakeGridHeader(x => x.MaterialSpec).SetHide().SetWidth(150),
this.MakeGridHeader(x => x.MaterialUnit).SetHide(), this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
this.MakeGridHeader(x => x.TaskQty).SetHide(), this.MakeGridHeader(x => x.TaskQty).SetHide(),
this.MakeGridHeader(x => x.Qty).SetWidth(100)
.SetFormat((a, b) =>
{
return (int?)a.Qty ?? 0;
}),
this.MakeGridHeader(x => x.ManufactureDate).SetHide(), this.MakeGridHeader(x => x.ManufactureDate).SetHide(),
this.MakeGridHeader(x => x.ExpirationDate).SetHide(), this.MakeGridHeader(x => x.ExpirationDate).SetHide(),
this.MakeGridHeader(x => x.ReceiptCode).SetHide(), this.MakeGridHeader(x => x.ReceiptCode).SetHide(),
@@ -27,6 +27,8 @@ namespace HHWMS.Web
public String MaterialName { get; set; } public String MaterialName { get; set; }
[Display(Name = "Inventory.Batch")] [Display(Name = "Inventory.Batch")]
public String Batch { get; set; } public String Batch { get; set; }
[Display(Name = "Inventory.Lot")]
public String Lot { get; set; }
[Display(Name = "Inventory.ReceiptCode")] [Display(Name = "Inventory.ReceiptCode")]
public String ReceiptCode { get; set; } public String ReceiptCode { get; set; }
[Display(Name = "Inventory.SourceCode")] [Display(Name = "Inventory.SourceCode")]
@@ -6,12 +6,13 @@
<wt:combobox field="Searcher.ZoneId" items="Searcher.AllZones" empty-text="@Localizer["Sys.All"]" /> <wt:combobox field="Searcher.ZoneId" items="Searcher.AllZones" empty-text="@Localizer["Sys.All"]" />
<wt:textbox field="Searcher.ContainerCode" /> <wt:textbox field="Searcher.ContainerCode" />
<wt:textbox field="Searcher.LocationCode" /> <wt:textbox field="Searcher.LocationCode" />
<wt:textbox field="Searcher.MaterialCode" />
<wt:textbox field="Searcher.MaterialType" /> <wt:textbox field="Searcher.MaterialType" />
<wt:combobox field="Searcher.Batch" items="CurrentProcessList" />
<wt:combobox field="Searcher.Lot" items="NextProcessList" />
<wt:textbox field="Searcher.MaterialCode" />
<wt:textbox field="Searcher.MaterialName" /> <wt:textbox field="Searcher.MaterialName" />
<wt:textbox field="Searcher.SourceCode" /> <wt:textbox field="Searcher.SourceCode" />
<wt:textbox field="Searcher.CompanyCode" /> <wt:textbox field="Searcher.CompanyCode" />
<wt:textbox field="Searcher.Batch" />
<wt:textbox field="Searcher.Status" /> <wt:textbox field="Searcher.Status" />
<wt:combobox field="Searcher.TaskStatus" empty-text="@Localizer["Sys.All"]" /> <wt:combobox field="Searcher.TaskStatus" empty-text="@Localizer["Sys.All"]" />
</wt:row> </wt:row>
@@ -67,8 +67,10 @@ namespace HHWMS.Web.Controllers
MaterialName = x.MaterialName, MaterialName = x.MaterialName,
MaterialSpec = x.MaterialSpec, MaterialSpec = x.MaterialSpec,
Company = x.CompanyCode, Company = x.CompanyCode,
Qty = x.Qty Batch = x.Batch,
Qty = (int)x.Qty
}) })
.OrderByDescending(x => x.Id)
.ToList(); .ToList();
return Json(new { return Json(new {
@@ -127,7 +129,7 @@ namespace HHWMS.Web.Controllers
} }
[HttpPost] [HttpPost]
public ActionResult AddInventory(string containerCode, string materialCode, string company, string sourceCode, decimal qty) public ActionResult AddInventory(string containerCode, string materialCode, string company, string sourceCode, decimal qty, string batch)
{ {
try try
{ {
@@ -135,10 +137,12 @@ namespace HHWMS.Web.Controllers
{ {
return JsonMore(null, 500, "容器编码为空!"); return JsonMore(null, 500, "容器编码为空!");
} }
if (string.IsNullOrEmpty(materialCode)) if (string.IsNullOrEmpty(materialCode))
{ {
return JsonMore(null, 500, "物料编码为空!"); return JsonMore(null, 500, "物料编码为空!");
} }
if (qty <= 0) if (qty <= 0)
{ {
return JsonMore(null, 500, "数量必须大于0!"); return JsonMore(null, 500, "数量必须大于0!");
@@ -172,6 +176,7 @@ namespace HHWMS.Web.Controllers
CompanyCode = company, CompanyCode = company,
SourceCode = sourceCode, SourceCode = sourceCode,
SupplierCode = material.SupplierCode, SupplierCode = material.SupplierCode,
Batch = batch,
Qty = qty, Qty = qty,
TaskStatus = InventoryTaskStatusEnum.Locked, TaskStatus = InventoryTaskStatusEnum.Locked,
CreateTime = DateTime.Now CreateTime = DateTime.Now
@@ -184,12 +189,15 @@ namespace HHWMS.Web.Controllers
ZoneCode = zone.ZoneCode, ZoneCode = zone.ZoneCode,
BillType = InventoryTranType.入库, BillType = InventoryTranType.入库,
MaterialCode = material.MaterialCode, MaterialCode = material.MaterialCode,
MaterialType = inventory.MaterialType,
MaterialName = material.MaterialName, MaterialName = material.MaterialName,
MaterialSpec = inventory.MaterialSpec,
MaterialUnit = material.MaterialUnit, MaterialUnit = material.MaterialUnit,
ContainerCode = container.Code, ContainerCode = container.Code,
CompanyCode = inventory.CompanyCode, CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode, SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode, SupplierCode = inventory.SupplierCode,
Batch = batch,
Qty = qty, Qty = qty,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
CreateBy = "WMS", CreateBy = "WMS",
@@ -200,6 +208,10 @@ namespace HHWMS.Web.Controllers
return JsonMore(new { Id = inventory.ID }); return JsonMore(new { Id = inventory.ID });
} }
catch (DbUpdateException ex)
{
return JsonMore(null, 500, ex.InnerException?.Message);
}
catch (Exception ex) catch (Exception ex)
{ {
return JsonMore(null, 500, ex.Message); return JsonMore(null, 500, ex.Message);
@@ -272,7 +284,7 @@ namespace HHWMS.Web.Controllers
{ {
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCSCP", "TaskAssign", HttpMethodEnum.POST, postData) var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCSCP", "TaskAssign", HttpMethodEnum.POST, postData)
.Result?.Data; .Result?.Data;
// var res = new ApiJsonResult<dynamic> { Success = true, Msg = "Success",Data = null};
if (res.Success) if (res.Success)
{ {
task.Status = TaskStatusEnum.已下发; task.Status = TaskStatusEnum.已下发;
@@ -326,6 +338,7 @@ namespace HHWMS.Web.Controllers
CompanyCode = inventory.CompanyCode, CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode, SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode, SupplierCode = inventory.SupplierCode,
Batch = inventory.Batch,
Qty = inventory.Qty, Qty = inventory.Qty,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
CreateBy = "WMS", CreateBy = "WMS",
@@ -374,6 +387,7 @@ namespace HHWMS.Web.Controllers
CompanyCode = inventory.CompanyCode, CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode, SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode, SupplierCode = inventory.SupplierCode,
Batch = inventory.Batch,
Qty = inventory.Qty, Qty = inventory.Qty,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
CreateBy = "WMS", CreateBy = "WMS",
@@ -393,6 +407,7 @@ namespace HHWMS.Web.Controllers
CompanyCode = inventory.CompanyCode, CompanyCode = inventory.CompanyCode,
SourceCode = inventory.SourceCode, SourceCode = inventory.SourceCode,
SupplierCode = inventory.SupplierCode, SupplierCode = inventory.SupplierCode,
Batch = inventory.Batch,
Qty = qty, Qty = qty,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
CreateBy = "WMS", CreateBy = "WMS",
@@ -3,7 +3,7 @@
<a-form :model="formData" layout="horizontal" :label-col="{ style: { width: '100px' } }" :wrapper-col="{ style: { width: '220px' } }"> <a-form :model="formData" layout="horizontal" :label-col="{ style: { width: '100px' } }" :wrapper-col="{ style: { width: '220px' } }">
<a-form-item field="containerCode" label="托盘号"> <a-form-item field="containerCode" label="托盘号">
<a-input <a-input
v-model="ContainerCode" v-model="formData.containerCode"
placeholder="扫描托盘号" placeholder="扫描托盘号"
allow-clear allow-clear
@@keyup.enter="validateContainer" @@keyup.enter="validateContainer"
@@ -11,7 +11,7 @@
</a-form-item> </a-form-item>
<a-form-item field="materialCode" label="物料信息"> <a-form-item field="materialCode" label="物料信息">
<a-auto-complete <a-auto-complete
v-model="MaterialCode" v-model="formData.materialCode"
:data="materialOptions" :data="materialOptions"
@@search="handleSearch" @@search="handleSearch"
@@select="handleSelect" @@select="handleSelect"
@@ -20,19 +20,30 @@
</a-auto-complete> </a-auto-complete>
</a-form-item> </a-form-item>
<a-form-item field="materialName" label="图号"> <a-form-item field="materialName" label="图号">
<a-input v-model="MaterialName"/> <a-input v-model="formData.materialName"/>
</a-form-item>
<a-form-item field="batch" label="部件名称">
<a-auto-complete v-model="formData.batch"
ref="batchInput"
:data="batchTips"
placeholder="输入部件名称"
allow-clear
@@keydown.enter="$nextTick(() => {
$refs.sourceCodeInput.focus();
})"/>/>
</a-form-item> </a-form-item>
@* <a-form-item field="materialSpec" label="物料型号"> *@
@* <a-input v-model="MaterialSpec" disabled/> *@
@* </a-form-item> *@
<a-form-item field="sourceCode" label="订单号"> <a-form-item field="sourceCode" label="订单号">
<a-input v-model="SourceCode" placeholder="输入订单号" ref="sourceCodeInput" @@keydown.enter="this.$nextTick(() => { <a-input
this.$refs.companyCodeInput.focus(); v-model="formData.sourceCode"
});"/> placeholder="输入订单号"
ref="sourceCodeInput"
@@keydown.enter="$nextTick(() => {
$refs.companyCodeInput.focus();
})"/>
</a-form-item> </a-form-item>
<a-form-item field="companyCode" label="公司"> <a-form-item field="companyCode" label="公司">
<a-auto-complete <a-auto-complete
v-model="CompanyCode" v-model="formData.companyCode"
:data="companyOptions" :data="companyOptions"
@@search="handleCompanySearch" @@search="handleCompanySearch"
@@select="handleCompanySelect" @@select="handleCompanySelect"
@@ -41,7 +52,12 @@
</a-auto-complete> </a-auto-complete>
</a-form-item> </a-form-item>
<a-form-item field="qty" label="数量"> <a-form-item field="qty" label="数量">
<a-input-number v-model="Qty" :min="0" style="width: 100%" ref="numInput" @@keydown.enter="this.handleBind()"/> <a-input-number
v-model="formData.qty"
:min="0"
style="width: 100%"
ref="numInput"
@@keydown.enter="handleBind()"/>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<a-space> <a-space>
@@ -83,37 +99,30 @@
</a-modal> </a-modal>
<!-- 呼叫出库弹窗 --> <!-- 呼叫出库弹窗 -->
<a-modal v-model:visible="outModalVisible" title="呼叫出库" @@ok="handleOutConfirm" @@cancel="handleOutCancel"> <a-modal v-model:visible="outModalVisible" title="呼叫出库" @@ok="handleOutConfirm" @@cancel="handleOutCancel">
<a-form :model="outForm"> <a-form :model="outForm">
<a-form-item label="货位类型"> <a-form-item label="货位类型">
<a-radio-group v-model="outForm.level"> <a-radio-group v-model="outForm.level">
<a-radio value="high">高货位</a-radio> <a-radio value="high">高货位</a-radio>
<a-radio value="low">低货位</a-radio> <a-radio value="low">低货位</a-radio>
<a-radio value="mid">模具库</a-radio> <a-radio value="mid">模具库</a-radio>
</a-radio-group> </a-radio-group>
</a-form-item> </a-form-item>
<a-form-item label="出库口"> <a-form-item label="出库口">
<a-select v-model="outForm.port" placeholder="请选择出库口"> <a-select v-model="outForm.port" placeholder="请选择出库口">
<a-option v-for="item in outPortOptions" :key="item.value" :value="item.value">{{ item.label }}</a-option> <a-option v-for="item in outPortOptions" :key="item.value" :value="item.value">{{ item.label }}</a-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
</a-space> </a-space>
</div> </div>
<script> <script>
const { createApp, reactive, ref } = Vue const { createApp, reactive, ref, onBeforeUnmount } = Vue
const app = createApp({ const app = createApp({
data() { data() {
return { return {
ContainerCode: '',
MaterialCode: '',
MaterialName: '',
MaterialSpec: '',
SourceCode: '',
CompanyCode: '',
Qty: null,
loading1: false, loading1: false,
materialOptions: [], materialOptions: [],
searchTimer: null, searchTimer: null,
@@ -144,7 +153,7 @@
], ],
columns: [ columns: [
{ {
title: 'ID', title: 'Id',
dataIndex: 'Id', dataIndex: 'Id',
width: 80 width: 80
}, },
@@ -164,6 +173,10 @@
title: '物料型号', title: '物料型号',
dataIndex: 'MaterialSpec', dataIndex: 'MaterialSpec',
}, },
{
title: '部件名称',
dataIndex: 'Batch',
},
{ {
title: '订单号', title: '订单号',
dataIndex: 'SourceCode', dataIndex: 'SourceCode',
@@ -175,7 +188,7 @@
{ {
title: '数量', title: '数量',
dataIndex: 'Qty', dataIndex: 'Qty',
slotName: 'qty' slotName: 'Qty'
}, },
{ {
title: '操作', title: '操作',
@@ -188,21 +201,81 @@
materialCode: '', materialCode: '',
materialName: '', materialName: '',
materialSpec: '', materialSpec: '',
batch: '',
sourceCode: '', sourceCode: '',
companyCode: '', companyCode: '',
qty: 1 qty: null
}, },
companyOptions: [], companyOptions: [],
companySearchTimer: null companySearchTimer: null,
// 存储历史记录的对象
history: {
batch: [], // 部件历史
}
}
},
created() {
// 从本地存储加载历史记录
this.history.batch = JSON.parse(localStorage.getItem('batchHistory') || '[]');
},
computed: {
// 部件名称提示列表
batchTips() {
return this.getFilteredTips('batch', this.formData.batch);
} }
}, },
mounted() { mounted() {
// 页面加载完成后,将焦点设置到容器编码输入框 // 页面加载完成后,将焦点设置到容器编码输入框
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.containerInput.focus(); this.$refs.containerInput?.focus();
}); });
}, },
onBeforeUnmount() {
// 清理定时器,防止内存泄漏
if (this.searchTimer) clearTimeout(this.searchTimer);
if (this.companySearchTimer) clearTimeout(this.companySearchTimer);
},
methods: { methods: {
// 根据输入内容过滤提示列表
getFilteredTips(type, inputVal) {
if (!inputVal) {
// 没有输入时显示所有历史记录
console.log(1)
return this.history[type].map(item => ({ value: item }));
}
// 输入时过滤匹配的记录(不区分大小写)
const lowerVal = inputVal.toLowerCase();
return this.history[type]
.filter(item => item.toLowerCase().includes(lowerVal))
.map(item => ({ value: item }));
},
// 保存输入内容到历史记录
saveToHistory(type, value) {
if (!value) return; // 空值不保存
const history = this.history[type];
// 去重:如果已存在则移除旧的
const index = history.indexOf(value);
if (index > -1) {
history.splice(index, 1);
}
// 添加到最前面(最新的在最上面)
history.unshift(value);
// 限制最多保存10条
if (history.length > 10) {
history.pop();
}
// 保存到本地存储
localStorage.setItem(`${type}History`, JSON.stringify(history));
},
// 清除所有历史记录
clearAllHistory() {
this.history.material = [];
this.history.order = [];
localStorage.removeItem('materialHistory');
localStorage.removeItem('orderHistory');
},
handleSearch(value) { handleSearch(value) {
if (this.searchTimer) { if (this.searchTimer) {
clearTimeout(this.searchTimer); clearTimeout(this.searchTimer);
@@ -217,49 +290,51 @@
}, },
searchMaterials(keyword) { searchMaterials(keyword) {
var _this = this;
axios.get(`/receipt/SimpleReceiptIn/SearchMaterials?keyword=${encodeURIComponent(keyword)}`) axios.get(`/receipt/SimpleReceiptIn/SearchMaterials?keyword=${encodeURIComponent(keyword)}`)
.then(function (json) { .then((response) => {
if (json.data.Code == 200) { const json = response.data;
_this.materialOptions = json.data.Data.map(item => ({ if (json.Code == 200) {
this.materialOptions = json.Data.map(item => ({
...item, ...item,
value: item.MaterialCode, value: item.MaterialCode,
label: `${item.MaterialCode} - ${item.MaterialType} - ${item.MaterialName}` label: `${item.MaterialCode} - ${item.MaterialType} - ${item.MaterialName}`
})); }));
} else { } else {
_this.$message.error(json.data.Msg); this.$message.error(json.Msg || '获取物料列表失败');
_this.materialOptions = []; this.materialOptions = [];
} }
}) })
.catch(function (error) { .catch((error) => {
_this.$message.error(error); console.error('搜索物料失败:', error);
_this.materialOptions = []; this.$message.error('搜索物料失败: ' + (error.message || '网络错误'));
this.materialOptions = [];
}); });
}, },
handleSelect(value, option) { handleSelect(value) {
const selectedMaterial = this.materialOptions.find(item => item.value === value); const selectedMaterial = this.materialOptions.find(item => item.value === value);
if (selectedMaterial) { if (selectedMaterial) {
this.MaterialCode = selectedMaterial.MaterialCode; this.formData.materialCode = selectedMaterial.MaterialCode;
this.MaterialName = selectedMaterial.MaterialType; this.formData.materialName = selectedMaterial.MaterialType;
this.MaterialSpec = selectedMaterial.MaterialSpec; this.formData.materialSpec = selectedMaterial.MaterialSpec;
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.sourceCodeInput.focus(); this.$refs.batchInput?.focus();
}); });
}, },
handleBind() { handleBind() {
if (!this.ContainerCode) { // 表单验证
if (!this.formData.containerCode) {
this.$notification.error("请扫描箱号!"); this.$notification.error("请扫描箱号!");
return; return;
} }
if (!this.MaterialCode) { if (!this.formData.materialCode) {
this.$notification.error("请选择物料!"); this.$notification.error("请选择物料!");
return; return;
} }
if (!this.Qty || this.Qty <= 0 || !Number.isInteger(this.Qty)) { if (!this.formData.qty || this.formData.qty <= 0 || !Number.isInteger(this.formData.qty)) {
this.$notification.error("请输入大于0的正整数!"); this.$notification.error("请输入大于0的正整数!");
return; return;
} }
@@ -267,7 +342,7 @@
// 检查已绑定物料的容器编码 // 检查已绑定物料的容器编码
if (this.bindList.length > 0) { if (this.bindList.length > 0) {
const firstBind = this.bindList[0]; const firstBind = this.bindList[0];
if (firstBind.ContainerCode !== this.ContainerCode) { if (firstBind.ContainerCode !== this.formData.containerCode) {
this.$notification.warning("容器编码已变更,已清空绑定物料"); this.$notification.warning("容器编码已变更,已清空绑定物料");
this.bindList = []; this.bindList = [];
} }
@@ -275,76 +350,88 @@
// 添加到绑定列表 // 添加到绑定列表
const bindItem = { const bindItem = {
ContainerCode: this.ContainerCode, ContainerCode: this.formData.containerCode,
MaterialCode: this.MaterialCode, MaterialCode: this.formData.materialCode,
MaterialName: this.MaterialName, MaterialName: this.formData.materialName,
MaterialSpec: this.MaterialSpec, MaterialSpec: this.formData.materialSpec,
SourceCode: this.SourceCode, Batch: this.formData.batch,
CompanyCode: this.CompanyCode, SourceCode: this.formData.sourceCode,
Qty: this.Qty CompanyCode: this.formData.companyCode,
Qty: this.formData.qty
}; };
// 调用后端添加库存 // 调用后端添加库存
let postData = new URLSearchParams(); let postData = new URLSearchParams();
postData.append('containerCode', this.ContainerCode); postData.append('containerCode', this.formData.containerCode);
postData.append('materialCode', this.MaterialCode); postData.append('materialCode', this.formData.materialCode);
postData.append('company', this.CompanyCode); postData.append('company', this.formData.companyCode);
postData.append('sourceCode', this.SourceCode); postData.append('sourceCode', this.formData.sourceCode);
postData.append('qty', this.Qty); postData.append('qty', this.formData.qty);
postData.append('batch', this.formData.batch);
axios.post("/receipt/SimpleReceiptIn/AddInventory", postData) axios.post("/receipt/SimpleReceiptIn/AddInventory", postData)
.then((json) => { .then((response) => {
if (json.data.Code == 200) { const json = response.data;
if (json.Code == 200) {
// 添加ID到绑定项 // 添加ID到绑定项
bindItem.Id = json.data.Data.Id; bindItem.Id = json.Data.Id;
this.bindList.push(bindItem); this.bindList.unshift(bindItem);
this.$message.success("物料绑定成功"); this.$message.success("物料绑定成功");
this.saveToHistory('batch', this.formData.batch);
// 清空表单 // 清空表单
this.MaterialCode = ''; this.clearForm();
this.MaterialName = '';
this.MaterialSpec = '';
this.SourceCode = '';
this.CompanyCode = '';
this.Qty = null;
// 验证成功后,将焦点设置到物料编码输入框 // 验证成功后,将焦点设置到物料编码输入框
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.materialInput.focus(); this.$refs.materialInput?.focus();
}); });
} else { } else {
this.$notification.error(json.data.Msg); this.$notification.error(json.Msg || '绑定失败');
} }
}) })
.catch((error) => { .catch((error) => {
this.$notification.error("物料绑定失败"); console.error('物料绑定失败:', error);
this.$notification.error("物料绑定失败: " + (error.message || '网络错误'));
}); });
}, },
// 清空表单方法
clearForm() {
this.formData.materialCode = '';
this.formData.materialName = '';
this.formData.materialSpec = '';
this.formData.batch = '';
this.formData.sourceCode = '';
this.formData.companyCode = '';
this.formData.qty = null;
// 页面加载完成后,将焦点设置到容器编码输入框
this.$nextTick(() => {
this.$refs.containerInput?.focus();
});
},
handleClick() { handleClick() {
if (!this.ContainerCode) { if (!this.formData.containerCode) {
this.$notification.error('请扫描箱号!'); this.$notification.error('请扫描箱号!');
return; return;
} }
this.loading1 = true; this.loading1 = true;
let postData = new URLSearchParams(); let postData = new URLSearchParams();
postData.append('containerCode', this.ContainerCode); postData.append('containerCode', this.formData.containerCode);
axios.post("/receipt/SimpleReceiptIn/TaskIn", postData) axios.post("/receipt/SimpleReceiptIn/TaskIn", postData)
.then((json) => { .then((response) => {
this.loading1 = false; this.loading1 = false;
if (json.data.Code == 200) { const json = response.data;
this.ContainerCode = ''; if (json.Code == 200) {
this.MaterialCode = ''; this.clearForm();
this.MaterialName = ''; this.formData.containerCode = '';
this.MaterialSpec = '';
this.SourceCode = '';
this.CompanyCode = '';
this.Qty = 1;
this.bindList = []; this.bindList = [];
this.$notification.success("入库任务创建成功!"); this.$notification.success("入库任务创建成功!");
} else { } else {
this.$notification.error({ this.$notification.error({
content: json.data.Msg, content: json.Msg || '入库失败',
duration: 5000, duration: 5000,
closable: true closable: true
}); });
@@ -352,8 +439,9 @@
}) })
.catch((error) => { .catch((error) => {
this.loading1 = false; this.loading1 = false;
console.error('入库失败:', error);
this.$notification.error({ this.$notification.error({
content: error, content: '入库失败: ' + (error.message || '网络错误'),
duration: 5000, duration: 5000,
closable: true closable: true
}); });
@@ -361,33 +449,35 @@
}, },
validateContainer() { validateContainer() {
if (!this.ContainerCode) return; if (!this.formData.containerCode) return;
axios.get(`/receipt/SimpleReceiptIn/ValidateContainer?containerCode=${encodeURIComponent(this.ContainerCode)}`) axios.get(`/receipt/SimpleReceiptIn/ValidateContainer?containerCode=${encodeURIComponent(this.formData.containerCode)}`)
.then((json) => { .then((response) => {
if (json.data.Code == 200) { const json = response.data;
if (json.Code == 200) {
this.$message.success("容器验证成功"); this.$message.success("容器验证成功");
// 更新绑定列表 // 更新绑定列表
this.bindList = json.data.Data; this.bindList = json.Data;
// 验证成功后,将焦点设置到物料编码输入框 // 验证成功后,将焦点设置到物料编码输入框
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.materialInput.focus(); this.$refs.materialInput?.focus();
}); });
} else { } else {
this.$message.error(json.data.Msg || "容器验证失败"); this.$message.error(json.Msg || "容器验证失败");
this.ContainerCode = ''; this.formData.containerCode = '';
this.bindList = []; this.bindList = [];
} }
}) })
.catch((error) => { .catch((error) => {
this.$message.error("容器验证失败"); console.error('容器验证失败:', error);
this.ContainerCode = ''; this.$message.error("容器验证失败: " + (error.message || '网络错误'));
this.formData.containerCode = '';
this.bindList = []; this.bindList = [];
}); });
}, },
handleDelete(record) { handleDelete(record) {
const index = this.bindList.findIndex(item => item.Id === record.Id); const index = this.bindList.findIndex(item => item.id === record.id);
if (index > -1) { if (index > -1) {
// 调用后端删除库存 // 调用后端删除库存
@@ -395,22 +485,24 @@
postData.append('id', record.Id); postData.append('id', record.Id);
axios.post("/receipt/SimpleReceiptIn/DeleteInventory", postData) axios.post("/receipt/SimpleReceiptIn/DeleteInventory", postData)
.then((json) => { .then((response) => {
if (json.data.Code == 200) { const json = response.data;
if (json.Code == 200) {
this.bindList.splice(index, 1); this.bindList.splice(index, 1);
this.$message.success("删除成功"); this.$message.success("删除成功");
} else { } else {
this.$message.error(json.data.Msg); this.$message.error(json.Msg || '删除失败');
} }
}) })
.catch((error) => { .catch((error) => {
this.$message.error("删除失败"); console.error('删除失败:', error);
this.$message.error("删除失败: " + (error.message || '网络错误'));
}); });
} }
}, },
handleEdit(record) { handleEdit(record) {
this.editForm.index = this.bindList.findIndex(item => item.Id === record.Id); this.editForm.index = this.bindList.findIndex(item => item.id === record.id);
this.editForm.qty = Math.floor(record.Qty); this.editForm.qty = Math.floor(record.Qty);
this.editModalVisible = true; this.editModalVisible = true;
}, },
@@ -429,18 +521,22 @@
postData.append('id', record.Id); postData.append('id', record.Id);
postData.append('qty', this.editForm.qty); postData.append('qty', this.editForm.qty);
const newQty = this.editForm.qty;
axios.post("/receipt/SimpleReceiptIn/UpdateInventory", postData) axios.post("/receipt/SimpleReceiptIn/UpdateInventory", postData)
.then((json) => { .then((response) => {
if (json.data.Code == 200) { const json = response.data;
this.bindList[this.editForm.index].Qty = this.editForm.qty; if (json.Code == 200) {
this.bindList[this.editForm.index].Qty = newQty;
this.$notification.success("修改成功"); this.$notification.success("修改成功");
this.editModalVisible = false; this.editModalVisible = false;
} else { } else {
this.$notification.error(json.data.Msg); this.$notification.error(json.Msg || '修改失败');
} }
}) })
.catch((error) => { .catch((error) => {
this.$notification.error("修改失败"); console.error('修改失败:', error);
this.$notification.error("修改失败: " + (error.message || '网络错误'));
}); });
} }
}, },
@@ -452,13 +548,14 @@
}, },
handleDeduct(record) { handleDeduct(record) {
this.deductForm.index = this.bindList.findIndex(item => item.Id === record.Id); this.deductForm.index = this.bindList.findIndex(item => item.id === record.id);
this.deductForm.qty = null; this.deductForm.qty = null;
this.deductForm.maxQty = Math.floor(record.Qty); this.deductForm.maxQty = Math.floor(record.Qty);
this.deductModalVisible = true; this.deductModalVisible = true;
}, },
handleDeductConfirm() { handleDeductConfirm() {
console.log(this.deductForm)
if (this.deductForm.index > -1) { if (this.deductForm.index > -1) {
const record = this.bindList[this.deductForm.index]; const record = this.bindList[this.deductForm.index];
@@ -476,10 +573,10 @@
this.$notification.error("扣除数量不能大于当前数量"); this.$notification.error("扣除数量不能大于当前数量");
return; return;
} }
console.log(1);
const newQty = record.Qty - this.deductForm.qty; const newQty = record.Qty - this.deductForm.qty;
if (newQty == 0) { if (newQty === 0) {
// 如果扣除后数量等于0,直接删除 // 如果扣除后数量等于0,直接删除
this.handleDelete(record); this.handleDelete(record);
} else { } else {
@@ -489,17 +586,19 @@
postData.append('qty', newQty); postData.append('qty', newQty);
axios.post("/receipt/SimpleReceiptIn/UpdateInventory", postData) axios.post("/receipt/SimpleReceiptIn/UpdateInventory", postData)
.then((json) => { .then((response) => {
if (json.data.Code == 200) { const json = response.data;
if (json.Code == 200) {
this.bindList[this.deductForm.index].Qty = newQty; this.bindList[this.deductForm.index].Qty = newQty;
this.$notification.success("扣除成功"); this.$notification.success("扣除成功");
this.deductModalVisible = false; this.deductModalVisible = false;
} else { } else {
this.$notification.error(json.data.Msg); this.$notification.error(json.Msg || '扣除失败');
} }
}) })
.catch((error) => { .catch((error) => {
this.$notification.error("扣除失败"); console.error('扣除失败:', error);
this.$notification.error("扣除失败: " + (error.message || '网络错误'));
}); });
} }
} }
@@ -511,29 +610,27 @@
this.deductForm.qty = 1; this.deductForm.qty = 1;
this.deductForm.maxQty = 0; this.deductForm.maxQty = 0;
}, },
emptyIn() { emptyIn() {
if (!this.ContainerCode) { if (!this.formData.containerCode) {
this.$notification.error('请扫描箱号!'); this.$notification.error('请扫描箱号!');
return; return;
} }
this.loading1 = true; this.loading1 = true;
let postData = new URLSearchParams(); let postData = new URLSearchParams();
postData.append('containerCode', this.ContainerCode); postData.append('containerCode', this.formData.containerCode);
axios.post("/receipt/SimpleReceiptIn/EmptyIn", postData) axios.post("/receipt/SimpleReceiptIn/EmptyIn", postData)
.then((json) => { .then((response) => {
this.loading1 = false; this.loading1 = false;
if (json.data.Code == 200) { const json = response.data;
this.ContainerCode = ''; if (json.Code == 200) {
this.MaterialCode = ''; this.clearForm();
this.MaterialName = ''; this.formData.containerCode = '';
this.MaterialSpec = '';
this.CompanyCode = '';
this.Qty = 1;
this.bindList = []; this.bindList = [];
this.$notification.success("空托入库成功!"); this.$notification.success("空托入库成功!");
} else { } else {
this.$notification.error({ this.$notification.error({
content: json.data.Msg, content: json.Msg || '空托入库失败',
duration: 5000, duration: 5000,
closable: true closable: true
}); });
@@ -541,22 +638,21 @@
}) })
.catch((error) => { .catch((error) => {
this.loading1 = false; this.loading1 = false;
console.error('空托入库失败:', error);
this.$notification.error({ this.$notification.error({
content: error, content: '空托入库失败: ' + (error.message || '网络错误'),
duration: 5000, duration: 5000,
closable: true closable: true
}); });
}); });
}, },
outClick() { outClick() {
// if (!this.ContainerCode) {
// this.$notification.error('请扫描箱号!');
// return;
// }
this.outForm.level = 'low'; this.outForm.level = 'low';
this.outForm.port = ''; this.outForm.port = '';
this.outModalVisible = true; this.outModalVisible = true;
}, },
handleOutConfirm() { handleOutConfirm() {
if (!this.outForm.port) { if (!this.outForm.port) {
this.$notification.error('请选择出库口!'); this.$notification.error('请选择出库口!');
@@ -564,26 +660,21 @@
} }
this.loading1 = true; this.loading1 = true;
let postData = new URLSearchParams(); let postData = new URLSearchParams();
// postData.append('containerCode', this.ContainerCode);
postData.append('level', this.outForm.level); postData.append('level', this.outForm.level);
postData.append('port', this.outForm.port); postData.append('port', this.outForm.port);
axios.post("/receipt/SimpleReceiptIn/CallOut", postData) axios.post("/receipt/SimpleReceiptIn/CallOut", postData)
.then((json) => { .then((response) => {
this.loading1 = false; this.loading1 = false;
if (json.data.Code == 200) { const json = response.data;
this.ContainerCode = ''; if (json.Code == 200) {
this.MaterialCode = ''; this.clearForm();
this.MaterialName = ''; this.formData.containerCode = '';
this.MaterialSpec = '';
this.SourceCode = '';
this.CompanyCode = '';
this.Qty = '';
this.bindList = []; this.bindList = [];
this.outModalVisible = false; this.outModalVisible = false;
this.$notification.success("呼叫出库成功!"); this.$notification.success("呼叫出库成功!");
} else { } else {
this.$notification.error({ this.$notification.error({
content: json.data.Msg, content: json.Msg || '呼叫出库失败',
duration: 5000, duration: 5000,
closable: true closable: true
}); });
@@ -591,16 +682,19 @@
}) })
.catch((error) => { .catch((error) => {
this.loading1 = false; this.loading1 = false;
console.error('呼叫出库失败:', error);
this.$notification.error({ this.$notification.error({
content: error, content: '呼叫出库失败: ' + (error.message || '网络错误'),
duration: 5000, duration: 5000,
closable: true closable: true
}); });
}); });
}, },
handleOutCancel() { handleOutCancel() {
this.outModalVisible = false; this.outModalVisible = false;
}, },
handleCompanySearch(value) { handleCompanySearch(value) {
if (this.companySearchTimer) { if (this.companySearchTimer) {
clearTimeout(this.companySearchTimer); clearTimeout(this.companySearchTimer);
@@ -613,33 +707,36 @@
} }
}, 300); }, 300);
}, },
searchCompanies(keyword) { searchCompanies(keyword) {
var _this = this;
axios.get(`/receipt/SimpleReceiptIn/SearchCompanies?keyword=${encodeURIComponent(keyword)}`) axios.get(`/receipt/SimpleReceiptIn/SearchCompanies?keyword=${encodeURIComponent(keyword)}`)
.then(function (json) { .then((response) => {
if (json.data.Code == 200) { const json = response.data;
_this.companyOptions = json.data.Data.map(item => ({ if (json.Code == 200) {
this.companyOptions = json.Data.map(item => ({
...item, ...item,
value: item.CompanyName, value: item.CompanyName,
label: `${item.CompanyCode} - ${item.CompanyName}` label: `${item.CompanyCode} - ${item.CompanyName}`
})); }));
} else { } else {
_this.$message.error(json.data.Msg); this.$message.error(json.Msg || '获取公司列表失败');
_this.companyOptions = []; this.companyOptions = [];
} }
}) })
.catch(function (error) { .catch((error) => {
_this.$message.error(error); console.error('搜索公司失败:', error);
_this.companyOptions = []; this.$message.error('搜索公司失败: ' + (error.message || '网络错误'));
this.companyOptions = [];
}); });
}, },
handleCompanySelect(value, option) {
handleCompanySelect(value) {
const selectedCompany = this.companyOptions.find(item => item.value === value); const selectedCompany = this.companyOptions.find(item => item.value === value);
if (selectedCompany) { if (selectedCompany) {
this.CompanyCode = selectedCompany.CompanyName; this.formData.companyCode = selectedCompany.CompanyName;
} }
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.numInput.focus(); this.$refs.numInput?.focus();
}); });
} }
} }
@@ -648,4 +745,3 @@
.use(ArcoVueIcon) .use(ArcoVueIcon)
.mount('#receiptin'); .mount('#receiptin');
</script> </script>
@@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Web;
using WalkingTec.Mvvm.Core; using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc; using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions; using WalkingTec.Mvvm.Core.Extensions;
@@ -56,7 +57,8 @@ namespace HHWMS.Web.Controllers
[ActionDescription("Sys.Create")] [ActionDescription("Sys.Create")]
public ActionResult Create(ReportDesignVM vm) public ActionResult Create(ReportDesignVM vm)
{ {
vm.Entity.Params = vm.Entity.Params.Replace("&quot;", "\""); vm.Entity.Params = HttpUtility.HtmlDecode(vm.Entity.Params.Replace("\\t","" ).Replace("\\n",""));
vm.Entity.Sql = HttpUtility.HtmlDecode(vm.Entity.Sql.Replace("\\t","" ).Replace("\\n",""));
if (!ModelState.IsValid) if (!ModelState.IsValid)
{ {
return PartialView(vm); return PartialView(vm);
@@ -96,6 +98,8 @@ namespace HHWMS.Web.Controllers
} }
else else
{ {
vm.Entity.Params = HttpUtility.HtmlDecode(vm.Entity.Params.Replace("\\t","" ).Replace("\\n",""));
vm.Entity.Sql = HttpUtility.HtmlDecode(vm.Entity.Sql.Replace("\\t","" ).Replace("\\n",""));
vm.DoEdit(); vm.DoEdit();
if (!ModelState.IsValid) if (!ModelState.IsValid)
{ {
@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Web;
using HHWMS.Web; using HHWMS.Web;
using HHWMS.Web.Models; using HHWMS.Web.Models;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
@@ -52,6 +53,7 @@ namespace HHWMS.Web
// 组装查询条件 // 组装查询条件
if (!string.IsNullOrEmpty(sFilter)) if (!string.IsNullOrEmpty(sFilter))
{ {
sFilter = HttpUtility.HtmlDecode(sFilter);
if (string.IsNullOrEmpty(filter)) if (string.IsNullOrEmpty(filter))
{ {
return ResponseResult<dynamic>.Error("请填写查询条件!"); return ResponseResult<dynamic>.Error("请填写查询条件!");
@@ -66,7 +68,7 @@ namespace HHWMS.Web
return ResponseResult<dynamic>.Error("查询条件不正确!"); return ResponseResult<dynamic>.Error("查询条件不正确!");
} }
} }
sql = HttpUtility.HtmlDecode(sql.Replace("\\t","" ).Replace("\\n",""));
foreach (var item in json) foreach (var item in json)
{ {
sql = sql.Replace(item.Key, item.Value.ToString()); sql = sql.Replace(item.Key, item.Value.ToString());
@@ -84,7 +86,8 @@ namespace HHWMS.Web
} }
result.Add(colList); result.Add(colList);
// 添加列表 // 添加列表
result.Add(data.Rows[0].Table); if(data.Rows.Count > 0)
result.Add(data.Rows[0].Table);
return ResponseResult<dynamic>.Success(result); return ResponseResult<dynamic>.Success(result);
} }
@@ -8,5 +8,4 @@
</wt:row> </wt:row>
</wt:searchpanel> </wt:searchpanel>
<wt:grid vm="@Model" url="/report/ReportDesign/Search"/> <wt:grid vm="@Model" url="/report/ReportDesign/Search"/>
<div class="layui-row" id="ConfigParams" hidden>
</div>
@@ -11,7 +11,7 @@
<table id="demo" lay-filter="test"></table> <table id="demo" lay-filter="test"></table>
<div class="layui-row" id="ConfigParams" hidden> <div class="layui-row" id="ConfigParams">
</div> </div>
<style> <style>
@@ -41,7 +41,7 @@
var DictKey = $('#params').val(); var DictKey = $('#params').val();
if (DictKey != undefined && DictKey != null && DictKey != "") { if (DictKey != undefined && DictKey != null && DictKey != "") {
LoadParams(DictKey); LoadParams(DictKey);
layer.open({ layui.layer.open({
title: '参数', title: '参数',
area: ["500px", "300px"], area: ["500px", "300px"],
type: 1, type: 1,
@@ -75,7 +75,6 @@
var dom = ''; var dom = '';
for (var item in oldobj) { for (var item in oldobj) {
var value = item; var value = item;
var oldvalue = ''; var oldvalue = '';
if (oldobj[value] !== undefined) { if (oldobj[value] !== undefined) {
oldvalue = oldobj[value]; oldvalue = oldobj[value];
@@ -87,6 +86,8 @@
dom += '</div></div>'; dom += '</div></div>';
} }
$("#ConfigParams").html(dom); $("#ConfigParams").html(dom);
layui.form.render();
console.log($("#ConfigParams"))
} }
function GetParams() { function GetParams() {
@@ -99,6 +100,7 @@
// 获取数据 // 获取数据
function QueryData() { function QueryData() {
$.ajax({ $.ajax({
url: "/report/ReportView/QueryData", url: "/report/ReportView/QueryData",
async: true, async: true,
@@ -106,16 +108,23 @@
data: { name: name, filter: $('#params').val() }, data: { name: name, filter: $('#params').val() },
dataType: "json", dataType: "json",
success: function (result) { success: function (result) {
layui.table.render({ if (result.Data.length > 1) {
elem: '#demo' layui.table.render({
, page: { layout: ['count'] } elem: '#demo'
, limit: Number.MAX_VALUE , page: {layout: ['count']}
, toolbar: true , limit: Number.MAX_VALUE
, defaultToolbar: ['filter','exports'] , toolbar: true
, height: 'full' , defaultToolbar: ['filter', 'exports']
, cols: [result.Data[0]] , height: 'full'
, data: result.Data[1] , cols: [result.Data[0]]
}); , data: result.Data[1]
});
}else{
layui.table.render({
elem: '#demo',
data: [] // 确保新数据为空数组
});
}
} }
}); });
}; };
+1 -1
View File
@@ -127,7 +127,7 @@ namespace HHWMS.Web
{ {
public DataContext CreateDbContext(string[] args) public DataContext CreateDbContext(string[] args)
{ {
return new DataContext("Server=127.0.0.1;Port=3306;Database=wms2;Uid=root;Password=123456;Character Set=utf8mb4;", DBTypeEnum.MySql); return new DataContext("Server=127.0.0.1;Port=3306;Database=wms3;Uid=root;Password=abc123*;Character Set=utf8mb4;", DBTypeEnum.MySql);
} }
} }
} }
+2 -2
View File
@@ -29,7 +29,7 @@
} }
], ],
"CookiePre": "HHWMS", //cookie前缀 "CookiePre": "HHWMS", //cookie前缀
"IsQuickDebug": false, //是否启用debug模式 "IsQuickDebug": true, //是否启用debug模式
"EnableTenant": false, //是否启动多租户 "EnableTenant": false, //是否启动多租户
"SyncDb": true, //是否自动同步数据库 "SyncDb": true, //是否自动同步数据库
"EncryptKey": "", //加密密钥 "EncryptKey": "", //加密密钥
@@ -92,7 +92,7 @@
"LoginPath": "/Login/Login" "LoginPath": "/Login/Login"
}, },
"Domains": { "Domains": {
"WCSCP": { "WCS": {
"Address": "http://192.168.30.220:65533/api/WCS/" "Address": "http://192.168.30.220:65533/api/WCS/"
} }
}, },