Commit 96f5c613 by Neo Turing

优化

parent de39ea68
...@@ -20,7 +20,7 @@ namespace Kivii.Third.Scjgj ...@@ -20,7 +20,7 @@ namespace Kivii.Third.Scjgj
public const string TableNamePlanUp = "PM_PLAN_UP"; public const string TableNamePlanUp = "PM_PLAN_UP";
public const string TableNameTaskSource = "PM_TASK_SOURCE"; public const string TableNameTaskSource = "PM_TASK_SOURCE";
public const string ConnectionString = "Data Source=218.94.159.228:8083/sjdb;User Id=sjqzsfzydbl;Password=admin;"; //public const string ConnectionString = "Data Source=218.94.159.228:8083/sjdb;User Id=sjqzsfzydbl;Password=admin;";
public const string ConnectionProviderName = "Oracle"; //public const string ConnectionProviderName = "Oracle";
} }
} }
using Kivii.Funq; using Kivii.Funq;
using Kivii.Lims.Entities;
using Kivii.Linq; using Kivii.Linq;
using Kivii.Third.Scjgj.Entities; using Kivii.Third.Scjgj.Entities;
using System; using System;
...@@ -25,6 +24,7 @@ namespace Kivii.Third.Scjgj ...@@ -25,6 +24,7 @@ namespace Kivii.Third.Scjgj
rtns.ConvertGetCary(item); rtns.ConvertGetCary(item);
rtns.ConvertGetPro(item); rtns.ConvertGetPro(item);
rtns.ConvertGetGoods(item); rtns.ConvertGetGoods(item);
rtns.ConvertGetSampling(item);
rtns.ConvertGetRemarks(item); rtns.ConvertGetRemarks(item);
break; break;
case "2": case "2":
...@@ -33,6 +33,7 @@ namespace Kivii.Third.Scjgj ...@@ -33,6 +33,7 @@ namespace Kivii.Third.Scjgj
rtns.ConvertGetCary(item); rtns.ConvertGetCary(item);
rtns.ConvertGetPro(item); rtns.ConvertGetPro(item);
rtns.ConvertGetGoods(item); rtns.ConvertGetGoods(item);
rtns.ConvertGetSampling(item);
rtns.ConvertGetRemarks(item); rtns.ConvertGetRemarks(item);
break; break;
case "3": case "3":
...@@ -50,6 +51,7 @@ namespace Kivii.Third.Scjgj ...@@ -50,6 +51,7 @@ namespace Kivii.Third.Scjgj
rtns.ConvertGetCary(item); rtns.ConvertGetCary(item);
rtns.ConvertGetPro(item); rtns.ConvertGetPro(item);
rtns.ConvertGetGoods(item); rtns.ConvertGetGoods(item);
rtns.ConvertGetSampling(item);
rtns.ConvertGetRemarks(item); rtns.ConvertGetRemarks(item);
break; break;
default: default:
...@@ -70,8 +72,7 @@ namespace Kivii.Third.Scjgj ...@@ -70,8 +72,7 @@ namespace Kivii.Third.Scjgj
if (conn == null) if (conn == null)
{ {
connDispose = true; connDispose = true;
var factory = Kivii.Linq.LinqUtils.GetLinqConnectionFactory(Configs.ConnectionString, Configs.ConnectionProviderName); conn = KiviiContext.GetOpenedDbConnection<Plan>();
conn = factory.OpenDbConnection();
} }
item.Plan = GetPlan(conn, item.PLAN_CODE); item.Plan = GetPlan(conn, item.PLAN_CODE);
item.Plan.TaskSource = GetTaskSource(conn, item.Plan.TASK_SOURCE); item.Plan.TaskSource = GetTaskSource(conn, item.Plan.TASK_SOURCE);
...@@ -319,6 +320,7 @@ namespace Kivii.Third.Scjgj ...@@ -319,6 +320,7 @@ namespace Kivii.Third.Scjgj
item.ProduceUnit = new ProduceUnit(); item.ProduceUnit = new ProduceUnit();
item.ExecUint = new ExecUint(); item.ExecUint = new ExecUint();
item.Other= new Other(); item.Other= new Other();
item.EcPlatform = new EcPlatform();
if (item.CARY_ID != null) if (item.CARY_ID != null)
{ {
item.Cary = GetCaryById(conn, item.CARY_ID); item.Cary = GetCaryById(conn, item.CARY_ID);
...@@ -349,6 +351,7 @@ namespace Kivii.Third.Scjgj ...@@ -349,6 +351,7 @@ namespace Kivii.Third.Scjgj
item.ProduceUnit = new ProduceUnit(); item.ProduceUnit = new ProduceUnit();
item.ExecUint = new ExecUint(); item.ExecUint = new ExecUint();
item.Other= new Other(); item.Other= new Other();
item.EcPlatform = new EcPlatform();
if (item.CARY_ID != null) if (item.CARY_ID != null)
{ {
item.Cary = GetCaryById(conn, item.CARY_ID); item.Cary = GetCaryById(conn, item.CARY_ID);
...@@ -379,6 +382,7 @@ namespace Kivii.Third.Scjgj ...@@ -379,6 +382,7 @@ namespace Kivii.Third.Scjgj
item.ProduceUnit = new ProduceUnit(); item.ProduceUnit = new ProduceUnit();
item.ExecUint = new ExecUint(); item.ExecUint = new ExecUint();
item.Other= new Other(); item.Other= new Other();
item.EcPlatform = new EcPlatform();
if (item.CARY_ID != null) if (item.CARY_ID != null)
{ {
item.Cary = GetCaryById(conn, item.CARY_ID); item.Cary = GetCaryById(conn, item.CARY_ID);
...@@ -414,6 +418,7 @@ namespace Kivii.Third.Scjgj ...@@ -414,6 +418,7 @@ namespace Kivii.Third.Scjgj
item.ProduceUnit = new ProduceUnit(); item.ProduceUnit = new ProduceUnit();
item.ExecUint = new ExecUint(); item.ExecUint = new ExecUint();
item.Other= new Other(); item.Other= new Other();
item.EcPlatform = new EcPlatform();
if (item.CARY_ID != null) if (item.CARY_ID != null)
{ {
item.Cary = GetCaryById(conn, item.CARY_ID); item.Cary = GetCaryById(conn, item.CARY_ID);
...@@ -682,7 +687,8 @@ namespace Kivii.Third.Scjgj ...@@ -682,7 +687,8 @@ namespace Kivii.Third.Scjgj
rtns.Metadata["Protection"] = item.GOODS_PROTECTION_REQ; // 防护保存 rtns.Metadata["Protection"] = item.GOODS_PROTECTION_REQ; // 防护保存
rtns.Metadata["IsExport"] = item.GOODS_EXPORT; // 是否出口 rtns.Metadata["IsExport"] = item.GOODS_EXPORT; // 是否出口
rtns.Metadata["IsReturn"] = item.GOODS_NEEDS_RETREAT; // 是否退样 rtns.Metadata["IsReturn"] = item.GOODS_NEEDS_RETREAT; // 是否退样
rtns.Metadata["IsQualifiedAndPending"] = item.GOODS_CAN_SALE; // 合格待销 bool.TryParse(item.GOODS_CAN_SALE, out var IsQualifiedAndPending);
rtns.Metadata["IsQualifiedAndPending"] = IsQualifiedAndPending?"true":"false"; // 合格待销
rtns.Metadata["IsCommissionProcess"] = item.GOODS_MAN_CONSIGNMENT; // 委托加工 rtns.Metadata["IsCommissionProcess"] = item.GOODS_MAN_CONSIGNMENT; // 委托加工
return rtns; return rtns;
} }
...@@ -723,7 +729,7 @@ namespace Kivii.Third.Scjgj ...@@ -723,7 +729,7 @@ namespace Kivii.Third.Scjgj
//rtns.Metadata["PurchaseAmount"] = item.PRO_JH_KC; // 进货量 //rtns.Metadata["PurchaseAmount"] = item.PRO_JH_KC; // 进货量
//rtns.Metadata["InventoryAmount"] = item.PRO_JH_KC; // 存货量 //rtns.Metadata["InventoryAmount"] = item.PRO_JH_KC; // 存货量
//rtns.Metadata["SalesAmount"] = // 销售量 //rtns.Metadata["SalesAmount"] = // 销售量
rtns.Metadata["SalesPrice"] = item.GOODS_UNIT_PRICE; // 销售价 rtns.Metadata["SalesPrice"] = item.SALE_PRICE; // 销售价
//rtns.Metadata["TechParameter"] = // 工艺参数 //rtns.Metadata["TechParameter"] = // 工艺参数
return rtns; return rtns;
} }
...@@ -735,8 +741,8 @@ namespace Kivii.Third.Scjgj ...@@ -735,8 +741,8 @@ namespace Kivii.Third.Scjgj
internal static Report ConvertGetSampling(this Report rtns, PlanDetail item) internal static Report ConvertGetSampling(this Report rtns, PlanDetail item)
{ {
if (rtns.Metadata.IsNullOrEmpty()) rtns.Metadata = new Dictionary<string, string>(); if (rtns.Metadata.IsNullOrEmpty()) rtns.Metadata = new Dictionary<string, string>();
//rtns.Metadata["InvoiceNo"] = // 发票号 rtns.Metadata["InvoiceNo"] = item.INVOICE_CODE; // 发票号
//rtns.Metadata["BillingCompany"] = // 开票单位 rtns.Metadata["BillingCompany"] = item.INVOICE_UNIT; // 开票单位
//rtns.Metadata["ShopLicense"] = // 直播 ID 号 //rtns.Metadata["ShopLicense"] = // 直播 ID 号
//rtns.Metadata["MarketingName"] = // 直播昵称 //rtns.Metadata["MarketingName"] = // 直播昵称
rtns.Metadata["SamplingPlatform"] = item.EcPlatform.EC_PLATFORM_NAME; // 所属平台 rtns.Metadata["SamplingPlatform"] = item.EcPlatform.EC_PLATFORM_NAME; // 所属平台
......
...@@ -55,18 +55,13 @@ ...@@ -55,18 +55,13 @@
<ItemGroup> <ItemGroup>
<Compile Include="Configs.cs" /> <Compile Include="Configs.cs" />
<Compile Include="Entities\OtherEntity.cs" /> <Compile Include="Entities\OtherEntity.cs" />
<Compile Include="Entities\Report.cs" />
<Compile Include="Extensions.cs" /> <Compile Include="Extensions.cs" />
<Compile Include="Entities\Plan.cs" /> <Compile Include="Entities\Plan.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RestfulPlan.cs" /> <Compile Include="RestfulPlan.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Kivii.Biz.Lims\Src\Kivii.Biz.Lims.V4.5.csproj">
<Project>{a1971816-ee6f-4558-8923-b1b85779cb7f}</Project>
<Name>Kivii.Biz.Lims.V4.5</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" /> <None Include="App.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Resources\抽样系统中间库数据接口文档-v20210219.docx" /> <None Include="Resources\抽样系统中间库数据接口文档-v20210219.docx" />
......
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2024.6270")] [assembly: AssemblyVersion("5.4.2024.6280")]
[assembly: AssemblyFileVersion("5.4.2024.6270")] [assembly: AssemblyFileVersion("5.4.2024.6280")]
using Kivii.Lims.Entities; using Kivii.Linq;
using Kivii.Linq;
using Kivii.Testing; using Kivii.Testing;
using Kivii.Third.Scjgj.Entities; using Kivii.Third.Scjgj.Entities;
using Kivii.Web; using Kivii.Web;
...@@ -26,27 +25,24 @@ namespace Kivii.Third.Scjgj ...@@ -26,27 +25,24 @@ namespace Kivii.Third.Scjgj
{ {
var rtns = new RestfulQueryResponse<Plan>(); var rtns = new RestfulQueryResponse<Plan>();
rtns.Results = new List<Plan>(); rtns.Results = new List<Plan>();
var factory = Kivii.Linq.LinqUtils.GetLinqConnectionFactory(Configs.ConnectionString, Configs.ConnectionProviderName); var conn = KiviiContext.GetOpenedDbConnection<Plan>();
using (var conn = factory.OpenDbConnection()) try
{ {
try var query = conn.From<Plan>();
{ if (!QueryValues.IsNullOrEmpty()) query.Where(o => o.PLAN_CODE.Contains(QueryValues));
var query = conn.From<Plan>(); if (Skip.HasValue && Skip.Value >= 0) query.Skip(Skip.Value);
if (!QueryValues.IsNullOrEmpty()) query.Where(o => o.PLAN_CODE.Contains(QueryValues)); if (Take.HasValue && Take.Value > 0) query.Take(Take.Value);
if (Skip.HasValue && Skip.Value >= 0) query.Skip(Skip.Value); if (!OrderBy.IsNullOrEmpty()) query.OrderBy(OrderBy);
if (Take.HasValue && Take.Value > 0) query.Take(Take.Value); rtns.Results = conn.Select(query);
if (!OrderBy.IsNullOrEmpty()) query.OrderBy(OrderBy);
rtns.Results = conn.Select(query);
rtns.Total = conn.Scalar<Plan, int>(o => Sql.Count(o.ID)); rtns.Total = conn.Scalar<Plan, int>(o => Sql.Count(o.ID));
} }
catch (Exception ex) catch (Exception ex)
{ {
throw ex;
}
} }
return rtns; return rtns;
} }
} }
...@@ -86,43 +82,27 @@ namespace Kivii.Third.Scjgj ...@@ -86,43 +82,27 @@ namespace Kivii.Third.Scjgj
{ {
var rtns = new RestfulQueryResponse<PlanDetail>(); var rtns = new RestfulQueryResponse<PlanDetail>();
rtns.Results = new List<PlanDetail>(); rtns.Results = new List<PlanDetail>();
var factory = Kivii.Linq.LinqUtils.GetLinqConnectionFactory(Configs.ConnectionString, Configs.ConnectionProviderName); var conn = KiviiContext.GetOpenedDbConnection<Plan>();
using (var conn = factory.OpenDbConnection()) try
{ {
try var query = conn.From<PlanDetail>();
{ if (!QueryValues.IsNullOrEmpty()) query.Where(o => o.PLAN_CODE.Contains(QueryValues));
var query = conn.From<PlanDetail>(); if (Skip.HasValue && Skip.Value >= 0) query.Skip(Skip.Value);
if (!QueryValues.IsNullOrEmpty()) query.Where(o => o.PLAN_CODE.Contains(QueryValues)); if (Take.HasValue && Take.Value > 0) query.Take(Take.Value);
if (Skip.HasValue && Skip.Value >= 0) query.Skip(Skip.Value); if (!OrderBy.IsNullOrEmpty()) query.OrderBy(OrderBy);
if (Take.HasValue && Take.Value > 0) query.Take(Take.Value); var results = conn.Select(query);
if (!OrderBy.IsNullOrEmpty()) query.OrderBy(OrderBy); int total = 0;
var results = conn.Select(query); if (!QueryValues.IsNullOrEmpty()) total = conn.Scalar<PlanDetail, int>(o => Sql.Count(o.ID), o => o.PLAN_CODE.Contains(QueryValues));
int total = 0; else total = conn.Scalar<PlanDetail, int>(o => Sql.Count(o.ID));
if (!QueryValues.IsNullOrEmpty()) total = conn.Scalar<PlanDetail, int>(o => Sql.Count(o.ID), o => o.PLAN_CODE.Contains(QueryValues)); rtns.Results = results;
else total = conn.Scalar<PlanDetail, int>(o => Sql.Count(o.ID)); rtns.Total = total;
rtns.Results = results;
rtns.Total = total;
}
catch (Exception ex)
{
}
} }
catch (Exception ex)
{
throw ex;
}
return rtns; return rtns;
//var conn = KiviiContext.GetOpenedDbConnection<Plan>();
//var query = conn.From<PlanDetail>();
//if (!QueryValues.IsNullOrEmpty()) query.Where(o => o.PLAN_CODE.Contains(QueryValues));
//if (Skip.HasValue && Skip.Value >= 0) query.Skip(Skip.Value);
//if (Take.HasValue && Take.Value > 0) query.Take(Take.Value);
//if (!OrderBy.IsNullOrEmpty()) query.OrderBy(OrderBy);
//var results = conn.Select(query);
//var total = conn.Scalar<PlanDetail, int>(o => Sql.Count(o.ID));
//var rtns = new RestfulQueryResponse<PlanDetail>();
//rtns.Results = new List<PlanDetail>();
//rtns.Results = results;
//rtns.Total = total;
//return rtns;
} }
} }
...@@ -139,27 +119,24 @@ namespace Kivii.Third.Scjgj ...@@ -139,27 +119,24 @@ namespace Kivii.Third.Scjgj
BatchNumber.ThrowIfNullOrEmpty("请传入计划编号"); BatchNumber.ThrowIfNullOrEmpty("请传入计划编号");
PlanNumber.ThrowIfNullOrEmpty("请传入批次号"); PlanNumber.ThrowIfNullOrEmpty("请传入批次号");
var result = new PlanDetail(); var result = new PlanDetail();
var factory = Kivii.Linq.LinqUtils.GetLinqConnectionFactory(Configs.ConnectionString, Configs.ConnectionProviderName); var conn = KiviiContext.GetOpenedDbConnection<Plan>();
using (var conn = factory.OpenDbConnection()) try
{ {
try var query = conn.From<PlanDetail>();
{ query.Where(o => o.PLAN_CODE == BatchNumber && o.LOT_NUM == PlanNumber);
var query = conn.From<PlanDetail>(); var planDetail = conn.Single(query);
query.Where(o => o.PLAN_CODE == BatchNumber && o.LOT_NUM == PlanNumber); if (planDetail == null) throw new Exception("未找到此任务单");
var planDetail = conn.Single(query); result = planDetail.DataFilling(conn);
if (planDetail == null) throw new Exception("未找到此任务单");
result = planDetail.DataFilling(conn);
}
catch (Exception ex)
{
throw ex;
}
} }
catch (Exception ex)
{
throw ex;
}
if (!ToReport) if (!ToReport)
{ {
var rtns=new RestfulReadResponse<PlanDetail>(); var rtns = new RestfulReadResponse<PlanDetail>();
rtns.Result = result; rtns.Result = result;
return rtns; return rtns;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment