|
|
using NFine.Code; using NFine.Data.Extensions; using NFine.Domain.Entity.ProductManage; using NFine.Domain.IRepository.ProductManage; using NFine.Repository.ProductManage; using System; using System.Collections.Generic; using System.Data; using System.Linq;
namespace NFine.Application.ProductManage { public class MaintainApp { private IICSProductRepository service = new MaintainRepository();
public List<ICSProductEntity> GetList(Pagination pagination, string queryJson) { var expression = ExtLinq.True<ICSProductEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["keyword"].IsEmpty()) { string keyword = queryParam["keyword"].ToString(); expression = expression.And(t => t.ProductSN.Contains(keyword)); } if (!queryParam["warehouse"].IsEmpty()) { string warehouse = queryParam["warehouse"].ToString(); switch (warehouse) { case "0": break; case "10": case "12": case "18": expression = expression.And(t => t.WhCode == warehouse); break; default: break; } } if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleFullName == "客户") { expression = expression.And(t => t.WhCode == "10"); } //return service.IQueryable(expression).OrderBy(t => t.ProductSN).ToList();
return service.FindList(expression, pagination).OrderBy(t => t.Weight).ToList(); }
public List<ICSProductEntity> GetList(string keyword = "", string keyword2 = "") { var expression = ExtLinq.True<ICSProductEntity>(); if (!string.IsNullOrEmpty(keyword) && !string.IsNullOrEmpty(keyword2)) { expression = expression.And(t => t.ProductSN.Contains(keyword)); expression = expression.And(t => t.ProductSN.Contains(keyword2)); } return service.IQueryable(expression).OrderBy(t => t.ProductSN).ToList(); }
public DataTable GetList2(string invIDs) { DataTable dt = new DataTable(); string sql = @"SELECT F_Id,ProductSN,Measurement,Other AS Sort,Location,Price,
CAST(InvQty AS INT) AS Qty,Weight AS FinishedWeight,GrossWeight AS RoughWeight, Shape,CertificateNo,Color,Clarity,Polish FROM ICSProduct WHERE F_Id IN ({0})";
sql = string.Format(sql, invIDs); dt = SqlHelper.GetDataTableBySql(sql); if (dt == null || dt.Rows.Count <= 0) throw new Exception("No exportable data."); return dt; }
public DataTable GetList2All() { DataTable dt = new DataTable(); string sql = @"SELECT F_Id,ProductSN,Measurement,Other AS Sort,Location,Price,
CAST(InvQty AS INT) AS Qty,Weight AS FinishedWeight,GrossWeight AS RoughWeight, Shape,CertificateNo,Color,Clarity,Polish,(case when WHCode ='12' then '评估仓' when WHCode ='10' then '成品仓' else '' end ) as WHCode FROM ICSProduct";
dt = SqlHelper.GetDataTableBySql(sql); if (dt == null || dt.Rows.Count <= 0) throw new Exception("No exportable data."); return dt; }
public List<ICSProductEntity> GetListPS(Pagination pagination, string queryJson) { var expression = ExtLinq.True<ICSProductEntity>(); var queryParam = queryJson.ToJObject(); if (!queryParam["weight"].IsEmpty()) { string weight = queryParam["weight"].ToString(); decimal start = 0; decimal end = 0; switch (weight) { case "0": break; case "1": start = decimal.Parse("0.5"); end = decimal.Parse("0.5"); //expression = expression.And(t => t.Weight >= start && t.Weight <= end);
expression = expression.And(t => t.Weight <= end); break; case "2": start = decimal.Parse("0.5"); end = decimal.Parse("0.69"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "3": start = decimal.Parse("07"); end = decimal.Parse("089"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "4": start = decimal.Parse("0.9"); end = decimal.Parse("0.99"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "5": start = decimal.Parse("1.0"); end = decimal.Parse("1.49"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "6": start = decimal.Parse("1.5"); end = decimal.Parse("1.99"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "7": start = decimal.Parse("2.0"); end = decimal.Parse("2.99"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "8": start = decimal.Parse("3.0"); end = decimal.Parse("3.99"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "9": start = decimal.Parse("4.0"); end = decimal.Parse("4.99"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; case "10": start = decimal.Parse("5.0"); end = decimal.Parse("5.99"); expression = expression.And(t => t.Weight >= start && t.Weight <= end); break; default: break; } } if (!queryParam["shape"].IsEmpty()) { string shape = queryParam["shape"].ToString(); switch (shape) { case "0": break; case "1": expression = expression.And(t => t.Shape == "Round"); break; case "2": expression = expression.And(t => t.Shape == "Pear"); break; case "3": expression = expression.And(t => t.Shape == "Oval"); break; case "4": expression = expression.And(t => t.Shape == "Heart"); break; case "5": expression = expression.And(t => t.Shape == "Emerald"); break; case "6": expression = expression.And(t => t.Shape == "Radiant"); break; case "7": expression = expression.And(t => t.Shape == "Asscher"); break; case "8": expression = expression.And(t => t.Shape == "Princess"); break; case "9": expression = expression.And(t => t.Shape == "Cushion"); break; default: break; } } if (!queryParam["color"].IsEmpty()) { string color = queryParam["color"].ToString(); switch (color) { case "0": break; case "1": expression = expression.And(t => t.Color.Contains("D")); break; case "2": expression = expression.And(t => t.Color.Contains("E")); break; case "3": expression = expression.And(t => t.Color.Contains("F")); break; case "4": expression = expression.And(t => t.Color.Contains("G")); break; case "5": expression = expression.And(t => t.Color.Contains("H")); break; case "6": expression = expression.And(t => t.Color.Contains("I")); break; case "7": expression = expression.And(t => t.Color.Contains("J")); break; case "8": expression = expression.And(t => t.Color.Contains("K")); break; case "9": expression = expression.And(t => t.Color.Contains("L")); break; case "10": expression = expression.And(t => t.Color.Contains("M")); break; case "11": expression = expression.And(t => t.Color.Contains("N")); break; default: break; } } if (!queryParam["clarity"].IsEmpty()) { string clarity = queryParam["clarity"].ToString(); switch (clarity) { case "0": break; case "1": expression = expression.And(t => t.Clarity == "IF"); break; case "2": expression = expression.And(t => t.Clarity == "VVS1"); break; case "3": expression = expression.And(t => t.Clarity == "VVS2"); break; case "4": expression = expression.And(t => t.Clarity == "VS1"); break; case "5": expression = expression.And(t => t.Clarity == "VS2"); break; case "6": expression = expression.And(t => t.Clarity == "SI1"); break; case "7": expression = expression.And(t => t.Clarity == "SI2"); break; case "8": expression = expression.And(t => t.Clarity == "SI3"); break; case "9": expression = expression.And(t => t.Clarity == "I1"); break; case "10": expression = expression.And(t => t.Clarity == "I2"); break; case "11": expression = expression.And(t => t.Clarity == "I3"); break; default: break; } } //if (!queryParam["lab"].IsEmpty())
//{
// string lab = queryParam["lab"].ToString();
// switch (lab)
// {
// case "0":
// break;
// case "1":
// expression = expression.And(t => t.Lab == "FL");
// break;
// case "2":
// expression = expression.And(t => t.Shape == "IF");
// break;
// default:
// break;
// }
// //expression = expression.And(t => t.F_Date >= startTime && t.F_Date <= endTime);
//}
if (!queryParam["polish"].IsEmpty()) { string polish = queryParam["polish"].ToString(); switch (polish) { case "0": break; case "1": expression = expression.And(t => t.Polish == "EX"); break; case "2": expression = expression.And(t => t.Polish == "VG"); break; case "3": expression = expression.And(t => t.Polish == "G"); break; case "4": expression = expression.And(t => t.Polish == "F"); break; case "5": expression = expression.And(t => t.Polish == "P"); break; case "6": expression = expression.And(t => t.Polish == "N/A"); break; default: break; } } if (!queryParam["symmerty"].IsEmpty()) { string symmerty = queryParam["symmerty"].ToString(); switch (symmerty) { case "0": break; case "1": expression = expression.And(t => t.Symmetry == "EX"); break; case "2": expression = expression.And(t => t.Symmetry == "VG"); break; case "3": expression = expression.And(t => t.Symmetry == "G"); break; case "4": expression = expression.And(t => t.Symmetry == "F"); break; case "5": expression = expression.And(t => t.Symmetry == "P"); break; case "6": expression = expression.And(t => t.Symmetry == "N/A"); break; default: break; } } if (!queryParam["cut"].IsEmpty()) { string cut = queryParam["cut"].ToString(); switch (cut) { case "0": break; case "1": expression = expression.And(t => t.Cut == "EX"); break; case "2": expression = expression.And(t => t.Cut == "VG"); break; case "3": expression = expression.And(t => t.Cut == "G"); break; case "4": expression = expression.And(t => t.Cut == "F"); break; case "5": expression = expression.And(t => t.Cut == "P"); break; case "6": expression = expression.And(t => t.Cut == "N/A"); break; default: break; } } if (!queryParam["location"].IsEmpty()) { string location = queryParam["location"].ToString(); switch (location) { case "0": break; case "1": expression = expression.And(t => t.Location == "ShangHai Warehouse"); break; case "2": expression = expression.And(t => t.Location == "HongKong Warehouse"); break; case "3": expression = expression.And(t => t.Location == "U.S.A Warehouse"); break; default: break; } } if (!queryParam["sort"].IsEmpty()) { string sort = queryParam["sort"].ToString(); switch (sort) { case "0": break; case "1": expression = expression.And(t => t.Other == "Rough"); break; case "2": expression = expression.And(t => t.Other == "Polished"); break; default: break; } } if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleFullName == "客户") { expression = expression.And(t => t.WhCode == "10"); } expression = expression.And(t => t.IsLock == false); return service.FindList(expression, pagination).OrderBy(t => t.Weight).ToList(); }
public ICSProductEntity GetForm(string keyValue) { return service.FindEntity(keyValue); }
public void DeleteForm(string keyValue) { service.Delete(t => t.F_Id == keyValue); }
public void SubmitForm(ICSProductEntity productEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { productEntity.Modify(keyValue); service.Update(productEntity); } else { productEntity.Create(); service.Insert(productEntity); } }
public void PrsSell(List<ICSProductEntity> ProductEntityList) { foreach (ICSProductEntity ProductEntity in ProductEntityList) { service.Update(ProductEntity); } } } }
|