Files
8357WMS/HHWMS.Web/Areas/XWMS/Controllers/XWMSSHIPController.cs
T
2023-12-22 13:22:47 +08:00

84 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using HHWMS.Web.Models;
using MESTOWMSService;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using ServiceReference1;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
namespace HHWMS.Web.Controllers;
[Area("xwms")]
[ActionDescription("地点间收货")]
public class XWMSSHIPController : BaseController
{
private readonly IUnitWork _unitWork;
public XWMSSHIPController(IUnitWork unitWork)
{
_unitWork = unitWork;
}
#region Search
[ActionDescription("Sys.Search")]
public ActionResult Index()
{
return PartialView("Index");
}
[ActionDescription("Sys.Search")]
public ActionResult Search(string address, string billno, string sbill, string materialcode)
{
var sql = @"select * from QREQ3.XWMSSHIP where 1=1";
if (!string.IsNullOrEmpty(address))
{
sql += $" and FCY_0 = '{address}'";
}
if (!string.IsNullOrEmpty(billno))
{
sql += $" and POHNUM_0 like '%{billno}%'";
}
if (!string.IsNullOrEmpty(sbill))
{
sql += $" and SDHNUM_0 like '%{sbill}%'";
}
if (!string.IsNullOrEmpty(materialcode))
{
sql += $"and ITMREF_0 like '%{materialcode}%'";
}
var data = OracleHelper.GetDataSet(sql).Tables[0];
var list = data.AsEnumerable().Select
(x => new
{
SDHNUM_0 = x.Field<string>("SDHNUM_0"),
FCY_0 = x.Field<string>("FCY_0"),
STOFCY_0 = x.Field<string>("STOFCY_0"),
BPRNAM_0 = x.Field<string>("BPRNAM_0"),
SHIDAT_0 = x.Field<DateTime>("SHIDAT_0").ToShortDateString(),
SDDLIN_0 = x.Field<Int64>("SDDLIN_0"),
ITMREF_0 = x.Field<string>("ITMREF_0"),
ITMDES1_0 = x.Field<string>("ITMDES1_0"),
ITMDES2_0 = x.Field<string>("ITMDES2_0"),
ITMDES3_0 = x.Field<string>("ITMDES3_0"),
YITMDES4_0 = x.Field<string>("YITMDES4_0"),
QTY_0 = x.Field<decimal>("QTY_0"),
SAU_0 = x.Field<string>("SAU_0"),
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")
}
).ToList();
return JsonMore(list);
}
#endregion Search
}