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

97 lines
3.6 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 XWMSPTHController : BaseController
{
private readonly IUnitWork _unitWork;
public XWMSPTHController(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 supply, string materialcode, string cgsh)
{
var sql = @"select * from QREQ3.XWMSPTH where 1=1";
if (!string.IsNullOrEmpty(address))
{
sql += $" and PRHFCY_0 = '{address}'";
}
if (!string.IsNullOrEmpty(billno))
{
sql += $" and POHNUM_0 like '%{billno}%'";
}
if (!string.IsNullOrEmpty(supply))
{
sql += $" and BPSNUM_0 like '%{supply}%'";
}
if (!string.IsNullOrEmpty(materialcode))
{
sql += $"and ITMREF_0 like '%{materialcode}%'";
}
if (!string.IsNullOrEmpty(cgsh))
{
sql += $"and PTHNUM_0 like '%{cgsh}%'";
}
var data = OracleHelper.GetDataSet(sql).Tables[0];
var list = data.AsEnumerable().Select
(x => new
{
PRHFCY_0 = x.Field<string>("PRHFCY_0"),
RCPDAT_0 = x.Field<DateTime>("RCPDAT_0").ToShortDateString(),
BPSNUM_0 = x.Field<string>("BPSNUM_0"),
BPSNAM_0 = x.Field<string>("BPSNAM_0"),
PTHNUM_0 = x.Field<string>("PTHNUM_0"),
PTDLIN_0 = x.Field<Int64>("PTDLIN_0"),
PJT_0 = x.Field<string>("PJT_0"),
OPPEXTNUM_0 = x.Field<string>("OPPEXTNUM_0"),
ITMREF_0 = x.Field<string>("ITMREF_0"),
POHITMDES1_0 = x.Field<string>("POHITMDES1_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"),
POHNUM_0 = x.Field<string>("POHNUM_0"),
POPLIN_0 = x.Field<Int64>("POPLIN_0"),
POHQTYSTU_0 = x.Field<decimal>("POHQTYSTU_0"),
POHQTYUOM_0 = x.Field<decimal>("POHQTYUOM_0"),
QTYUOM_0 = x.Field<decimal>("QTYUOM_0"),
UOM_0 = x.Field<string>("UOM_0"),
QTYSTU_0 = x.Field<decimal>("QTYSTU_0"),
STU_0 = x.Field<string>("STU_0"),
RTNQTYSTU_0 = x.Field<decimal>("RTNQTYSTU_0_0"),
UOMSTUCOE_0 = x.Field<decimal>("UOMSTUCOE_0_0"),
THISQTYUOM = x.Field<decimal>("QTYUOM_0"),
THISQTYSTU = x.Field<decimal>("QTYSTU_0"),
}
).ToList();
return JsonMore(list);
}
#endregion Search
}