123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using Common.Model;
- using JCSoft.WX.Framework.Api;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.Caching.Memory;
- using Newtonsoft.Json;
- using PublicLibrary.Model;
- using SupplierWeb.Codes.EF;
- using ZcPeng.PublicLibrary;
- using System.Linq.Dynamic.Core;
- using SupplierWeb.Codes.mvc;
- using CoreEntity.Entity;
- using CoreEntity.DAL;
- using Common.Wechat;
- using Newtonsoft.Json.Converters;
- using LigerRM.Common;
- namespace SupplierWeb.Controllers
- {
- /// <summary>
- ///
- /// 订单汇总明细,入库单汇总明细,拒收单汇总明细
- /// </summary>
- [Route("web/order")]
- [ApiController]
- public class OrderController : BaseController
- {
- public OrderController(IMemoryCache cache, IApiClient client) : base(cache, client)
- {
- }
- [AuthPermission]
- [HttpPost]
- [Route("getData")]
- public JsonResult GetData(string[] filters, Int32 pageIndex, Int32 pageSize,
- string sortField, Int32 sortDirection, string[] sumFields, string staffid, [FromBody]dynamic data)
- {
- var userid = getStaffUserid(staffid);
- //判断参数是否合法
- if (string.IsNullOrEmpty(userid))
- {
- return Json(new
- {
- success = 0,
- msg = "没有登陆",
- timeout = 1,
- });
- }
- var sql0 = "select * from sup_Account where id = @userid";
- var param0 = new List<SqlParameter>();
- param0.Add(new SqlParameter("userid", int.Parse(userid)));
- var dt0 = new DataTable();
- DataAccess.GetValues(sql0, ref dt0, param0.ToArray(), out _);
- var purStaffId = string.Empty;
- var name = string.Empty;
- if (dt0 != null && dt0.Rows.Count > 0)
- {
- purStaffId = dt0.Rows[0]["PurStaffId"].ToString();
- name = dt0.Rows[0]["AccountRealName"].ToString();
- }
- List<QueryFilter> filterList = new List<QueryFilter>();
- if (data != null)
- {
- if (data.filters.Count > 0)
- {
- var list = JsonConvert.SerializeObject(data.filters);
- filterList = JsonConvert.DeserializeObject<List<QueryFilter>>(list);
- }
- pageIndex = data.pageIndex;
- pageSize = data.pageSize;
- sortField = data.sortField;
- sortDirection = data.sortDirection;
- sumFields = data.sumFields.ToObject<string[]>();
- }
- var isAce = sortDirection == 0;
- var queryCondition = string.Empty;
- var param = new List<SqlParameter>();
- var start = (pageIndex - 1) * pageSize;
- var end = (start + 1 + pageSize);
- var dt = new DataTable();
- if (filterList != null)
- {
- queryCondition = QueryFilter.getFilterSqlParam(filterList.ToArray(), out param, new PurInMt(), "A.");
- }
- var sql =
- $"select * from " +
- $"(select A.*,row_number() over (order by A.BillNo desc) as rowNum " +
- $"from (select *,'{name}' as AccountRealName from PurOrderMT A " +
- $"where SaleManId= '{purStaffId}') A where 1=1 {queryCondition}) R" +
- $" where rowNum > {start} and rowNum < {end}";
- DataAccess.GetValues(sql, ref dt, param.ToArray(), out _);
- IList<Temp> result = new List<Temp>();
- if (dt != null && dt.Rows.Count > 0)
- {
- result = ModelConvertHelper<Temp>.ConvertToModel(dt);
- }
- var jsonData = JsonConvert.SerializeObject(result);
- var countSql =
- $"select count(1) from (select * from (select * from PURORDERMT where SaleManId= '{purStaffId}') A where 1=1 {queryCondition}) R";
- var count = DataAccess.GetRowCountDefine(countSql, param.ToArray(), out _);
- return Json(new
- {
- items = result,
- sum = new { },
- totalCount = count
- });
- }
- [AuthPermission]
- [HttpPost]
- [Route("orderin")]
- public JsonResult orderin(string[] filters, Int32 pageIndex, Int32 pageSize,
- string sortField, Int32 sortDirection, string[] sumFields, string staffid, [FromBody]dynamic data)
- {
- var userid = getStaffUserid(staffid);
- //判断参数是否合法
- if (string.IsNullOrEmpty(userid))
- {
- return Json(new
- {
- success = 0,
- msg = "没有登陆",
- timetout = 1,
- });
- }
- //var sql0 = "select ContactId from ContactDoc where UserId = @userid";
- //var param0 = new List<SqlParameter>();
- //param0.Add(new SqlParameter("userid", int.Parse(userid)));
- //var dt0 = new DataTable();
- //DataAccess.GetValues(sql0, ref dt0, param0.ToArray(), out _);
- //var ContactId = string.Empty;
- //if (dt0 != null && dt0.Rows.Count > 0)
- //{
- // ContactId = dt0.Rows[0]["ContactId"].ToString();
- //}
- List<QueryFilter> filterList = new List<QueryFilter>();
- if (data != null)
- {
- if (data.filters.Count > 0)
- {
- var list = JsonConvert.SerializeObject(data.filters);
- filterList = JsonConvert.DeserializeObject<List<QueryFilter>>(list);
- }
- pageIndex = data.pageIndex;
- pageSize = data.pageSize;
- sortField = data.sortField;
- sortDirection = data.sortDirection;
- sumFields = data.sumFields.ToObject<string[]>();
- }
- var isAce = sortDirection == 0;
- var queryCondition = string.Empty;
- var param = new List<SqlParameter>();
- var start = (pageIndex - 1) * pageSize;
- var end = (start + 1 + pageSize);
- var dt = new DataTable();
- if (filterList != null)
- {
- queryCondition = QueryFilter.getFilterSqlParam(filterList.ToArray(),out param,new PurInMt(),"B.");
- }
- queryCondition = queryCondition.Replace("B.Contact", "A.Contact");
- queryCondition = queryCondition.Replace("B.OppContact", "A1.OppContact");
- queryCondition = queryCondition.Replace("B.StaffName","D.StaffName");
- //param.Add(new SqlParameter("userid", int.Parse(userid)));
- string rulesql = FilterTranslator.ruleSql(ref param);
- var sql = $"select * from";
- var sql1 = $"(select row_number() over (order by b.BillNo desc) as rownum,b.*,A.Contact,A1.Contact as OppContact,D.StaffName " +
- $"from PURINMT B " +
- $"left join PURORDERMT C on b.K_BillCode=c.BillCode and C.EntId = B.EntId " +
- $"left join CONTACTDOC A on C.K_ContactId = A.ContactId and A.EntId = C.EntId " +
- $"left join CONTACTDOC A1 on A1.ContactId = C.OppContId and A1.EntId = C.EntId " +
- $"left join StaffDoc D on D.StaffId = B.SaleManId and D.EntId = B.EntId " +
- $"where 1=1 " +
- //$"and c.Source = 'coop.360lj.com' " +
- //$"and c.Source = 'coop.360lj.com' and C.K_ContactId in (select ContactId from ContactDoc where UserId = @userid) " +
- queryCondition +
- rulesql +
- $")R";
- var sql2 = $" where rownum > {start} and rownum< {end}";
- string resultstr;
- DataAccess.GetValues(sql+sql1+sql2, ref dt, param.ToArray(), out resultstr);
- IList<Temp3> result = new List<Temp3>();
- if (dt != null && dt.Rows.Count > 0)
- {
- result = ModelConvertHelper<Temp3>.ConvertToModel(dt);
- }
- var jsonData = JsonConvert.SerializeObject(result);
- var countSql =
- $"select count(1) from " +
- sql1;
- var count = DataAccess.GetRowCountDefine(countSql, param.ToArray(), out resultstr);
- return Json(new
- {
- items = result,
- sum = new { },
- totalCount = count
- });
- }
- [AuthPermission]
- [HttpPost]
- [Route("orderindt")]
- public JsonResult orderindt(string[] filters, Int32 pageIndex, Int32 pageSize,
- string sortField, Int32 sortDirection, string[] sumFields, string staffid, [FromBody]dynamic data)
- {
- var userid = getStaffUserid(staffid);
- //判断参数是否合法
- if (string.IsNullOrEmpty(userid))
- {
- return Json(new
- {
- success = 0,
- msg = "没有登陆",
- timetout = 1,
- });
- }
- //var sql0 = "select * from ContactDoc where userid = @userid";
- //var param0 = new List<SqlParameter>();
- //param0.Add(new SqlParameter("userid", int.Parse(userid)));
- //var dt0 = new DataTable();
- //DataAccess.GetValues(sql0, ref dt0, param0.ToArray(), out _);
- //var ContactId = "'";
- //if (dt0 != null && dt0.Rows.Count > 0)
- //{
- // int i = 0;
- // foreach (DataRow row in dt0.Rows)
- // {
- // if (i != (dt0.Rows.Count - 1))
- // ContactId += dt0.Rows[0]["ContactId"].ToString() + "','";
- // else
- // ContactId += dt0.Rows[0]["ContactId"].ToString() + "'";
- // i += 1;
- // }
- //}
- //var billNo = string.Empty;
- List<QueryFilter> filterList = new List<QueryFilter>();
- if (data != null)
- {
- if (data.filters.Count > 0)
- {
- var list = JsonConvert.SerializeObject(data.filters);
- filterList = JsonConvert.DeserializeObject<List<QueryFilter>>(list);
- }
- pageIndex = data.pageIndex;
- pageSize = data.pageSize;
- sortField = data.sortField;
- sortDirection = data.sortDirection;
- sumFields = data.sumFields.ToObject<string[]>();
- //billNo = filterList.FirstOrDefault()?.value;
- }
- //if (string.IsNullOrEmpty(billNo))
- //{
- // billNo = "0000";
- //}
- var isAce = sortDirection == 0;
- var queryCondition = string.Empty;
- var param = new List<SqlParameter>();
- var start = (pageIndex - 1) * pageSize;
- var end = (start + 1 + pageSize);
- var dt = new DataTable();
- //var filter = " and D.K_ContactId in( " + ContactId + ")";
- if (filterList != null)
- {
- queryCondition = QueryFilter.getFilterSqlParam(filterList.ToArray(), out param, new PurInMt(), "B.");
- }
- queryCondition = queryCondition.Replace("B.kdcode", "F.k_kdcode");
- queryCondition = queryCondition.Replace("B.GoodsName", "G.GoodsName");
- //queryCondition = queryCondition.Replace("B.StaffName", "D.StaffName");
- string rulesql = FilterTranslator.ruleSql(ref param);
- var sql = $"select * from ";
- var sql1 = $"(select row_number() over (order by a.BillNo desc) as rownum,b.*,F.k_kdcode as kdcode,G.GoodsName " +
- $"from PURINDT B " +
- $"left join PURINMT A on A.BillNo=B.BillNo and A.EntId = B.EntId " +
- $"left join PURNOTESDT C on b.RfBillNo=c.BillNo and C.BillSn=B.RfBillSn and C.EntId = B.EntId " +
- $"left join PURORDERMT D on A.K_BillCode = d.BillCode and D.EntId = A.EntId " +
- $"left join sup_PurShipmentOrderDT E on E.BillNo=C.BillNo and E.BillSn=C.BillSn " +
- $"left join sup_PurOrderShipment F on F.Id=E.ShipmentId " +
- $"left join GOODSDOC G on G.GoodsId=B.GoodsId and G.EntId = B.EntId " +
- $"where 1=1 " +
- $" {queryCondition} " +
- $" {rulesql}" +
- //$" and a.billno ={billNo}" +
- $") R " ;
- var sql2 = $" where rownum > {start} and rownum < {end}";
- string resultstr;
- DataAccess.GetValues(sql + sql1 +sql2, ref dt, param.ToArray(), out resultstr);
- IList<Temp4> result = new List<Temp4>();
- if (dt != null && dt.Rows.Count > 0)
- {
- result = ModelConvertHelper<Temp4>.ConvertToModel(dt);
- }
- var jsonData = JsonConvert.SerializeObject(result);
- var countSql = $"select count(1) from " + sql1;
- var count = DataAccess.GetRowCountDefine(countSql, param.ToArray(), out resultstr);
- return Json(new
- {
- items = result,
- sum = new { },
- totalCount = count
- });
- }
- ////查询采购订单明细
- [AuthPermission]
- [HttpPost, Route("purchaseorderdt/{staffId}")]
- public JsonResult purchaseorderdt(QueryFilter[] filters, Int32 pageIndex, Int32 pageSize,
- string sortField, Int32 sortDirection, string[] sumFields,
- string staffId,
- [FromBody]dynamic data)
- {
- string userids;
- userids = getStaffUserid(staffId);
- //判断参数是否合法
- if (string.IsNullOrEmpty(userids))
- {
- return Json(new
- {
- items = new string[] { },
- sum = new { },
- totalCount = 0,
- timeout = 1
- });
- }
- if (data != null)
- {
- //Newtonsoft.Json.Linq.JArray
- filters = data.filters.ToObject<QueryFilter[]>();
- pageIndex = data.pageIndex;
- pageSize = data.pageSize;
- sortField = data.sortField;
- sortDirection = data.sortDirection;
- sumFields = data.sumFields.ToObject<string[]>();
- }
- string StaffDocId = StaffDocDAL.GetStaffId(userids);
- List<SqlParameter> parameters1 = new List<SqlParameter>();
- string filterstring = QueryFilter.getFilterSqlParam(filters, out parameters1, new PurOrderDTEx(), "G.");
- filterstring += " " +
- " and A.SaleManId = '" + StaffDocId + "' ";
- filterstring = filterstring.Replace("and G.GoodsName", "and H.GoodsName");
- filterstring = filterstring.Replace("and G.GoodsCode", "and H.GoodsCode");
- filterstring = filterstring.Replace("and G.StaffName", "and C.StaffName");
- filterstring = filterstring.Replace("and G.Contact", "and F.Contact");
- filterstring = filterstring.Replace("and G.BusinessName", "and E.BusinessName");
- #region 获取订单
- DataTable dt = new DataTable();
- string result = string.Empty;
- string direct = " desc ";
- if (sortDirection != 1)
- direct = " asc";
- int start = (pageIndex - 1) * pageSize;
- int end = (start + 1 + pageSize);
- string commandText0 = "select * from (";
- string commandText1 =
- "select G.*,A.OppContId,A.SuppliersId,B.AccountRealName,C.StaffName," +
- "E.BusinessName,F.Contact," +
- "H.GoodsName,H.GoodsCode,H.GoodsSpec,H.Manufacturer," +
- "row_number() over" +
- "( order by G." + sortField + " " + direct + " ) as rownum" +
- " from PurOrderDT G left join PurOrderMT A on G.BillNo = A.BillNo and A.EntId = G.EntId " +
- " left join GoodsDoc H on H.GoodsId=G.GoodsId and H.EntId = G.EntId " +
- " left join " + Config.TablePrefix + "Account B on A.SaleManId=B.PurStaffId " +
- " left join StaffDoc C on A.SaleManId=C.StaffId and C.EntId = A.EntId " +
- " left join supplydoc D on A.SuppliersId=D.SuppliersId and D.EntId = A.EntId " +
- " left join BusinessDoc E on E.BusinessId=D.SuppliersId and E.Is_Supp = 'Y' and E.EntId = D.EntId " +
- " left join ContactDoc F on F.ContactId=A.oppcontid and F.EntId = A.EntId " +
- " where 1=1 " +
- filterstring +
- ")AAA";
- string commandText2 =
- " where AAA.rownum>" + start + " and AAA.rownum<" + end
- ;
- string commandText = commandText0 + commandText1 + commandText2;
- bool result1 = DataAccess.GetValues(commandText, ref dt, parameters1.ToArray(), out result);
- IList<PurOrderDTEx> users = new List<PurOrderDTEx>();
- if (dt != null && dt.Rows.Count > 0)
- {
- // 把DataTable转换为IList<UserInfo>
- users = ModelConvertHelper<PurOrderDTEx>.ConvertToModel(dt);
- }
- #endregion
- string resultrow;
- string commandTextCount = "select count(*) from (" + commandText1;
- long totalcount = DataAccess.GetRowCountDefine(commandTextCount, parameters1.ToArray(), out resultrow);
- IsoDateTimeConverter timejson = new IsoDateTimeConverter
- {
- DateTimeFormat = "yyyy'-'MM'-'dd' 'HH':'mm':'ss"
- };
- var jsonData = JsonConvert.SerializeObject(users, timejson);
- return Json(new
- {
- items = JsonConvert.DeserializeObject(jsonData),
- sum = new { },
- totalCount = totalcount
- });
- }
- [AuthPermission]
- [HttpPost]
- [Route("gsnotacp")]
- public JsonResult GspNotAcpData(string staffid, [FromBody] dynamic data)
- {
- var userid = getStaff("userid");
- //判断参数是否合法
- if (string.IsNullOrEmpty(userid))
- {
- return Json(new
- {
- success = 0,
- msg = "没有登陆",
- timeout = 1
- });
- }
- var sql0 = "select * from sup_Account where id = @userid";
- var param0 = new List<SqlParameter>();
- param0.Add(new SqlParameter("userid", int.Parse(userid)));
- var dt0 = new DataTable();
- DataAccess.GetValues(sql0, ref dt0, param0.ToArray(), out _);
- var purStaffId = string.Empty;
- if (dt0 != null && dt0.Rows.Count > 0)
- {
- purStaffId = dt0.Rows[0]["PurStaffId"].ToString();
- }
- List<QueryFilter> filterList = new List<QueryFilter>();
- int pageIndex = 1;
- int pageSize = 15;
- string sortField;
- int sortDirection = 0;
- string[] sumFields;
- if (data != null)
- {
- if (data.filters.Count > 0)
- {
- var list = JsonConvert.SerializeObject(data.filters);
- filterList = JsonConvert.DeserializeObject<List<QueryFilter>>(list);
- }
- pageIndex = data.pageIndex;
- pageSize = data.pageSize;
- sortField = data.sortField;
- sortDirection = data.sortDirection;
- sumFields = data.sumFields.ToObject<string[]>();
- }
- var isAce = sortDirection == 0;
- var queryCondition = string.Empty;
- var param = new List<SqlParameter>();
- var start = (pageIndex - 1) * pageSize;
- var end = (start + 1 + pageSize);
- var dt = new DataTable();
- if (filterList != null)
- {
- queryCondition = QueryFilter.getFilterSqlParam(filterList.ToArray(), out param, new PurInMt(), "A.");
- }
- string rulesql = FilterTranslator.ruleSql(ref param);
- var sql =
- $"select * from ";
- var sql1 = $"(select row_number() over (order by A.BillNo desc) as rownum," +
- $" H.StaffName,F.contact,G.contact as oppcontact,E.K_ContactId,E.OppContId,K_BillCode,A.* from GSPNOTACPMT A " +
- $" left join GSPINMT B on A.RfBillNo = B.BillNo and A.EntId = B.EntId " +
- $" left join(select billno, entid, RfBillNo, ROW_NUMBER() over(partition by billno order by billno asc) as rn from GSPINDT )C on C.BillNo = B.BillNo and rn = 1 and C.EntId = B.EntId" +
- $" left join PURNOTESMT D on D.BillNo = C.RfBillNo and D.EntId = C.EntId" +
- $" left join PurOrderMT E on E.BillCode = D.K_BillCode and E.EntId = D.EntId" +
- $" left join contactdoc F on F.ContactId = E.K_ContactId and F.EntId = E.EntId" +
- $" left join contactdoc G on G.ContactId = E.OppContId and G.EntId = E.EntId" +
- $" left join StaffDoc H on H.STAFFID = E.SaleManId and H.EntId = E.EntId" +
- $" where rn = 1 " +
- $"{queryCondition} " +
- $"{rulesql})AAA";
- var sql2 = " where AAA.rownum>" + start + " and AAA.rownum<" + end;
- DataAccess.GetValues(sql + sql1 + sql2, ref dt, param.ToArray(), out var msg);
- IList<GSPNotAcpMT> result = new List<GSPNotAcpMT>();
- if (dt != null && dt.Rows.Count > 0)
- {
- result = ModelConvertHelper<GSPNotAcpMT>.ConvertToModel(dt);
- }
- var jsonData = JsonConvert.SerializeObject(result);
- var countSql =
- $"select count(1) from " +
- sql1;
- var count = DataAccess.GetRowCountDefine(countSql, param.ToArray(), out var msg1);
- return Json(new
- {
- items = JsonConvert.DeserializeObject(jsonData),
- sum = new { },
- totalCount = count
- });
- }
- [AuthPermission]
- [HttpPost]
- [Route("gsnotacpdt")]
- public JsonResult GspNotAcpDataDT(string staffid, [FromBody] dynamic data)
- {
- var userid = getStaff("userid");
- //判断参数是否合法
- if (string.IsNullOrEmpty(userid))
- {
- return Json(new
- {
- success = 0,
- msg = "没有登陆",
- timeout = 1
- });
- }
- var sql0 = "select * from sup_Account where id = @userid";
- var param0 = new List<SqlParameter>();
- param0.Add(new SqlParameter("userid", int.Parse(userid)));
- var dt0 = new DataTable();
- DataAccess.GetValues(sql0, ref dt0, param0.ToArray(), out _);
- var purStaffId = string.Empty;
- if (dt0 != null && dt0.Rows.Count > 0)
- {
- purStaffId = dt0.Rows[0]["PurStaffId"].ToString();
- }
- List<QueryFilter> filterList = new List<QueryFilter>();
- int pageIndex = 1;
- int pageSize = 15;
- string sortField;
- int sortDirection = 0;
- string[] sumFields;
- if (data != null)
- {
- if (data.filters.Count > 0)
- {
- var list = JsonConvert.SerializeObject(data.filters);
- filterList = JsonConvert.DeserializeObject<List<QueryFilter>>(list);
- }
- pageIndex = data.pageIndex;
- pageSize = data.pageSize;
- sortField = data.sortField;
- sortDirection = data.sortDirection;
- sumFields = data.sumFields.ToObject<string[]>();
- }
- var isAce = sortDirection == 0;
- var queryCondition = string.Empty;
- var param = new List<SqlParameter>();
- var start = (pageIndex - 1) * pageSize;
- var end = (start + 1 + pageSize);
- var dt = new DataTable();
- if (filterList != null)
- {
- queryCondition = QueryFilter.getFilterSqlParam(filterList.ToArray(), out param, new PurInMt(), "A.");
- }
- string rulesql = FilterTranslator.ruleSql(ref param);
- var sql =
- $"select * from ";
- var sql1 = $"(select row_number() over (order by A.BillNo desc) as rownum," +
- $"H.StaffName,F.contact,G.contact as oppcontact,H1.GoodsName," +
- $"E.K_ContactId,E.OppContId,A.*,B.BillCode from GSPNOTACPDT A" +
- $" left join GSPNOTACPMT B on A.BillNo = B.BillNo and B.EntId = A.EntId" +
- $" left join GSPINDT C on C.BillNo = B.RfBillNo and C.BillSn = A.BillSn and C.EntId = A.EntId" +//----订单验货
- $" left join PURNOTESMT D on D.BillNo = C.RfBillNo and D.EntId = C.EntId" +//--订单收货
- $" left join PurOrderMT E on E.BillCode = D.K_BillCode and E.EntId = D.EntId" +
- $" left join contactdoc F on F.ContactId = E.K_ContactId and F.EntId = E.EntId" +
- $" left join contactdoc G on G.ContactId = E.OppContId and G.EntId = E.EntId" +
- $" left join StaffDoc H on H.STAFFID = E.SaleManId and H.EntId = E.EntId" +
- $" left join GoodsDoc H1 on H1.GoodsId = A.GoodsId " +
- $"where 1=1 " +
- $"{queryCondition} " +
- $"{rulesql})AAA";
- var sql2 = " where AAA.rownum>" + start + " and AAA.rownum<" + end;
- DataAccess.GetValues(sql + sql1 + sql2, ref dt, param.ToArray(), out var msg);
- IList<Temp2> result = new List<Temp2>();
- if (dt != null && dt.Rows.Count > 0)
- {
- result = ModelConvertHelper<Temp2>.ConvertToModel(dt);
- }
- var jsonData = JsonConvert.SerializeObject(result);
- var countSql =
- $"select count(1) from " +
- sql1;
- var count = DataAccess.GetRowCountDefine(countSql, param.ToArray(), out var msg1);
- return Json(new
- {
- items = result,
- sum = new { },
- totalCount = count,
- result = msg
- });
- }
- }
- internal class Temp
- {
- public string Key => Guid.NewGuid().ToString();
- public int BillNo { get; set; }
- public string Dates { get; set; }
- public string Address { get; set; }
- public string AccountRealName { get; set; }
- public string Delivery { get; set; }
- public string PayType { get; set; }
- public string Summaries { get; set; }
- public string BillCode { get; set; }
- public string InmtState { get; set; }
- public decimal k_pay { get; set; }
- public string k_kdcode { get; set; }
- public string SaleMan { get; set; }
- public string Supplier { get; set; }
- }
- internal class Temp2
- {
- public int BillNo { get; set; }
- public int BillSn { get; set; }
- public string EntId { get; set; }
- public int BillSort { get; set; }
- public string GoodsId { get; set; }
- public decimal Num { get; set; }
- public string unit { get; set; }
- public int Meas { get; set; }
- public string AngleId { get; set; }
- public string BatchCode { get; set; }
- public string ProduceDate { get; set; }
- public string SterilCode { get; set; }
- public string ValDate { get; set; }
- public string ArrivalDate { get; set; }
- public string ApprovalNo { get; set; }
- public decimal CheckNum { get; set; }
- public string Zhilbz { get; set; }
- public string Zhilwt { get; set; }
- public string AcceptId { get; set; }
- public string Yansrq { get; set; }
- public string Remark { get; set; }
- public string OwnerId { get; set; }
- public string constraint { get; set; }
- public string BillCode { get; set; }
- public string GoodsName { get; set; }
- public string StaffName { get; set; }
- public string Contact { get; set; }
- public string OppContact { get; set; }
- }
- internal class Temp3
- {
- public string Key => Guid.NewGuid().ToString();
- public int BillNo { get; set; }
- public string BillCode { get; set; }
- public string Dates { get; set; }
- public string SaleManId { get; set; }
- public decimal Amount { get; set; }
- public string IsInvoice { get; set; }
- public string OrgId { get; set; }
- public string DeptId { get; set; }
- public string Invoice { get; set; }
- public string OlderNo { get; set; }
- public string K_DFBillCode { get; set; }
- public string K_BillCode { get; set; }
- public string WareManId { get; set; }
- public string OppContId { get; set; }
- public string PayOrgId { get; set; }
- public string Contact { get; set; }
- public string OppContact { get; set; }
- public string StaffName { get; set; }
- }
- internal class Temp4
- {
- public string Key => Guid.NewGuid().ToString();
- public int BillNo { get; set; }
- public int BillSn { get; set; }
- public string GoodsId { get; set; }
- public decimal Num { get; set; }
- public string GoodsName { get; set; }
- public decimal Amount { get; set; }
- public string IsInvoice { get; set; }
- public string Remark { get; set; }
- public string Kdcode { get; set; }
- }
- }
- public class Filter
- {
- public string field { get; set; }
- public string operate { get; set; }
- public string value { get; set; }
- }
|