Browse Source

master创建

master
lvzb 1 year ago
parent
commit
e3159e5d52
  1. 1
      Common/CK.SCP.Common.csproj
  2. 2
      Common/MyWebSmtpMail.cs
  3. 8
      Common/app.config
  4. 126
      Controller/CK.SCP.Controller.csproj
  5. 66
      Controller/Properties/Settings.Designer.cs
  6. 18
      Controller/Properties/Settings.settings
  7. 22
      Controller/ResultObject.cs
  8. 799
      Controller/SCP_ASK_CONTROLLER.cs
  9. 755
      Controller/SCP_ASN_CONTROLLER.cs
  10. 606
      Controller/SCP_BARCODE_CONTROLLER.cs
  11. 34
      Controller/SCP_BILLCODE_CONTROLLER.cs
  12. 84
      Controller/SCP_CONTRACT_CONTROLLER.cs
  13. 59
      Controller/SCP_EXCEL_CONTROLLER.cs
  14. 336
      Controller/SCP_INVOICE_CONTROLLER.cs
  15. 81
      Controller/SCP_PALLET_CONTROLLER.cs
  16. 7751
      Controller/SCP_PO_CONTROLLER.cs
  17. 64
      Controller/SCP_REPORT_CONTROLLER.cs
  18. 998
      Controller/SCP_TA_LANGUAGE_CONTROLLER.cs
  19. 12
      Controller/SCP_TB_VENDER_CONTROLLER.cs
  20. 4
      Controller/SCP_TS_BARCODE_CONTROLLER.cs
  21. 63
      Controller/UniApiController.cs
  22. 6
      Controller/Web References/BomList/JsonService.disco
  23. 2062
      Controller/Web References/BomList/JsonService.wsdl
  24. 1610
      Controller/Web References/BomList/Reference.cs
  25. 7
      Controller/Web References/BomList/Reference.map
  26. 6
      Controller/Web References/BomList1/JsonService.disco
  27. 2062
      Controller/Web References/BomList1/JsonService.wsdl
  28. 1610
      Controller/Web References/BomList1/Reference.cs
  29. 7
      Controller/Web References/BomList1/Reference.map
  30. 6
      Controller/Web References/BomListcompany/JsonService.disco
  31. 2062
      Controller/Web References/BomListcompany/JsonService.wsdl
  32. 1610
      Controller/Web References/BomListcompany/Reference.cs
  33. 7
      Controller/Web References/BomListcompany/Reference.map
  34. 6
      Controller/Web References/BomVersion/JsonService.disco
  35. 1333
      Controller/Web References/BomVersion/JsonService.wsdl
  36. 1064
      Controller/Web References/BomVersion/Reference.cs
  37. 7
      Controller/Web References/BomVersion/Reference.map
  38. 6
      Controller/Web References/BomVersion1/JsonService.disco
  39. 1816
      Controller/Web References/BomVersion1/JsonService.wsdl
  40. 1426
      Controller/Web References/BomVersion1/Reference.cs
  41. 7
      Controller/Web References/BomVersion1/Reference.map
  42. 41
      Controller/app.config
  43. 3
      Models/AppBoxEntity/AppBoxContext.cs
  44. 4
      Models/AppBoxEntity/User.cs
  45. 33
      Models/AppBoxEntity/UserToken.cs
  46. 43
      Models/CK.SCP.Models.csproj
  47. 2
      Models/EntitiesFactory.cs
  48. 9
      Models/Enums/SCP_ENUM.cs.cs
  49. 4
      Models/Enums/UniApiType.cs
  50. 11
      Models/GlobalConfig.cs
  51. 18
      Models/ScpCache.cs
  52. 79
      Models/ScpEntities.cs
  53. 23
      Models/ScpEntity/ExcelExportEnttity/SCP_APPLIANCE_EXPOPT.cs
  54. 2
      Models/ScpEntity/ExcelExportEnttity/SCP_INVOICE_DETAIL_EXPORT.cs
  55. 17
      Models/ScpEntity/ExcelExportEnttity/SCP_MAXPODC_EXPORT.cs
  56. 31
      Models/ScpEntity/ExcelExportEnttity/SCP_MAXPO_DETAIL_EXPORT.cs
  57. 23
      Models/ScpEntity/ExcelExportEnttity/SCP_MAXPO_EXPORT.cs
  58. 16
      Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs
  59. 9
      Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_EXPORT.cs
  60. 22
      Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_PART_EXPORT.cs
  61. 59
      Models/ScpEntity/PURSubcontractor.cs
  62. 26
      Models/ScpEntity/TA_ASK_SUBPART.cs
  63. 28
      Models/ScpEntity/TA_Appliance.cs
  64. 22
      Models/ScpEntity/TA_BOXTYPE.cs
  65. 2
      Models/ScpEntity/TA_CONFIG.cs
  66. 20
      Models/ScpEntity/TA_CarModel.cs
  67. 21
      Models/ScpEntity/TA_PinFan.cs
  68. 22
      Models/ScpEntity/TA_ProductionLine.cs
  69. 22
      Models/ScpEntity/TA_PurchasGroup.cs
  70. 19
      Models/ScpEntity/TA_Receiving_Information.cs
  71. 23
      Models/ScpEntity/TA_StorageLocation.cs
  72. 20
      Models/ScpEntity/TA_SubPart.cs
  73. 22
      Models/ScpEntity/TA_SubPartCode.cs
  74. 3
      Models/ScpEntity/TB_ASK.cs
  75. 2
      Models/ScpEntity/TB_ASK_DETAIL.cs
  76. 2
      Models/ScpEntity/TB_ASN_DETAIL.cs
  77. 31
      Models/ScpEntity/TB_ASN_PARTBOX.cs
  78. 3
      Models/ScpEntity/TB_INVOICE_DETAIL.cs
  79. 31
      Models/ScpEntity/TB_MAXPO.cs
  80. 19
      Models/ScpEntity/TB_MAXPO_CONSUME.cs
  81. 58
      Models/ScpEntity/TB_MAXPO_DETAIL.cs
  82. 33
      Models/ScpEntity/TB_NetPrice.cs
  83. 47
      Models/ScpEntity/TB_PALLETS_BTL.cs
  84. 43
      Models/ScpEntity/TB_PO.cs
  85. 1
      Models/ScpEntity/TB_PO_DETAIL.cs
  86. 36
      Models/ScpEntity/TB_PO_SUBDETAIL.cs
  87. 25
      Models/ScpEntity/TB_SUPPLIER_MAIL.cs
  88. 63
      Models/ScpEntity/TM_CYJ_BOM.cs
  89. 20
      Models/ScpEntity/TS_BARCODE.cs
  90. 3
      Models/ScpEntity/TS_UNI_API.cs
  91. 2
      Models/ScpEntity/V_ASN_PRINT.cs
  92. 29
      Models/ScpEntity/V_TA_APPLIANCE.cs
  93. 32
      Models/ScpEntity/V_TA_SubPartCode.cs
  94. 3
      Models/ScpEntity/V_TB_ASK.cs
  95. 4
      Models/ScpEntity/V_TB_ASK_DETAIL.cs
  96. 2
      Models/ScpEntity/V_TB_ASN.cs
  97. 4
      Models/ScpEntity/V_TB_INVOICE_DETAIL.cs
  98. 35
      Models/ScpEntity/V_TB_MAXPO.cs
  99. 33
      Models/ScpEntity/V_TB_MAXPO_CONSUME .cs
  100. 64
      Models/ScpEntity/V_TB_MAXPO_DETAIL.cs

1
Common/CK.SCP.Common.csproj

@ -11,6 +11,7 @@
<AssemblyName>CK.SCP.Common</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

2
Common/MyWebSmtpMail.cs

@ -33,7 +33,7 @@ namespace CK.SCP.Common
this.server = Server;
this.password = Password;
this.username = UserName;
this.enablessl = false;
this.enablessl = true;
this.port = Port;
this.credentials = false;
}

8
Common/app.config

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1" />
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>

126
Controller/CK.SCP.Controller.csproj

@ -11,6 +11,7 @@
<AssemblyName>CK.SCP.Controller</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -30,6 +31,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ChangKeTec.Utils">
<HintPath>D:\连接orlcor\ChangKeTec.Utils.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
@ -45,15 +49,28 @@
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Z.EntityFramework.Extensions, Version=6.13.5.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>C:\Users\Administrator\Desktop\Z.EntityFramework.Extensions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="SCP_ASK_CONTROLLER_PACKAGE.cs" />
<Compile Include="SCP_BARCODE_CONTROLLER_CUSTOM.cs" />
<Compile Include="SCP_BARCODE_CONTROLLER _SYJB.cs" />
@ -97,6 +114,26 @@
<Compile Include="SCP_V_TA_VEND_PART_CONTROLLER.cs" />
<Compile Include="UniApiController.cs" />
<Compile Include="VEND_USERController.cs" />
<Compile Include="Web References\BomList1\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Compile Include="Web References\BomListcompany\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Compile Include="Web References\BomList\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Compile Include="Web References\BomVersion1\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Models\CK.SCP.Models.csproj">
@ -111,7 +148,94 @@
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Web References\BomList1\JsonService.wsdl" />
<None Include="Web References\BomList1\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\BomListcompany\JsonService.wsdl" />
<None Include="Web References\BomListcompany\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\BomList\JsonService.wsdl" />
<None Include="Web References\BomList\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\BomVersion1\JsonService.wsdl" />
<None Include="Web References\BomVersion1\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<WebReferenceUrl Include="http://10.62.144.124:8016/JsonService.asmx%3f">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\BomList\</RelPath>
<UpdateFromURL>http://10.62.144.124:8016/JsonService.asmx%3f</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>CK_SCP_Controller_BomList_JsonService</CachedSettingsPropName>
</WebReferenceUrl>
<WebReferenceUrl Include="http://10.62.144.124:8070/JsonService.asmx%3f">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\BomList1\</RelPath>
<UpdateFromURL>http://10.62.144.124:8070/JsonService.asmx%3f</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>CK_SCP_Controller_BomList1_JsonService</CachedSettingsPropName>
</WebReferenceUrl>
<WebReferenceUrl Include="http://10.89.25.69:8085/JsonService.asmx">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\BomVersion1\</RelPath>
<UpdateFromURL>http://10.89.25.69:8085/JsonService.asmx</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>CK_SCP_Controller_BomVersion1_JsonService</CachedSettingsPropName>
</WebReferenceUrl>
<WebReferenceUrl Include="http://192.168.0.228:7602/JsonService.asmx%3f">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\BomListcompany\</RelPath>
<UpdateFromURL>http://192.168.0.228:7602/JsonService.asmx%3f</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>CK_SCP_Controller_BomListcompany_JsonService</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<ItemGroup>
<None Include="Web References\BomVersion1\JsonService.disco" />
</ItemGroup>
<ItemGroup>
<None Include="Web References\BomList\JsonService.disco" />
</ItemGroup>
<ItemGroup>
<None Include="Web References\BomListcompany\JsonService.disco" />
</ItemGroup>
<ItemGroup>
<None Include="Web References\BomList1\JsonService.disco" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

66
Controller/Properties/Settings.Designer.cs

@ -0,0 +1,66 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace CK.SCP.Controller.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://10.89.25.69:8085/JsonService.asmx")]
public string CK_SCP_Controller_BomVersion1_JsonService {
get {
return ((string)(this["CK_SCP_Controller_BomVersion1_JsonService"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://10.62.144.124:8016/JsonService.asmx")]
public string CK_SCP_Controller_BomList_JsonService {
get {
return ((string)(this["CK_SCP_Controller_BomList_JsonService"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://192.168.0.228:7602/JsonService.asmx")]
public string CK_SCP_Controller_BomListcompany_JsonService {
get {
return ((string)(this["CK_SCP_Controller_BomListcompany_JsonService"]));
}
}
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
[global::System.Configuration.DefaultSettingValueAttribute("http://10.62.144.124:8070/JsonService.asmx")]
public string CK_SCP_Controller_BomList1_JsonService {
get {
return ((string)(this["CK_SCP_Controller_BomList1_JsonService"]));
}
}
}
}

18
Controller/Properties/Settings.settings

@ -0,0 +1,18 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="CK.SCP.Controller.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="CK_SCP_Controller_BomVersion1_JsonService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://10.89.25.69:8085/JsonService.asmx</Value>
</Setting>
<Setting Name="CK_SCP_Controller_BomList_JsonService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://10.62.144.124:8016/JsonService.asmx</Value>
</Setting>
<Setting Name="CK_SCP_Controller_BomListcompany_JsonService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://192.168.0.228:7602/JsonService.asmx</Value>
</Setting>
<Setting Name="CK_SCP_Controller_BomList1_JsonService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://10.62.144.124:8070/JsonService.asmx</Value>
</Setting>
</Settings>
</SettingsFile>

22
Controller/ResultObject.cs

@ -1,4 +1,6 @@
using System;
using CK.SCP.Models.ScpEntity;
using CK.SCP.Models.ScpEntity.ExcelExportEnttity;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@ -16,18 +18,16 @@ namespace CK.SCP.Controller
public ResultObject()
{
ErrorList = new List<Exception>();
MessageList = new List<string>();
}
MessageList = new List<string>();
Kblist = new List<SCP_ASK_EXPORT>();
}
public string Message { set; get; }
public List<string> MessageList { set; get; }
/// <summary>
/// 返回结果
/// </summary>
public T Result { set; get; }
public List<SCP_ASK_EXPORT> Kblist { set; get; }
/// <summary>
/// 返回结果
/// </summary>
public T Result { set; get; }
/// <summary>
/// 错误列表
/// </summary>

799
Controller/SCP_ASK_CONTROLLER.cs

@ -165,10 +165,440 @@ namespace CK.SCP.Controller
throw e;
}
}
public static List<TA_ASK_SUBPART> Getlist(string ASK)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
return db.TA_ASK_SUBPART.Where(p=>p.AskBillNum==ASK&&string.IsNullOrEmpty(p.VendBatch)).ToList();
}
}
public static ResultObject<bool> Update_User_ErrorCount(string p_userName,int count )
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
{
var user = _appdb.Users.FirstOrDefault(p => p.Name == p_userName);
if (user != null)
{
user.ErrorCount = user.ErrorCount + 1;
if(user.ErrorCount== count)
{
user.Enabled = false;
_ret.Message = $"密码错误超过【{count}】次,账号已锁定请联系管理员";
}
else
{
_ret.Message = $"密码错误,再输入错【{count - user.ErrorCount}】次后账户将锁定!";
}
}
int state = _appdb.SaveChanges();
if (state != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Update_User_ErrorCount", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Update_User_ErrorCount", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Update_User_ErrorCount", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Update_User_ErrorCount", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Add_Vendusers(List<string> p_order_list, string site)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
{
foreach (var vend in p_order_list)
{
string na = vend + "@" + site;
var user = _appdb.Users.FirstOrDefault(p => p.Name == na);
if (user != null)
{
VenderUsers _entit = new VenderUsers();
_entit.UserId = user.ID;
_entit.VenderId = vend;
_appdb.VenderUsers.Add(_entit);
_appdb.SaveChanges();
}
}
//int state = _appdb.SaveChanges();
//if (state != -1)
//{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
//}
//else
//{
// _ret.State = ReturnStatus.Failed;
// _ret.Result = false;
//}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Add_ASK_SUBPART(string ask)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var askdetail = db.TB_ASK_DETAIL.Where(p => p.AskBillNum == ask).ToList();
var subcount = db.TA_ASK_SUBPART.Count(p => p.AskBillNum == ask);
if (subcount == 0)
{
foreach (var ak in askdetail)
{
var sub = db.TA_SubPartCode.Where(p => p.PartCode == ak.PartCode).ToList();
if (sub.Count() > 0)
{
foreach(var su in sub)
{
TA_ASK_SUBPART subpart = new TA_ASK_SUBPART();
subpart.PartCode = su.PartCode;
subpart.SubPartCode = su.SubPartCode;
subpart.BOMedtiton = su.BOMedtiton;
subpart.AskBillNum = ask;
subpart.Qty = su.Qty;
db.TA_ASK_SUBPART.AddOrUpdate(subpart);
db.TA_SubPartCode.Remove(su);
}
}
}
}
if (_ret.MessageList.Count > 0)
{
_ret.State = ReturnStatus.Failed;
}
else
{
if (db.SaveChanges() != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Add_Vend_User(List<string> p_order_list, string site)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
{
foreach (var vend in p_order_list)
{
var user = _appdb.Users.FirstOrDefault(p => p.Name == vend);
if (user == null)
{
var _factory = _appdb.TA_FACTORY.Where(p => p.ErpDomain == site).FirstOrDefault();
var _vend = _appdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault();
User _entity = new User();
string na = vend + "@" + site;
_entity.Name = na;
_entity.Remark = site;
_entity.Password = PasswordUtil.CreateDbPassword("555555");
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var vendname = db.TA_VENDER.FirstOrDefault(p => p.VendId == vend);
_entity.ChineseName = vendname.VendName;
}
_entity.Email = vend + "@163.com";
_entity.Gender = "男";
_entity.Enabled = true;
_entity.Roles = new List<Role>();
Role t = _appdb.Set<Role>().Local.Where(x => x.ID == _vend.ID).FirstOrDefault();
if (t == null)
{
t = new Role { ID = _vend.ID };
_appdb.Set<Role>().Attach(t);
}
_entity.Roles.Add(t);
_entity.TA_FACTORY = new List<TA_FACTORY>();
TA_FACTORY f = _appdb.Set<TA_FACTORY>().Local.Where(x => x.ID == _factory.ID).FirstOrDefault();
if (f == null)
{
f = new TA_FACTORY { ID = _factory.ID };
_appdb.Set<TA_FACTORY>().Attach(f);
}
_entity.TA_FACTORY.Add(f);
_appdb.Users.Add(_entity);
_appdb.SaveChanges();
}
}
//int state = _appdb.SaveChanges();
//if (state != -1)
//{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
//}
//else
//{
// _ret.State = ReturnStatus.Failed;
// _ret.Result = false;
//}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
/// <summary>
/// 要货看板减产数量
@ -488,6 +918,7 @@ namespace CK.SCP.Controller
throw e;
}
}
public static List<V_TB_INCOMPLETE_ASK> RejectQty_SUM(List<V_TB_INCOMPLETE_ASK> p_list)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
@ -1198,7 +1629,221 @@ namespace CK.SCP.Controller
public static ResultObject<bool> Save_ASK_TO_WWDZJASN(V_TB_ASK p_ask, List<V_TB_ASK_DETAIL> p_order_list, string p_PlateNumber
, string p_buyer, string p_buyerPhone)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
TB_ASN _t = new TB_ASN();
_t.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode();
_t.AskBillNum = p_ask.AskBillNum;
_t.PoBillNum = p_ask.PoBillNum;
_t.ReceivedPort = p_ask.ReceivedPort;
_t.CreateUser = p_buyer;
_t.CreateTime = DateTime.Now;
_t.UpdateUser = p_buyer;
_t.UpdateTime = _t.CreateTime;
_t.ReceiveUser = p_ask.Buyer;
_t.ReceiveTime = p_ask.BeginTime;
_t.VendId = p_ask.VendId;
_t.IsDeleted = false;//操作员
_t.CreateTime = DateTime.Now;
_t.CreateUser = p_buyer;
_t.Site = p_ask.Site;
_t.SubSite = p_ask.SubSite;
_t.Remark = p_ask.Remark;
_t.State = (int)AsnState.New;
_t.Remark = p_ask.Remark;
_t.GUID = Guid.NewGuid();
_t.PlateNumber = p_PlateNumber;
_t.ShipUser = p_ask.ShipUser;
_t.ShipTime = p_ask.ShipTime;
_t.ReceiveTime = p_ask.ReceiveTime;
foreach (var itm in p_order_list)
{
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
_t.Extend3 = partgroup.PartGroup;
}
db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t);
List<TB_ASN_DETAIL> _list = new List<TB_ASN_DETAIL>();
foreach (var itm in p_order_list)
{
TB_ASN_DETAIL _tDetail = new TB_ASN_DETAIL();
_tDetail.PoBillNum = _t.PoBillNum;
_tDetail.AsnBillNum = _t.AsnBillNum;
_tDetail.PoLine = itm.PoLine;
_tDetail.PoUnit = itm.PoUnit;
_tDetail.Batch = itm.Batch;
if (itm.VendBatch == "55")
{
_tDetail.VendBatch = "";
}
else
{
_tDetail.VendBatch = itm.VendBatch;
}
var subpart = db.TA_ASK_SUBPART.Where(p=>p.PartCode== itm.PartCode&&p.AskBillNum==itm.AskBillNum).ToList();
string str1 = "";
string str2 = "";
foreach(var sub in subpart)
{
string str = sub.SubPartCode + "," + sub.BOMedtiton + "," + sub.VendBatch + "#";
str2 = str2 + sub.VendBatch;
str1 = str1 + str;
}
_tDetail.VendBatch = str1;
_tDetail.UpdateUser = str2;
_tDetail.PackQty = itm.PackQty == 0 ? 1 : itm.PackQty;
_tDetail.PartCode = itm.PartCode;
_tDetail.State = (int)AsnState.New;
_tDetail.Qty = (decimal)itm.TempQty;
_tDetail.Price = itm.Price;
_tDetail.EndTime = itm.EndTime;
_tDetail.CreateTime = _t.CreateTime;
_tDetail.CreateUser = _t.CreateUser;
_tDetail.ProduceDate = itm.ProduceDate;
_tDetail.IsDeleted = false;
_tDetail.DockCode = itm.ReceivedPort;
_tDetail.LocUnit = itm.LocUnit;
_tDetail.UnConv = itm.UnConv;
_tDetail.State = _t.State;
_tDetail.UpdateInfo = itm.UpdateInfo;
_tDetail.ReceivedPort = itm.ReceivedPort;
_tDetail.GUID = Guid.NewGuid();
_tDetail.SubSite = itm.SubSite;
_tDetail.Site = itm.Site;
_tDetail.Extend2 = itm.ReceivedQty.ToString();
_tDetail.Remark = itm.ReceivedQty.ToString();
_tDetail.UpdateInfo = itm.UpdateInfo;
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
_tDetail.Extend3 = partgroup.PartGroup;
db.TB_ASN_DETAIL.Add(_tDetail);
var _order_detail = db.TB_ASK_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault();
_order_detail.ShippedQty = (decimal)itm.ShippedQty;
db.TB_ASK_DETAIL.AddOrUpdate(p => p.UID, _order_detail);
foreach (var sub in subpart)
{
TS_UNI_API uni = new TS_UNI_API();
uni.InterfaceType = "Receive";
uni.TableName = "TS_UNI_API";
uni.BillType = 0;
uni.SubBillType = 0;
uni.BillNum = _tDetail.AsnBillNum;
uni.PartCode = _tDetail.PartCode;
uni.Batch = _tDetail.Batch;
uni.Qty = _tDetail.Qty;
uni.State = 2;
uni.CreateOper=_t.CreateUser;
uni.CreateTime = DateTime.Now;
uni.PutTime= DateTime.Now;
uni.VendId = _t.VendId;
uni.PoUnit = _tDetail.PoUnit;
uni.LocUnit = _tDetail.PoUnit;
uni.ValidDate= DateTime.Now;
uni.ErpBillNum = _tDetail.PoBillNum;
uni.ErpLineNum = _tDetail.PoLine;
uni.VendBatch = sub.VendBatch;
uni.PackQty= _tDetail.Qty;
uni.Price = _tDetail.Price;
uni.UmConv = 1;
uni.Buyer = _t.ShipUser;
uni.BuyerPhone = "";
uni.Site = _t.Site;
uni.Domain = _t.Site;
uni.ModType = sub.SubPartCode;
uni.Barcode = sub.BOMedtiton;
uni.Extend3 = _tDetail.PoLine.ToString();
db.TS_UNI_API.Add(uni);
}
}
var subpartcode = db.TA_ASK_SUBPART.Where(p => p.AskBillNum == _t.AskBillNum).ToList();
foreach (var sub in subpartcode)
{
sub.VendBatch = "";
db.TA_ASK_SUBPART.AddOrUpdate(sub);
}
int state = db.SaveChanges();
if (state != -1)
{
var _askDetailList = db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted == false).ToList();//查询要货单明细
var _lst = Get_CAN_SHIPQTY(_askDetailList);//算出可发数量
if (_lst.Select(p => p.CanQty).Sum() <= 0)//可发数量为零时,修改状态
{
var _ary = db.TB_ASK.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted == false).ToList();
_ary.ForEach(p => p.State = (int)AskState.Ship);
if (_ary.Count() > 0)
{
db.TB_ASK.AddOrUpdate(_ary.ToArray());
}
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_ASK_TO_ASN", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Save_ASK_TO_ASN(V_TB_ASK p_ask, List<V_TB_ASK_DETAIL> p_order_list, string p_PlateNumber
, string p_buyer, string p_buyerPhone)
{
@ -1207,6 +1852,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var po = db.TB_PO.FirstOrDefault(p=>p.PoBillNum==p_ask.PoBillNum);
TB_ASN _t = new TB_ASN();
_t.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode();
_t.AskBillNum = p_ask.AskBillNum;
@ -1232,7 +1878,12 @@ namespace CK.SCP.Controller
_t.ShipUser = p_ask.ShipUser;
_t.ShipTime = p_ask.ShipTime;
_t.ReceiveTime = p_ask.ReceiveTime;
db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t);
foreach (var itm in p_order_list)
{
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
_t.Extend3 = partgroup.PartGroup;
}
db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t);
List<TB_ASN_DETAIL> _list = new List<TB_ASN_DETAIL>();
foreach (var itm in p_order_list)
{
@ -1242,14 +1893,21 @@ namespace CK.SCP.Controller
_tDetail.PoLine = itm.PoLine;
_tDetail.PoUnit = itm.PoUnit;
_tDetail.Batch = itm.Batch;
if (!string.IsNullOrEmpty(itm.VendBatch))
if (itm.VendBatch=="55")
{
_tDetail.VendBatch = "";
}
else
{
_tDetail.VendBatch = itm.VendBatch;
}
else
if (_t.PoBillNum.Substring(0, 5) == "CYD03"&&_t.Site=="W21")
{
_tDetail.VendBatch = itm.Batch;
var podetail = db.TB_PO_DETAIL.FirstOrDefault(t=>t.PoBillNum==_t.PoBillNum&&t.PartCode==itm.PartCode&&t.PoLine==itm.PoLine);
_tDetail.VendBatch = podetail.SubSite + "," + podetail.Extend3 + "," + itm.VendBatch + "#";
}
_tDetail.UpdateUser= itm.VendBatch;
_tDetail.PackQty = itm.PackQty == 0 ? 1 : itm.PackQty;
_tDetail.PartCode = itm.PartCode;
_tDetail.State = (int)AsnState.New;
@ -1267,12 +1925,82 @@ namespace CK.SCP.Controller
_tDetail.UpdateInfo = itm.UpdateInfo;
_tDetail.ReceivedPort = itm.ReceivedPort;
_tDetail.GUID = Guid.NewGuid();
_tDetail.SubSite = itm.SubSite;
_tDetail.SubSite = itm.SubSite;
_tDetail.Site = itm.Site;
_tDetail.Extend2 = itm.ReceivedQty.ToString();
_tDetail.Remark= itm.ReceivedQty.ToString();
_tDetail.UpdateInfo = itm.UpdateInfo;
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault();
var askdetail=db.TB_ASK_DETAIL.Where(p => p.PartCode == itm.PartCode&&p.AskBillNum==itm.AskBillNum).FirstOrDefault();
_tDetail.Extend3 = partgroup.PartGroup;
_tDetail.Extend1 =po.VendId;
if (itm.Site == "U32")
{
var _applin = db.TA_Appliance.FirstOrDefault(p=>p.PartNumber==itm.SubSite&&p.VendID==p_ask.VendId);
if (_applin != null)
{
var _boxtype = db.TA_BOXTYPE.FirstOrDefault(p=>p.BoxType==_applin.BoxType&&p.Enabled==true);
if (_boxtype != null)
{
TB_ASN_PARTBOX PARTBOX = new TB_ASN_PARTBOX();
PARTBOX.AsnBillNum = _t.AsnBillNum;
PARTBOX.PartCode = itm.PartCode;
PARTBOX.BoxType = _boxtype.BoxType;
PARTBOX.Box = Convert.ToInt32(_tDetail.Qty) / Convert.ToInt32(_tDetail.PackQty);
if(Convert.ToInt32(_tDetail.Qty) % Convert.ToInt32(_tDetail.PackQty) > 0)
{
PARTBOX.Box = PARTBOX.Box + 1;
}
PARTBOX.SumBox = PARTBOX.Box;
PARTBOX.PoBillNum = _t.PoBillNum;
PARTBOX.VendId = _t.VendId;
PARTBOX.ShipTime =DateTime.Parse(_t.ShipTime.ToString()).ToShortDateString();
PARTBOX.Batch = _tDetail.Batch;
PARTBOX.PoLine = _tDetail.PoLine;
PARTBOX.PackQty = _tDetail.PackQty;
db.TB_ASN_PARTBOX.AddOrUpdate(PARTBOX);
}
}
if (!string.IsNullOrEmpty(askdetail.Extend2))
{
var ModelList = db.TA_CarModel.ToList();
foreach (var model in ModelList)
{
if(model.Model.Length<=askdetail.Extend2.Length)
{
if (askdetail.Extend2.Contains(model.Model))
{
_tDetail.Extend1 = "FT";
break;
}
}
_tDetail.Extend1 = "PT";
}
//if (askdetail.Extend2.Contains("941B") || askdetail.Extend2.Contains("330B") || askdetail.Extend2.Contains("812B") || askdetail.Extend2.Contains("260B") || askdetail.Extend2.Contains("875B") || askdetail.Extend2.Contains("710B") || askdetail.Extend2.Contains("280B") || askdetail.Extend2.Contains("770B") || askdetail.Extend2.Contains("290D") || askdetail.Extend2.Contains("891B") || askdetail.Extend2.Contains("031D") || askdetail.Extend2.Contains("822B") || askdetail.Extend2.Contains("845B") || askdetail.Extend2.Contains("067D") || askdetail.Extend2.Contains("115D"))
//{
// _tDetail.Extend1 = "FT";
//}
//else
//{
// _tDetail.Extend1 = "PT";
//}
}
else
{
_tDetail.Extend1 = "PT";
}
}
db.TB_ASN_DETAIL.Add(_tDetail);
var _order_detail = db.TB_ASK_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault();
_order_detail.ShippedQty = (decimal)itm.ShippedQty;
db.TB_ASK_DETAIL.AddOrUpdate(p => p.UID, _order_detail);
}
int state = db.SaveChanges();
if (state != -1)
@ -1358,7 +2086,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var _ls = p_list.Select(p => p.AskBillNum);
var _ls = p_list.Select(p => p.AskBillNum);
StringBuilder _buffer = new StringBuilder();
_buffer.Append(" select distinct (C.AskBillNum)from V_TB_ASK_DETAIL C");
_buffer.Append(" left JOIN ");
@ -1382,6 +2110,39 @@ namespace CK.SCP.Controller
}
return p_list;
}
public static List<V_TB_ASK> GET_IS_COMPLETED_SEND1(List<V_TB_ASK> p_list,string lz)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List<V_TB_ASK> lt = new List<V_TB_ASK>();
var _ls = p_list.Select(p => p.AskBillNum);
StringBuilder _buffer = new StringBuilder();
_buffer.Append(" select AskBillNum from V_TB_ASK_DETAIL ");
_buffer.Append($" WHERE Currency like '%{lz}%'");
var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray()));
var _list = db.Database.SqlQuery<string>(_str).ToList();
var ll= p_list.Where(p => _list.Contains(p.AskBillNum)).ToList();
return ll;
}
}
public static List<V_TB_ASK> GET_IS_COMPLETED_SEND2(List<V_TB_ASK> p_list, string lz)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List<V_TB_ASK> lt = new List<V_TB_ASK>();
var _ls = p_list.Select(p => p.AskBillNum);
StringBuilder _buffer = new StringBuilder();
_buffer.Append(" select AskBillNum from V_TB_ASK_DETAIL ");
_buffer.Append($" WHERE SubSite='{lz}'");
var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray()));
var _list = db.Database.SqlQuery<string>(_str).ToList();
var ll = p_list.Where(p => _list.Contains(p.AskBillNum)).ToList();
return ll;
}
}
public static decimal Get_ASN_DETAIL_CAN(V_TB_ASK_DETAIL p_asn_detail)
{
decimal _canqty = 0;
@ -1450,7 +2211,9 @@ namespace CK.SCP.Controller
p_list.ForEach(itm =>
{
var maxtime = db.TB_ASN_DETAIL.Where(p=>p.PartCode==itm.PartCode&&p.State>-1).Select(t=>t.ProduceDate).Max();
itm.MaxTime = maxtime.ToString();
groupList.ForEach(p =>
{
if (p.PoBillNum == itm.PoBillNum && p.PoLine == itm.PoLine && p.PartCode == itm.PartCode)
@ -1465,6 +2228,7 @@ namespace CK.SCP.Controller
itm.RejectQty = Math.Abs(p.BackSum);//寄售退货数
}
});
decimal a = itm.AskQty - (itm.ShippedQty == null ? 0 : (decimal)itm.ShippedQty) + itm.RejectQty - (itm.ReduceQty == null ? 0 : (decimal)itm.ReduceQty);
itm.CanQty = a;
itm.PackQty = (itm.PackQty == 0) ? 1 : itm.PackQty;
@ -1885,7 +2649,8 @@ namespace CK.SCP.Controller
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
{
if (p_state == AskState.Close)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
@ -1899,13 +2664,16 @@ namespace CK.SCP.Controller
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!");
}
else
{
p.State = (int)AskState.Close;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
{
p.State = (int)AskState.Close;
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList();
_list.ForEach(itm => itm.State = (int)AskState.Close);
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray());
}
}
);
@ -2018,6 +2786,15 @@ namespace CK.SCP.Controller
if (p_state == AskState.Release)
{
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList();
foreach (var mail in _ls)
{
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL();
mall.State = 0;
mall.SupplicerCode = mail.VendId;
mall.MailBody = "有新的要货订单" + mail.AskBillNum;
mall.Email = mail.PoBillNum;
db.TB_SUPPLIER_MAIL.Add(mall);
}
int count = _ls.Count(p => p.State == (int)AskState.New);
if (count > 0)
{

755
Controller/SCP_ASN_CONTROLLER.cs

@ -69,6 +69,7 @@ namespace CK.SCP.Controller
}
return dt;
}
public static void Get_V_TB_ASN_List(V_TB_ASN p_entity, Action<ResultObject<IQueryable<V_TB_ASN>>> p_action,string p_language="CN")
{
ResultObject<IQueryable<V_TB_ASN>> _ret = new ResultObject<IQueryable<V_TB_ASN>>();
@ -231,6 +232,287 @@ namespace CK.SCP.Controller
throw e;
}
}
public static ResultObject<bool> Save_Asn_Vendbatch(List<TA_ASK_SUBPART> p_order_list)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List<string> _list = new List<string>();
var PartList = p_order_list.GroupBy(p => p.PartCode).ToList();
PartList.ForEach(p=>
{
var list = p.ToList();
var batchList = list.Select(t => t.VendBatch).Distinct();
if(list.Count()!= batchList.Count())
{
_ret.MessageList.Add("同一物料号,不同子件物料号的原卷号不能相同");
}
});
foreach (var itm in p_order_list)
{
var detail = db.TA_ASK_SUBPART.FirstOrDefault(P => P.UID == itm.UID);
detail.VendBatch = itm.VendBatch;
db.TA_ASK_SUBPART.AddOrUpdate(p => p.UID, detail);
}
if (_ret.MessageList.Count() == 0)
{
int state = db.SaveChanges();
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_Asn_ProduceDate", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_Asn_ProduceDate", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_Asn_ProduceDate", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_Asn_ProduceDate", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Delete_asn(List<string> asn)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
{
int number = 1;
List<string> lineError = new List<string>();
List<string> ErrorList = new List<string>();
foreach (var nn in asn)
{
var _ls = CheckExce2(db, nn);
if (_ls.Count > 0)
{
lineError.Add(number.ToString());
ErrorList.Add(string.Join("<br>", _ls.ToArray()));
number++;
}
if (lineError.Count > 0)
{
_ret.State = ReturnStatus.Failed;
_ret.MessageList.AddRange(ErrorList);
_ret.Result = false;
}
else
{
var ASN = db.TB_ASN.Where(p => p.AsnBillNum == nn).FirstOrDefault();
var detail = db.TB_ASN_DETAIL.Where(p => p.AsnBillNum == nn).ToArray();
if (ASN != null)
{
ASN.State = -1;
ASN.IsDeleted = true;
db.TB_ASN.AddOrUpdate(ASN);
}
if (detail.Count() > 0)
{
foreach (var itm in detail)
{
itm.IsDeleted = true;
itm.State = -1;
}
db.TB_ASN_DETAIL.AddOrUpdate(detail);
}
}
}
}
if (_ret.MessageList.Count == 0)
{
int state = db.SaveChanges();
if (state != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PO_CONTROLLER), "Delete_asn", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PO_CONTROLLER), "Delete_asn", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PO_CONTROLLER), "Delete_asn", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_PO_CONTROLLER), "Delete_asn", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
private static List<string> CheckExce2(ScpEntities db, string lt)
{
List<string> ErrorList = new List<string>();
var _asn = db.TB_ASN.Count(p => p.AsnBillNum == lt&&p.State>0);
if (_asn > 0)
{
ErrorList.Add(string.Format("发货单【{0}】不是新建状态,不能作废", lt));
}
return ErrorList;
}
public static List<TB_ASN_DETAIL> SearchCxcount(string asn)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var asndetail= db.TB_ASN_DETAIL.Where(p => p.AsnBillNum==asn&&p.Extend1=="FT").ToList();
return asndetail;
}
}
public static List<TB_ASN_DETAIL> SearchCxcount1(string asn)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var asndetail = db.TB_ASN_DETAIL.Where(p => p.AsnBillNum== asn && p.Extend1 == "PT").ToList();
return asndetail;
}
}
public static List<TB_ASN_PARTBOX> SearchPartBox(string asn)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var PartBox = db.TB_ASN_PARTBOX.Where(p => p.AsnBillNum == asn && p.Box>0).ToList();
return PartBox;
}
}
public static List<TS_BARCODE> SearchBarcode(string asn)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var barcode = db.TS_BARCODE.Where(p => p.BillNum == asn).ToList();
return barcode;
}
}
public static void Get_TB_Pallet_List(V_TB_PALLETS p_entity, Action<ResultObject<IQueryable<V_TB_PALLETS>>> p_action)
{
ResultObject<IQueryable<V_TB_PALLETS>> _ret = new ResultObject<IQueryable<V_TB_PALLETS>>();
@ -798,7 +1080,7 @@ namespace CK.SCP.Controller
return _ret;
}
public static DataSet ASN_REPORT(string p_AsnBillNum)
public static DataSet ASN_REPORT(string p_AsnBillNum,string CurrentUserPhone)
{
DataSet ds = new DataSet();
SCP_ASN_CONTROLLER.Get_V_TB_ASN_List(new V_TB_ASN { AsnBillNum = p_AsnBillNum }, (ret) =>
@ -816,12 +1098,34 @@ namespace CK.SCP.Controller
_print.SupplierNo = _asn.VendId;
_print.SupplierName = _asn.VendName;
_print.SupplierContacter = _asn.ShipUser;
_print.DueDeliveryDate = _asn.ReceiveTime.ToString();
_print.DueDeliveryDate = _asn.EndTime.ToShortDateString();
_print.MaterialPlanner = _asn.Buyer;
_print.CAAIPhone = "";
_print.CAAIFax = "";
_print.Site = _asn.Site;
_print.Total = "0";
_print.CurrentUserPhone = CurrentUserPhone;
if (_asn.Site == "U32")
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var Bb = db.TA_Receiving_Information.Count(t => t.Shift == "白班");
if (Bb > 0)
{
var Bb1 = db.TA_Receiving_Information.FirstOrDefault(t => t.Shift == "白班");
_print.SupplierContacter = Bb1.Name + ":" + Bb1.Phone;
}
var Yb = db.TA_Receiving_Information.Count(t => t.Shift == "夜班");
if (Bb > 0)
{
var Yb1 = db.TA_Receiving_Information.FirstOrDefault(t => t.Shift == "夜班");
_print.FileNo = Yb1.Name + ":" + Yb1.Phone;
}
_print.CAAIFax = _asn.ShipUser;
}
}
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
{
StringBuilder _buffer = new StringBuilder();
@ -859,13 +1163,23 @@ namespace CK.SCP.Controller
_detail.Boxes = (Math.Truncate((p.Qty / p.PackQty)) + (((p.Qty % p.PackQty) > 0) ? 1 : 0)).ToString();
_detail.DeliverQty = p.Qty.ToString();
_detail.ReceiveQty = p.Qty.ToString();
_detail.PoNo = p.PoBillNum+"."+p.AskBillNum;
//_detail.PoNo = p.PoBillNum + "." + p.AskBillNum;
//if (p.Site == "U32")
//{
_detail.PoNo = p.PoBillNum;
//}
_detail.LineNO = p.PoLine.ToString();
_detail.Memo = p.Remark;
_detail.Batch = p.Batch;
_detail.VendBatch = p.VendBatch;
_detail.DockCode = p.DockCode;
_detail.ProjectId = _lst.Where(itm => itm.PartCode == p.PartCode).FirstOrDefault().ProjectId;
_detail.DockCode = p.Extend2;
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var Poqty = db.TB_PO_DETAIL.FirstOrDefault(t=>t.PartCode== p.PartCode&&t.PoBillNum==p.PoBillNum&&t.PoLine==p.PoLine);
_detail.PoQty = Poqty.PlanQty.ToString();
}
// _detail.ProjectId = _lst.Where(itm => itm.PartCode == p.PartCode).FirstOrDefault().ProjectId;
_lsDetail.Add(_detail);
});
@ -902,7 +1216,8 @@ namespace CK.SCP.Controller
_print.CAAIPhone = "";
_print.CAAIFax = "";
_print.Total = "0";
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
using (AppBoxContext _appdb = EntitiesFactory.CreateAppBoxInstance())
{
StringBuilder _buffer = new StringBuilder();
var _ls = _appdb.Users.Where(p => p.Roles.Select(itm => itm.Name).Contains("物流人员")).ToList();
@ -1492,25 +1807,30 @@ namespace CK.SCP.Controller
{
string _asnBillNum = p_list[0].AsnBillNum;
var _asn = db.TB_ASN.Where(p => p.IsDeleted == false && p.AsnBillNum == _asnBillNum).FirstOrDefault();
var _asn1 = db.TB_ASN_DETAIL.Where(p => p.IsDeleted == false && p.AsnBillNum == _asnBillNum).FirstOrDefault();
List<V_TB_ASN_DETAIL> _asnList = new List<V_TB_ASN_DETAIL>();
p_list.ForEach(p =>
{
decimal _qty = 0;
decimal _packQty = 0;
var partcount = p_list.Where(t=>t.PartCode==p.PartCode);
if (decimal.TryParse(p.Qty.ToString(), out _qty) && decimal.TryParse(p.PackQty.ToString(), out _packQty))
{
decimal _n = _qty / _packQty;
var _count=int.Parse( Math.Truncate(_n).ToString());
if (_qty / _packQty > 0)
{
for (int i = 0; i < _count; i++)
{
V_TB_ASN_DETAIL _asndetail = new V_TB_ASN_DETAIL();
_asndetail.PoBillNum = p.PoBillNum;
_asndetail.Batch = p.Batch;
_asndetail.PartCode = p.PartCode;
_asndetail.ProduceDate = p.ProduceDate;
_asndetail.Qty = _packQty;
_asndetail.ProduceDate = p.ProduceDate;
_asndetail.Qty = _packQty;
_asndetail.AsnBillNum = p.AsnBillNum;
_asndetail.PoLine = p.PoLine;
_asndetail.VendId = p.VendId;
@ -1522,6 +1842,7 @@ namespace CK.SCP.Controller
_asndetail.PoUnit = p.PoUnit;
_asndetail.Site = p.Site;
_asndetail.UpdateInfo = p.UpdateInfo;
_asndetail.UpdateUser = p.UpdateUser;
_asnList.Add(_asndetail);
}
if (_qty % _packQty > 0)
@ -1543,6 +1864,8 @@ namespace CK.SCP.Controller
_asndetail.PoUnit = p.PoUnit;
_asndetail.UpdateInfo = p.UpdateInfo;
_asndetail.Site = p.Site;
_asndetail.UpdateInfo = p.UpdateInfo;
_asndetail.UpdateUser = p.UpdateUser;
_asnList.Add(_asndetail);
}
}
@ -1567,17 +1890,46 @@ namespace CK.SCP.Controller
_asndetail.PoUnit = p.PoUnit;
_asndetail.Site = p.Site;
_asndetail.UpdateInfo = p.UpdateInfo;
_asndetail.UpdateUser = p.UpdateUser;
_asnList.Add(_asndetail);
}
}
}
});
foreach (var itm in _asnList)
if (_asnList.Count>=1000&& _asnList[0].Site== "U32")//本特勒大于1000时采用批量生成方式
{
var _bar = SCP_BARCODE_CONTROLLER.CreateBarcode(itm);
_ls.Add(_bar);
var groups = _asnList.GroupBy(r => new { r.PartCode, r.Batch, r.Site, r.PoBillNum, r.AskBillNum }).ToList();
foreach (var group in groups)
{
var list = _asnList.Where(r => r.PartCode == group.Key.PartCode && r.Batch == group.Key.Batch && r.Site == group.Key.Site && r.PoBillNum == group.Key.PoBillNum && r.AskBillNum == group.Key.AskBillNum).ToList();
var ret = SCP_BARCODE_CONTROLLER.CreateBatchBarcodeList(list);
if (ret.State == ReturnStatus.Succeed)
{
_ls.AddRange(ret.Result);
}
else
{
_ret.MessageList.Add(ret.Message);
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
return _ret;
}
}
db.TS_BARCODE.BulkInsert(_ls.ToArray());
}
db.TS_BARCODE.AddOrUpdate(p => new { p.BarCode, p.BillNum }, _ls.ToArray());
else
{
foreach (var itm in _asnList)
{
var _bar = SCP_BARCODE_CONTROLLER.CreateBarcode(itm);
_ls.Add(_bar);
}
db.TS_BARCODE.AddOrUpdate(p => new { p.BarCode, p.BillNum }, _ls.ToArray());
}
}
else
{
@ -1897,6 +2249,150 @@ namespace CK.SCP.Controller
}
return _ret;
}
public static ResultObject<bool> Save_TB_PALLET_BTL(List<TB_ASN_PARTBOX> p_list)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
int _sumbox = p_list.Sum(p => p.Qty);
SqlParameter[] prams = new SqlParameter[1];
prams[0] = new SqlParameter("@a", 105);
string lastNumber = db.Database.SqlQuery<string>("exec dbo.P_GetBillNum @a", prams).SingleOrDefault();
if (lastNumber.Length != 8 || !lastNumber.Contains('P'))
{
_ret.MessageList.Add("托盘生成失败!");
}
string str = "";
decimal _qy = 0;
foreach (var li in p_list)
{
var ts = db.TS_BARCODE.OrderBy(T => T.UID).Where(T => string.IsNullOrEmpty(T.PalletNum) && T.BillNum == li.AsnBillNum && T.PartCode == li.PartCode).ToList().Take(li.Qty);
var tss = ts.ToList();
decimal _qty = tss.Sum(p => p.Qty);
string str1 = li.PartCode + "," + li.Batch+","+ _qty+","+li.PoLine+"#";
tss.ForEach(itm => itm.PalletNum = lastNumber);
db.TS_BARCODE.AddOrUpdate(itm => itm.UID, tss.ToArray());
str = str + str1;
_qy = _qy + _qty;
li.Box = li.Box - li.Qty;
li.Qty1 = 0;
db.TB_ASN_PARTBOX.AddOrUpdate(li);
}
var _ls = p_list.First();
TB_PALLETS_BTL pallet = new TB_PALLETS_BTL();
pallet.AsnBillNum = _ls.AsnBillNum;
pallet.PalletNum = lastNumber;
pallet.PoBillNum = _ls.PoBillNum;
pallet.VendId = _ls.VendId;
var vend = db.TA_VENDER.FirstOrDefault(p => p.VendId == _ls.VendId);
pallet.VendName = vend.VendName;
pallet.ShipTime = _ls.ShipTime;
pallet.SumBox = _sumbox;
pallet.PalletCode = lastNumber+";"+ _ls.AsnBillNum+";" + _ls.PoBillNum+";" + _ls.VendId+";"+ str;
pallet.SumQty = _qy;
if (p_list.Count() > 0)
{
int _count = 6 - p_list.Count();
if (_count > 0)
{
for (int a = 1; a <= _count; a++)
{
TB_ASN_PARTBOX _partbox = new TB_ASN_PARTBOX();
p_list.Add(_partbox);
}
}
pallet.PackQty = p_list.First().PackQty.ToString();
pallet.PartCode = p_list.First().PartCode.ToString();
pallet.Box = p_list.First().Qty.ToString();
pallet.PackQty1 = p_list[p_list.Count - 5].PackQty==0?"": p_list[p_list.Count - 5].PackQty.ToString();
pallet.PartCode1 = string.IsNullOrEmpty(p_list[p_list.Count - 5].PartCode)?"": p_list[p_list.Count - 5].PartCode;
pallet.Box1 = p_list[p_list.Count - 5].Qty==0 ? "": p_list[p_list.Count - 5].Qty.ToString();
pallet.PackQty2 = p_list[p_list.Count - 4].PackQty==0 ?"": p_list[p_list.Count - 4].PackQty.ToString();
pallet.PartCode2 =string.IsNullOrEmpty(p_list[p_list.Count - 4].PartCode)?"": p_list[p_list.Count - 4].PartCode;
pallet.Box2 = p_list[p_list.Count - 4].Qty==0?"" : p_list[p_list.Count - 4].Qty.ToString();
pallet.PackQty3 = p_list[p_list.Count - 3].PackQty==0 ? "": p_list[p_list.Count - 3].PackQty.ToString();
pallet.PartCode3 = string.IsNullOrEmpty(p_list[p_list.Count - 3].PartCode)?"": p_list[p_list.Count - 3].PartCode;
pallet.Box3 = p_list[p_list.Count - 3].Qty==0?"" : p_list[p_list.Count - 3].Qty.ToString();
pallet.PackQty4 = p_list[p_list.Count - 2].PackQty==0 ? "": p_list[p_list.Count - 2].PackQty.ToString();
pallet.PartCode4 = string.IsNullOrEmpty(p_list[p_list.Count - 2].PartCode)?"": p_list[p_list.Count - 2].PartCode;
pallet.Box4 = p_list[p_list.Count - 2].Qty==0 ? "": p_list[p_list.Count - 2].Qty.ToString();
pallet.PackQty5 = p_list.Last().PackQty == 0 ? "" : p_list.Last().PackQty.ToString();
pallet.PartCode5 =string.IsNullOrEmpty(p_list.Last().PartCode) ? "" : p_list.Last().PartCode;
pallet.Box5 = p_list.Last().Qty==0 ?"": p_list.Last().Qty.ToString();
pallet.IsDeleted = false;
}
db.TB_PALLETS_BTL.AddOrUpdate(pallet);
int state = db.SaveChanges();
if (state != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET_BTL", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET_BTL", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET_BTL", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_PALLET_BTL", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Save_TB_PALLET_JZJH(List<V_TB_ASN_DETAIL> p_list)
{
@ -2329,7 +2825,7 @@ namespace CK.SCP.Controller
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var _list = db.TS_UNI_API.Where(p => p.BillNum == p_asn.AsnBillNum).ToList();
var _list = db.TS_UNI_API.Where(p => p.BillNum == p_asn.AsnBillNum&&p.State==1).ToList();
if (_list.Count > 0)
{
_ret.State = ReturnStatus.Failed;
@ -2400,15 +2896,128 @@ namespace CK.SCP.Controller
}
return _ret;
}
public static ResultObject<bool> Save_TB_ASN_DETAIL(V_TB_ASN p_asn, List<V_TB_ASN_DETAIL> p_entitys)
public static ResultObject<bool> Get_TB_ASN_BACH(V_TB_ASN p_asn)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
int i = 0;
List<string> asn1 =new List<string> ();
var asn = db.V_TB_ASN_DETAIL.Count(p=>p.VendId== p_asn.VendId&& p.State==0&&p.AsnBillNum!=p_asn.AsnBillNum);
if (asn > 0)
{
var _list = db.V_TB_ASN_DETAIL.Where(p => p.AsnBillNum == p_asn.AsnBillNum&& p.VendId == p_asn.VendId).ToList();
foreach(var part in _list)
{
var pa = db.V_TB_ASN_DETAIL.Count(p => p.PartCode == part.PartCode&&p.State==0&&p.ProduceDate<part.ProduceDate && p.VendId == p_asn.VendId);
if (pa > 0)
{
var pa1 = db.V_TB_ASN_DETAIL.Where(p => p.PartCode == part.PartCode && p.State == 0 && p.ProduceDate < part.ProduceDate && p.VendId == p_asn.VendId).ToList();
foreach(var p in pa1)
{
if (!asn1.Contains(p.AsnBillNum))
{
asn1.Add(p.AsnBillNum);
}
}
i++;
}
}
}
string STR = "";
if (asn1.Count() > 0)
{
STR = String.Join(";", asn1);
}
if (i > 0)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.Message = STR;
}
else
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TS_UNI_API", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TS_UNI_API", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TS_UNI_API", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_TS_UNI_API", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static ResultObject<bool> Save_TB_ASN_DETAIL(V_TB_ASN p_asn, List<V_TB_ASN_DETAIL> p_entitys)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
DateTime now = DateTime.Now;
List<TB_MAXPO_CONSUME> consumlist = new List<TB_MAXPO_CONSUME>();
List<TB_ASN_DETAIL> _ls = new List<TB_ASN_DETAIL>();
var _asn =db.TB_ASN.Where(p => p.IsDeleted == false && p.AsnBillNum == p_asn.AsnBillNum).ToList();
if (_asn != null && _asn.Count>0)
@ -2420,7 +3029,83 @@ namespace CK.SCP.Controller
db.TB_ASN.AddOrUpdate(p => p.UID, _asn.ToArray());
var ask = db.TB_ASK.Where(p => p.IsDeleted == false && p.AskBillNum == p_asn.AskBillNum).ToList();
ask.ForEach(p => p.State = (int)AskState.Ship);
db.TB_ASK.AddOrUpdate(p => p.UID, ask.ToArray());
db.TB_ASK.AddOrUpdate(p => p.UID, ask.ToArray());
var Asn = p_entitys.First();
var po = db.TB_PO.FirstOrDefault(p=>p.PoBillNum==Asn.PoBillNum);
if (po.UpdateInfo == "Y"&&po.Site=="W21")
{
p_entitys.ForEach(p =>
{
var _maxpolist = db.TB_MAXPO_DETAIL.Where(t => t.PartCode == p.PartCode && t.VendId == p.Extend1&&t.AsnQty>0).ToList().OrderBy(t=>t.ContractMonth);
decimal sum = 0;
if (_maxpolist.Count() > 0)
{
sum = _maxpolist.Sum(t => t.AsnQty);
}
decimal Qtyy = p.Qty;
if(sum< Qtyy)
{
_ret.MessageList.Add(string.Format("确认发货失败,零件号{0}大订单剩余数量不足,请联系业务人员维护", p.PartCode));
}
else
{
foreach (var _maxpo in _maxpolist)
{
if (_maxpo.AsnQty > Qtyy)
{
_maxpo.AsnQty = _maxpo.AsnQty - Qtyy;
TB_MAXPO_CONSUME consumne = new TB_MAXPO_CONSUME();
consumne.PoBillNum = _maxpo.PoBillNum;
consumne.BillNum = p.AsnBillNum;
consumne.PoQty = Qtyy;
consumne.VendId = _maxpo.VendId;
consumne.PartCode = _maxpo.PartCode;
consumne.ShipTime = _maxpo.CreateTime;
consumlist.Add(consumne);
db.TB_MAXPO_DETAIL.AddOrUpdate(_maxpo);
break;
}
else if (_maxpo.AsnQty == Qtyy)
{
TB_MAXPO_CONSUME consumne = new TB_MAXPO_CONSUME();
consumne.PoBillNum = _maxpo.PoBillNum;
consumne.BillNum = p.AsnBillNum;
consumne.PoQty = Qtyy;
consumne.VendId = _maxpo.VendId;
consumne.PartCode = _maxpo.PartCode;
consumne.ShipTime = _maxpo.CreateTime;
consumlist.Add(consumne);
_maxpo.AsnQty = 0;
db.TB_MAXPO_DETAIL.AddOrUpdate(_maxpo);
break;
}
else if (_maxpo.AsnQty < Qtyy)
{
TB_MAXPO_CONSUME consumne = new TB_MAXPO_CONSUME();
consumne.PoBillNum = _maxpo.PoBillNum;
consumne.BillNum = p.AsnBillNum;
consumne.PoQty = _maxpo.AsnQty;
consumne.VendId = _maxpo.VendId;
consumne.PartCode = _maxpo.PartCode;
consumne.ShipTime = _maxpo.CreateTime;
Qtyy = Qtyy - _maxpo.AsnQty;
consumlist.Add(consumne);
_maxpo.AsnQty = 0;
db.TB_MAXPO_DETAIL.AddOrUpdate(_maxpo);
}
}
}
});
}
p_entitys.ForEach(itm =>
{
@ -2432,8 +3117,8 @@ namespace CK.SCP.Controller
&& p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false).Select(p => p.Qty).Sum();
var _rejct = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == p_asn.AskBillNum && p.PartCode == itm.PartCode
&& p.PoBillNum == p_asn.PoBillNum && p.PoLine == itm.PoLine && p.IsDeleted == false&&p.BillType==3).Select(p => p.Qty).ToList().Sum();
if (_currSum - _curr + itm.Qty- Math.Abs(_rejct) <= _sum)
{
//if (_currSum - _curr + itm.Qty- Math.Abs(_rejct) <= _sum)
//{
TB_ASN_DETAIL _detail = new TB_ASN_DETAIL();
_detail.UID = itm.UID;
_detail.UnConv = itm.UnConv;
@ -2455,20 +3140,32 @@ namespace CK.SCP.Controller
_detail.PoUnit = itm.PoUnit;
_detail.LocUnit = itm.LocUnit;
_detail.IsDeleted = itm.IsDeleted;
_detail.State = (int)AsnState.Ship;
_detail.State = (int)AsnState.Ship;
_detail.GUID = itm.Guid;
_detail.UpdateInfo = itm.UpdateInfo;
_detail.UpdateUser = itm.UpdateUser;
_detail.Extend1 = itm.Extend1;
_ls.Add(_detail);
TS_UNI_API api = UniApiController.CreateBy(p_asn, itm, UniApiType.Receive);
api.State = 1;
db.TS_UNI_API.AddOrUpdate(api);//同步更新中间表
var UNI = db.TS_UNI_API.Count(p=>p.BillNum==itm.AsnBillNum);//多组件订单更新中间表
if (UNI > 0)
{
var UN = db.TS_UNI_API.Where(p => p.BillNum == itm.AsnBillNum).ToList();
foreach(var u in UN)
{
u.PutTime = DateTime.Now;
u.State = 1;
db.TS_UNI_API.AddOrUpdate(u);
}
}
else
{
_ret.MessageList.Add(string.Format("行号{0}零件名称:{1}数量合计已大于要货单{2}数量", itm.PoLine, itm.PartDesc1, itm.AskBillNum));
TS_UNI_API api = UniApiController.CreateBy(p_asn, itm, UniApiType.Receive);
api.State = 1;
db.TS_UNI_API.AddOrUpdate(api);//同步更新中间表
}
}
);
var _asnBillNum = _asn[0].AsnBillNum;
@ -2487,7 +3184,10 @@ namespace CK.SCP.Controller
else
{
db.TB_ASN_DETAIL.AddOrUpdate(p => p.UID, _ls.ToArray());
if (consumlist.Count() > 0)
{
db.TB_MAXPO_CONSUME.AddRange(consumlist);
}
if (db.SaveChanges() != -1)
{
_ret.State = ReturnStatus.Succeed;
@ -3340,5 +4040,6 @@ namespace CK.SCP.Controller
}
return ErrorList;
}
}
}
}

606
Controller/SCP_BARCODE_CONTROLLER.cs

@ -96,8 +96,217 @@ namespace CK.SCP.Controller
}
return _ret;
}
public static ResultObject<bool> DELETE_TB_PALLETS_BTL(List<string> _ls)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
foreach(var ls in _ls)
{
List<TB_ASN_PARTBOX> list = new List<TB_ASN_PARTBOX>();
var _pallete = db.TB_PALLETS_BTL.FirstOrDefault(p=>p.UID.ToString()==ls);
if (!string.IsNullOrEmpty(_pallete.PartCode))
{
var _asnpart = db.TB_ASN_PARTBOX.FirstOrDefault(p=>p.PartCode== _pallete.PartCode&&p.AsnBillNum== _pallete.AsnBillNum);
_asnpart.Box = _asnpart.Box +int.Parse(_pallete.Box);
list.Add(_asnpart);
}
if (!string.IsNullOrEmpty(_pallete.PartCode1))
{
var _asnpart = db.TB_ASN_PARTBOX.FirstOrDefault(p => p.PartCode == _pallete.PartCode1 && p.AsnBillNum == _pallete.AsnBillNum);
_asnpart.Box = _asnpart.Box + int.Parse(_pallete.Box1);
list.Add(_asnpart);
}
if (!string.IsNullOrEmpty(_pallete.PartCode2))
{
var _asnpart = db.TB_ASN_PARTBOX.FirstOrDefault(p => p.PartCode == _pallete.PartCode2 && p.AsnBillNum == _pallete.AsnBillNum);
_asnpart.Box = _asnpart.Box + int.Parse(_pallete.Box2);
list.Add(_asnpart);
}
if (!string.IsNullOrEmpty(_pallete.PartCode3))
{
var _asnpart = db.TB_ASN_PARTBOX.FirstOrDefault(p => p.PartCode == _pallete.PartCode3 && p.AsnBillNum == _pallete.AsnBillNum);
_asnpart.Box = _asnpart.Box + int.Parse(_pallete.Box3);
list.Add(_asnpart);
}
if (!string.IsNullOrEmpty(_pallete.PartCode4))
{
var _asnpart = db.TB_ASN_PARTBOX.FirstOrDefault(p => p.PartCode == _pallete.PartCode4 && p.AsnBillNum == _pallete.AsnBillNum);
_asnpart.Box = _asnpart.Box + int.Parse(_pallete.Box4);
list.Add(_asnpart);
}
if (!string.IsNullOrEmpty(_pallete.PartCode5))
{
var _asnpart = db.TB_ASN_PARTBOX.FirstOrDefault(p => p.PartCode == _pallete.PartCode5 && p.AsnBillNum == _pallete.AsnBillNum);
_asnpart.Box = _asnpart.Box + int.Parse(_pallete.Box5);
list.Add(_asnpart);
}
_pallete.IsDeleted = true;
var _ts = db.TS_BARCODE.Where(p => p.PalletNum == _pallete.PalletNum).ToList();
_ts.ForEach(p=>{
p.PalletNum = "";
});
db.TS_BARCODE.AddOrUpdate(_ts.ToArray());
db.TB_ASN_PARTBOX.AddOrUpdate(list.ToArray());
db.TB_PALLETS_BTL.AddOrUpdate(_pallete);
}
if (_ret.MessageList.Count > 0)
{
_ret.State = ReturnStatus.Failed;
}
else
{
if (db.SaveChanges() != -1)
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = true;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
}
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.Result = false;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Change_Vend_state", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static void Get_TS_PALLETS_BTL_List(TB_PALLETS_BTL p_entity, Action<ResultObject<IQueryable<TB_PALLETS_BTL>>> p_action)
{
ResultObject<IQueryable<TB_PALLETS_BTL>> _ret = new ResultObject<IQueryable<TB_PALLETS_BTL>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<TB_PALLETS_BTL> q = db.TB_PALLETS_BTL;
if (!string.IsNullOrEmpty(p_entity.PalletNum))
{
q = q.Where(p => p.PalletNum == p_entity.PalletNum);
}
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
{
q = q.Where(p => p.AsnBillNum == p_entity.AsnBillNum);
}
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "Get_TS_BARCODE_List", e.Message);
throw e;
}
}
public static ResultObject<List<TB_PRINT_COUNT>> Get_TB_PRINT_COUNT_List(TB_PRINT_COUNT p_entity)
{
ResultObject<List<TB_PRINT_COUNT>> _ret = new ResultObject<List<TB_PRINT_COUNT>>();
@ -483,7 +692,7 @@ namespace CK.SCP.Controller
_ret.MessageList.Add("基础信息未找到该编号零件!");
}
var vendPart= db.TA_VEND_PART.FirstOrDefault(p => p.PartCode == p_entity.PartCode && p.VendId == p_entity.VendId);
var ret = GetSmallBarcodeRule(p_entity.PartCode, p_entity.Batch, cnt);
var ret = GetSmallBarcodeRule(p_entity.PartCode, p_entity.Batch, cnt);
var _part = db.TA_PART.FirstOrDefault(p => p.PartCode == p_entity.PartCode && p.Site == p_entity.Site);
if (ret.State == ReturnStatus.Succeed)
{
@ -521,6 +730,7 @@ namespace CK.SCP.Controller
Remark = p_entity.Remark,
SmallPackQty = p_entity.PackQty,
Site = p_entity.Site
};
if (_part == null)
{
@ -670,14 +880,222 @@ namespace CK.SCP.Controller
}
return _ret;
}
/// <summary>
/// 批量生成条码(必须是相同零件号,调用时慎重!!!)
/// </summary>
/// <param name="details"></param>
/// <returns></returns>
public static ResultObject<List<TS_BARCODE>> CreateBatchBarcodeList(List<V_TB_ASN_DETAIL> details)
{
ResultObject<List<TS_BARCODE>> _ret = new ResultObject<List<TS_BARCODE>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var checkitem = details.Select(r => new { r.PartCode, r.Batch }).Distinct();
if (checkitem.Count() > 1)
{
_ret.State = ReturnStatus.Failed;
_ret.Message = "批量生成条码出错,存在多批次不能调用批量打印,联系管理员!";
return _ret;
}
var list = new List<TS_BARCODE>();
var ret = GetBarcodeRule(details[0].PartCode, details[0].Batch, details.Count);
if (ret.State == ReturnStatus.Succeed)
{
var barcodeRule = ret.Result;
var partcode = details[0].PartCode;
var vendId = details[0].VendId;
var asnBillNum = details[0].AsnBillNum;
var site= details[0].Site;
var poBillNum= details[0].PoBillNum;
var part = db.TA_PART.FirstOrDefault(p => p.PartCode == partcode);
if (part == null)
{
_ret.MessageList.Add("基础信息未找到该编号零件!");
//throw e;
}
var vendPart = db.TA_VEND_PART.FirstOrDefault(p => p.PartCode == partcode && p.VendId == vendId && p.Site == site);
var _part1 = db.TB_ASN_DETAIL.FirstOrDefault(p => p.PartCode == partcode && p.AsnBillNum == asnBillNum && p.PoBillNum == poBillNum);
string coustomer = "";
if (_part1.Extend1 == "FT")
{
var _coustomer = db.TA_SubPart.FirstOrDefault(p => p.PartCode == partcode);
if (_coustomer != null)
{
coustomer = _coustomer.SubPart.Replace("-", "");
}
}
else
{
coustomer = part.PartCode.Replace("-", "");
}
var _part = db.TA_PART.FirstOrDefault(p => p.PartCode == partcode && p.Site == site);
var _AsnBillNum = db.TB_ASN.FirstOrDefault(p => p.AsnBillNum == asnBillNum);
var _Ask = db.TB_ASK_DETAIL.FirstOrDefault(p => p.PartCode == part.PartCode);
var _Askde = db.TB_ASK_DETAIL.FirstOrDefault(p => p.PartCode == part.PartCode && p.AskBillNum == _AsnBillNum.AskBillNum);
string str;
string str1;
string str2;
string str3;
string str4;
string str5;
string str6;
str2 = _AsnBillNum.ReceiveTime.ToString();
var _PinFan = db.TA_PinFan.FirstOrDefault(p => p.PartCode == partcode);
str6 = _PinFan == null ? "" : _PinFan.Barcodnt;
var _Appliance = db.TA_Appliance.FirstOrDefault(p => p.VendID == _AsnBillNum.VendId && p.PartNumber == _Askde.SubSite);
str = _Appliance == null ? "" : _Appliance.Model;//车型
str1 = _Appliance == null ? "" : _Appliance.ReciteNumber;//背番号
str3 = _Appliance == null ? "" : _Appliance.SufanLand;//所番地
str4 = _Appliance == null ? "" : _Appliance.BoxType;//箱种
str5 = _Appliance == null ? "" : _Appliance.PostEngineering;//后工程
for (int i = 0; i < details.Count; i++)
{
var barcodenum = barcodeRule.LastNumber - details.Count+i+1;
V_TB_ASN_DETAIL p_entity = details[i];
var createTime = ScpCache.GetServerTime();
var code = GetLastBarCode(p_entity.PartCode, p_entity.Batch, barcodenum);
if (part.PartDesc1.ToUpper().Contains("左") || part.PartDesc1.ToUpper().Contains("LEFT") ||
part.PartDesc2.ToUpper().Contains("左") || part.PartDesc1.ToUpper().Contains("LEFT"))
p_entity.Remark = "L" + p_entity.Remark;
if (part.PartDesc1.ToUpper().Contains("左") || part.PartDesc1.ToUpper().Contains("LEFT") ||
part.PartDesc2.ToUpper().Contains("左") || part.PartDesc1.ToUpper().Contains("LEFT"))
p_entity.Remark = "R" + p_entity.Remark;
string _check = (_part.Ischeck == false || _part.Ischeck == null) ? "" : "(免检)";
var barcode = new TS_BARCODE
{
BarCode = code,
PartCode = part.PartCode,
Extend12 = coustomer,
VendPartCode = vendPart?.VendPartCode,
Batch = p_entity.Batch,
ProduceDate = (DateTime)p_entity.ProduceDate,
SerialNum = barcodenum.ToString(ScpCache.Config.),
PoUnit = p_entity.PoUnit,
Qty = p_entity.Qty,
BarCodeType = 1,
BillNum = p_entity.AsnBillNum,
PoBillNum = p_entity.PoBillNum,
PoBillLine = p_entity.PoLine,
VendId = p_entity.VendId,
VendBatch = p_entity.VendBatch,
Extend1 = _part.PartDesc2,
Extend2 = _part.ReceivePort,//零件毛重
Extend3 = _part.PalletSize,//零件净重
CreateTime = p_entity.CreateTime,
CreateOper = p_entity.CreateUser,
State = 0,
Remark = p_entity.UpdateInfo,
PackQty = p_entity.PackQty,
Site = p_entity.Site,
IsScanned = false,
Extend4 = _Askde.SubSite,//零件号不是物料号
Extend5 = str,//车型
Extend7 = part.PartDesc1,
Extend6 = DateTime.Parse(str2),
Extend8 = str1,//背番号
Extend9 = str3,//所番地
Extend10 = str4,//箱种
Extend11 = str5,//后工程
Extend13 = (_AsnBillNum.ShipTime).Value,
Extend14 = _part1.Extend2,
Extend15 = str6,//品番
Extend16 = _part1.Extend1,
ProjectId = p_entity.UpdateUser
};
if (_part == null)
{
_ret.MessageList.Add("未找到零件,可能是零件编号或地点信息错误,零件编号" + p_entity.PartCode);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBarcodeList", "未找到零件,可能是零件编号或地点信息错误,零件编号" + p_entity.PartCode);
}
else
{
var _isCheck = (_part.Ischeck == null) ? false : _part.Ischeck;
barcode.Qlevel = _part.Qlevel;
barcode.QMark = (_isCheck == true) ? "免检" : "全检";
//barcode.ProjectId = _part.ProjectId;
}
var fullCode = GetFullCode(barcode);
barcode.FullBarCode = fullCode;
list.Add(barcode);
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = list;
}
else
{
_ret.State = ReturnStatus.Failed;
_ret.Message = "批量创建编码规则出错!";
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBatchBarcodeList", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBatchBarcodeList", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBatchBarcodeList", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "CreateBarcodeList", e.Message);
throw e;
}
return _ret;
}
public static ResultObject<List<TS_BARCODE>> CreateBarcodeList(V_TB_ASN_DETAIL p_entity, int cnt = 1)
{
ResultObject<List<TS_BARCODE>> _ret = new ResultObject<List<TS_BARCODE>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var list = new List<TS_BARCODE>();
@ -687,12 +1105,44 @@ namespace CK.SCP.Controller
_ret.MessageList.Add("基础信息未找到该编号零件!");
//throw e;
}
var vendPart
= db.TA_VEND_PART.FirstOrDefault(p => p.PartCode == p_entity.PartCode && p.VendId == p_entity.VendId && p.Site==p_entity.Site);
var vendPart = db.TA_VEND_PART.FirstOrDefault(p => p.PartCode == p_entity.PartCode && p.VendId == p_entity.VendId && p.Site == p_entity.Site);
var ret = GetBarcodeRule(p_entity.PartCode, p_entity.Batch, cnt);
var _part1 = db.TB_ASN_DETAIL.FirstOrDefault(p => p.PartCode == p_entity.PartCode && p.AsnBillNum == p_entity.AsnBillNum && p.PoBillNum == p_entity.PoBillNum);
string coustomer = "";
if (_part1.Extend1 == "FT")
{
var _coustomer = db.TA_SubPart.FirstOrDefault(p => p.PartCode == p_entity.PartCode);
if (_coustomer != null)
{
coustomer = _coustomer.SubPart.Replace("-", "");
}
}
else
{
coustomer = part.PartCode.Replace("-", "");
}
var _part=db.TA_PART.FirstOrDefault(p=>p.PartCode==p_entity.PartCode && p.Site==p_entity.Site);
var _AsnBillNum=db.TB_ASN.FirstOrDefault(p => p.AsnBillNum == p_entity.AsnBillNum );
var _Ask = db.TB_ASK_DETAIL.FirstOrDefault(p => p.PartCode == part.PartCode);
var _Askde = db.TB_ASK_DETAIL.FirstOrDefault(p => p.PartCode == part.PartCode&&p.AskBillNum== _AsnBillNum.AskBillNum);
string str;
string str1;
string str2;
string str3;
string str4;
string str5;
string str6;
str2 = _AsnBillNum.ReceiveTime.ToString();
var _PinFan = db.TA_PinFan.FirstOrDefault(p => p.PartCode == p_entity.PartCode);
str6 = _PinFan == null ? "" : _PinFan.Barcodnt;
var _Appliance = db.TA_Appliance.FirstOrDefault(p => p.VendID == _AsnBillNum.VendId && p.PartNumber == _Askde.SubSite);
str = _Appliance == null ? "" : _Appliance.Model;//车型
str1 = _Appliance == null ? "" : _Appliance.ReciteNumber;//背番号
str3 = _Appliance == null ? "" : _Appliance.SufanLand;//所番地
str4 = _Appliance == null ? "" : _Appliance.BoxType;//箱种
str5 = _Appliance == null ? "" : _Appliance.PostEngineering;//后工程
if (ret.State == ReturnStatus.Succeed)
{
var barcodeRule = ret.Result;
@ -711,6 +1161,8 @@ namespace CK.SCP.Controller
{
BarCode = code,
PartCode = part.PartCode,
Extend12 = coustomer,
VendPartCode = vendPart?.VendPartCode,
Batch = p_entity.Batch,
ProduceDate = (DateTime)p_entity.ProduceDate,
@ -719,19 +1171,34 @@ namespace CK.SCP.Controller
Qty = p_entity.Qty,
BarCodeType = 1,
BillNum = p_entity.AsnBillNum,
PoBillNum=p_entity.PoBillNum,
PoBillNum = p_entity.PoBillNum,
PoBillLine = p_entity.PoLine,
VendId = p_entity.VendId,
VendBatch = p_entity.VendBatch,
Extend1 = _part.PartDesc2,
Extend2 = _part.ReceivePort,//零件毛重
Extend3 = _part.PalletSize,//零件净重
CreateTime = p_entity.CreateTime,
CreateOper = p_entity.CreateUser,
State = 0,
Remark = p_entity.UpdateInfo,
PackQty = p_entity.PackQty,
Site = p_entity.Site,
IsScanned = false
IsScanned = false,
Extend4 = _Askde.SubSite,//零件号不是物料号
Extend5 = str,//车型
Extend7 = part.PartDesc1,
Extend6 = DateTime.Parse(str2),
Extend8 = str1,//背番号
Extend9 = str3,//所番地
Extend10 = str4,//箱种
Extend11 = str5,//后工程
Extend13 = (_AsnBillNum.ShipTime).Value,
Extend14 = _part1.Extend2,
Extend15 = str6,//品番
Extend16 = _part1.Extend1,
ProjectId = p_entity.UpdateUser
};
if (_part == null)
@ -744,7 +1211,7 @@ namespace CK.SCP.Controller
var _isCheck=(_part.Ischeck == null)?false:_part.Ischeck;
barcode.Qlevel = _part.Qlevel;
barcode.QMark = (_isCheck == true) ? "免检" : "全检";
barcode.ProjectId = _part.ProjectId;
//barcode.ProjectId = _part.ProjectId;
}
var fullCode = GetFullCode(barcode);
barcode.FullBarCode = fullCode;
@ -994,7 +1461,111 @@ namespace CK.SCP.Controller
}
return _ret;
}
private static ResultObject<TS_BARCODE_RULE> GetBarcodeRule( string partcode, string batch, int cnt = 1)
public static ResultObject<TS_BARCODE> updatebarder(List<String> barder)
{
ResultObject<TS_BARCODE> _ret = new ResultObject<TS_BARCODE>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
foreach (var yy in barder)
{
var _barder = db.TS_BARCODE.SingleOrDefault(t => t.UID.ToString() == yy);
var _second1 = db.TS_BARCODE.Where(p => p.PartCode == _barder.PartCode).Select(r => r.SerialNum).Max();
var _bard = db.TS_BARCODE.SingleOrDefault(t => t.SerialNum.ToString() == _second1.ToString()&&t.PartCode==_barder.PartCode);
string str = _barder.BarCode;
//str.Split('.');
//string str1 = str.Substring(str.Length - 6);
string str1 = _bard.SerialNum;
string str3 = str.Substring(0, str.Length - 6);
int i = Int32.Parse(str1);
i = i + 1;
string ss = i.ToString().PadLeft(6, '0');
string str4=str3+ss;
var _barder1 = db.TS_BARCODE.Count(t => t.BarCode.ToString() == str4);
_barder.BarCode = str4;
_barder.SerialNum = ss;
db.TS_BARCODE.AddOrUpdate(_barder);
if (db.SaveChanges() != -1)
{
_ret.State = ReturnStatus.Succeed;
}
else
{
_ret.State = ReturnStatus.Failed;
}
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", e.Message);
throw e;
}
return _ret;
}
public static string Save_TS_Asn(string ls)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
var TT= db.TS_BARCODE.Where(p => p.UID.ToString() == ls).FirstOrDefault();
var SS=db.TA_PART.Where(p => p.PartCode == TT.PartCode).FirstOrDefault();
string part = SS.PartGroup;
return part;
}
}
private static ResultObject<TS_BARCODE_RULE> GetBarcodeRule(string partcode, string batch, int cnt = 1)
{
ResultObject<TS_BARCODE_RULE> _ret = new ResultObject<TS_BARCODE_RULE>();
try
@ -1027,13 +1598,13 @@ namespace CK.SCP.Controller
{
_ret.State = ReturnStatus.Succeed;
_ret.Result = barcodeRule;
}
else
{
_ret.State = ReturnStatus.Failed;
}
}
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
@ -1055,7 +1626,7 @@ namespace CK.SCP.Controller
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_BARCODE_CONTROLLER), "GetBarcodeRule", ex.ToString());
@ -1071,7 +1642,7 @@ namespace CK.SCP.Controller
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
@ -1088,7 +1659,6 @@ namespace CK.SCP.Controller
}
return _ret;
}
private static ResultObject<TB_PALLETS_RULL> GetPalletsRule(string partcode, string batch, int cnt = 1)
{
ResultObject<TB_PALLETS_RULL> _ret = new ResultObject<TB_PALLETS_RULL>();

34
Controller/SCP_BILLCODE_CONTROLLER.cs

@ -24,6 +24,36 @@ namespace CK.SCP.Controller
return GetTablePK("P", "TB_PO", "PoBillNum", "yyMMdd", 4);
}
public static string MakemaxPOCode(string vendid,string time)
{
return GetTablePK(vendid, "TB_MAXPO", "PoBillNum", time, 4);
}
public static string MakePOCode1()
{
return GetTablePK("CYD03", "TB_PO", "PoBillNum", "yyMM", 5);
}
public static string MakePOCode3()
{
return GetTablePK("FB2", "TB_PO", "PoBillNum", "yyyyMMdd", 3);
}
public static string MakePOCode4()
{
return GetTablePK("FB1", "TB_PO", "PoBillNum", "yyyyMMdd", 3);
}
public static string MakePOCode2()
{
return GetTablePK("CYD01", "TB_PO", "PoBillNum", "yyMM", 5);
}
public static string MakeQualityCode()
{
@ -67,6 +97,10 @@ namespace CK.SCP.Controller
{
return GetTablePKByNum("K", "TB_ASK", "AskBillNum", "yyMMdd", 4, num);
}
public static string MakeASKCodeByNum1(int num)
{
return GetTablePKByNum("K", "TB_ASK", "AskBillNum", "yyMM",6 , num);
}
public static string MakeASKCode()
{

84
Controller/SCP_CONTRACT_CONTROLLER.cs

@ -361,7 +361,91 @@ namespace CK.SCP.Controller
}
return p_list;
}
public static List<V_TB_PO_DETAIL> GET_SUB_PART_LIST(List<V_TB_PO_DETAIL> p_list)
{
if (p_list.Count > 0)
{
p_list.ForEach(p =>
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
if (!string.IsNullOrEmpty(p.SubSite))
{
var part = db.TA_PART.FirstOrDefault(t => t.PartCode == p.SubSite);
if (part != null)
{
p.Subpartspec = part.PartDesc2;
}
}
}
});
}
return p_list;
}
public static List<V_TB_PO_DETAIL> GET_MAXPO_LIST(List<V_TB_PO_DETAIL> p_list)
{
if (p_list.Count > 0)
{
p_list.ForEach(p =>
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List<string> _ls = new List<string>();
var _No = db.TB_MAXPO_CONSUME.Where(t => t.PartCode == p.PartCode&&t.BillNum==p.PoBillNum).ToList();
var _Month = db.V_TB_MAXPO_CONSUME.Where(t => t.PartCode == p.PartCode && t.BillNum == p.PoBillNum).ToList();
foreach(var Mo in _Month)
{
if (!_ls.Contains(Mo.ContractMonth))
{
_ls.Add(Mo.ContractMonth);
}
}
string ContactNo = string.Join(";",_ls);
p.ContractMonth = ContactNo;
foreach (var pa in _No)
{
ContactNo = ContactNo + pa.PoBillNum + ";";
}
p.ContractNo = ContactNo.Substring(0, ContactNo.Length - 1).Trim();
}
});
}
return p_list;
}
public static List<V_TA_SubPartCode> GET_SUB_PART_LIST_CYJ(List<V_TA_SubPartCode> p_list)
{
if (p_list.Count > 0)
{
p_list.ForEach(p =>
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
if (!string.IsNullOrEmpty(p.PartCode))
{
var part = db.TA_PART.FirstOrDefault(t => t.PartCode == p.PartCode);
if (part != null)
{
p.Partname = part.PartDesc1;
}
}
}
});
}
return p_list;
}
public static List<V_TB_ASK_DETAIL> GET_CONTRACT_PRICE_LIST(List<V_TB_ASK_DETAIL> p_list)
{

59
Controller/SCP_EXCEL_CONTROLLER.cs

@ -62,8 +62,9 @@ namespace CK.SCP.Controller
po_detail. = itm.ShippedQty.ToString();
po_detail. = itm.ReceivedQty.ToString();
po_detail.退 = itm.RejectQty;
po_detail. = itm.EndTime == null ? string.Empty : ((DateTime)itm.BeginTime).ToString("yyyyMMdd"); ;
po_detail. = itm.EndTime.ToString();
po_detail. = itm.PoUnit;
po_detail. = itm.Extend2;
_exportDetailList.Add(po_detail);
});
var _list_dt = ConvertHelper.ToDataTable(_exportDetailList);
@ -71,6 +72,56 @@ namespace CK.SCP.Controller
}
return _ds;
}
public static DataSet GET_MAXPO_EXECEL(List<string> p_lst, bool p_IsDetail = false)
{
DataSet _ds = new DataSet();
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
if (p_IsDetail == false)
{
var _ls = db.V_TB_MAXPO.Where(p => p_lst.Contains(p.PoBillNum)).ToList();
var _exportList = new List<SCP_MAXPODC_EXPORT>();
_ls.ForEach(itm =>
{
SCP_MAXPODC_EXPORT _export = new SCP_MAXPODC_EXPORT();
_export. = itm.PoBillNum;
_export. = itm.ContractMonth;
_export. = itm.VendId;
_export. = itm.VendName;
_exportList.Add(_export);
});
var _dt = ConvertHelper.ToDataTable(_exportList);
_ds.Tables.Add(_dt);
}
var _detailList = db.V_TB_MAXPO_DETAIL.Where(p => p_lst.Contains(p.PoBillNum)).ToList();
var _exportDetailList = new List<SCP_MAXPO_DETAIL_EXPORT>();
_detailList.ForEach(itm =>
{
var po_detail = new SCP_MAXPO_DETAIL_EXPORT();
var part = db.TA_PART.FirstOrDefault(p=>p.PartCode==itm.PartCode);
po_detail. = itm.PartNumber;
po_detail. = itm.PartCode;
po_detail. = itm.OrderNumber.ToString();
po_detail. = itm.OrderQtyd.ToString();
po_detail. = itm.MinordQty.ToString();
po_detail. = itm.TechStandard;
po_detail. = itm.Matermanu;
po_detail. = itm.PoLine.ToString();
po_detail. = part.PartDesc2;
po_detail. = itm.Model;
po_detail.1 = itm.forecastone;
po_detail.2 = itm.forecasttwo;
po_detail.3 = itm.forecastthree;
po_detail.4 = itm.forecastfour;
po_detail.5 = itm.forecastfive;
po_detail.6 = itm.forecastsix;
_exportDetailList.Add(po_detail);
});
var _list_dt = ConvertHelper.ToDataTable(_exportDetailList);
_ds.Tables.Add(_list_dt);
}
return _ds;
}
public static DataSet GET_OTD_VendId_REPORT_EXECEL(List<SCP_OTD_EXPORT> p_lst)
{
DataSet _ds = new DataSet();
@ -239,7 +290,7 @@ namespace CK.SCP.Controller
}
return _ds;
}
}
public static DataSet GET_ASN_EXECEL(List<string> p_lst)
{
DataSet _ds = new DataSet();
@ -342,7 +393,9 @@ namespace CK.SCP.Controller
//_entity.折扣价格 = itm.DiscountPrice.ToString();
//_entity.折扣备注 = itm.DiscountRemark;
_entity. = itm.Qty.ToString();
_entity. = itm.Remark;
_entity. = itm.Remark;
_entity. = itm.Extend1 =( itm.Price*itm.Qty).ToString();
_entity. = itm.Extend2 = (itm.PurCost * itm.Qty).ToString();
_exportDetailList.Add(_entity);
});
var _list_dt = ConvertHelper.ToDataTable(_exportDetailList);

336
Controller/SCP_INVOICE_CONTROLLER.cs

@ -336,7 +336,343 @@ namespace CK.SCP.Controller
throw e;
}
}
public static void Get_V_TB_INVOICE_List1(V_TB_REEEE p_entity, Action<ResultObject<IQueryable<V_TB_REEEE>>> p_action)
{
ResultObject<IQueryable<V_TB_REEEE>> _ret = new ResultObject<IQueryable<V_TB_REEEE>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<V_TB_REEEE> q = db.V_TB_REEEE;
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
{
q = q.Where(p => p.PoBillNum == p_entity.PoBillNum);
}
if (!string.IsNullOrEmpty(p_entity.VendId))
{
q = q.Where(p => p.VendId == p_entity.VendId);
}
if (!string.IsNullOrEmpty(p_entity.VendName))
{
q = q.Where(p => p.VendName.Contains(p_entity.VendName));
}
if (!string.IsNullOrEmpty(p_entity.PartCode))
{
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
}
if (!string.IsNullOrEmpty(p_entity.PartDesc2))
{
q = q.Where(p => p.PartDesc2.Contains(p_entity.PartDesc2));
}
if (!string.IsNullOrEmpty(p_entity.PartGroup))
{
q = q.Where(p => p.PartGroup.Contains(p_entity.PartGroup));
}
if (!string.IsNullOrEmpty(p_entity.CreateUser))
{
q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser));
}
if (!string.IsNullOrEmpty(p_entity.DockCode))
{
q = q.Where(p => p.DockCode.Contains(p_entity.DockCode));
}
if (!string.IsNullOrEmpty(p_entity.Buyer))
{
q = q.Where(p => p.Buyer.Contains(p_entity.Buyer));
}
if (!string.IsNullOrEmpty(p_entity.Describe))
{
q = q.Where(p => p.Describe.Contains(p_entity.Describe));
}
if (p_entity.ReceiveTimeBegin != null)
{
q = q.Where(p => p.CreateTime >= p_entity.ReceiveTimeBegin);
}
if (p_entity.ReceiveTimeEnd != null)
{
q = q.Where(p => p.CreateTime <= p_entity.ReceiveTimeEnd);
}
if (p_entity.Qty != 0)
{
q = q.Where(p => p.Qty == p_entity.Qty);
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", e.Message);
throw e;
}
}
public static void Get_V_TB_INVOICE_List_APPLIANCE(V_TA_APPLIANCE p_entity, Action<ResultObject<IQueryable<V_TA_APPLIANCE>>> p_action)
{
ResultObject<IQueryable<V_TA_APPLIANCE>> _ret = new ResultObject<IQueryable<V_TA_APPLIANCE>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<V_TA_APPLIANCE> q = db.V_TA_APPLIANCE;
if (!string.IsNullOrEmpty(p_entity.PartNumber))
{
q = q.Where(p => p.PartNumber == p_entity.PartNumber);
}
if (!string.IsNullOrEmpty(p_entity.VendID))
{
q = q.Where(p => p.VendID == p_entity.VendID);
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", e.Message);
throw e;
}
}
public static void Get_TA_SubPartCode(V_TA_SubPartCode p_entity, Action<ResultObject<IQueryable<V_TA_SubPartCode>>> p_action)
{
ResultObject<IQueryable<V_TA_SubPartCode>> _ret = new ResultObject<IQueryable<V_TA_SubPartCode>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<V_TA_SubPartCode> q = db.V_TA_SubPartCode;
if (p_entity.PartList != null && p_entity.PartList.Count > 0)
{
q = q.Where(p => p_entity.PartList.Contains(p.PartCode));
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", e.Message);
throw e;
}
}
public static void Get_TA_RECEING(TA_Receiving_Information p_entity, Action<ResultObject<IQueryable<TA_Receiving_Information>>> p_action)
{
ResultObject<IQueryable<TA_Receiving_Information>> _ret = new ResultObject<IQueryable<TA_Receiving_Information>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<TA_Receiving_Information> q = db.TA_Receiving_Information;
if (!string.IsNullOrEmpty(p_entity.Shift))
{
q = q.Where(p => p.Shift == p_entity.Shift);
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", e.Message);
throw e;
}
}
public static void Get_V_TB_INVOICE_ERP_List(V_TB_INVOICE p_entity, Action<ResultObject<IQueryable<V_TB_INVOICE>>> p_action)
{
ResultObject<IQueryable<V_TB_INVOICE>> _ret = new ResultObject<IQueryable<V_TB_INVOICE>>();

81
Controller/SCP_PALLET_CONTROLLER.cs

@ -175,6 +175,87 @@ namespace CK.SCP.Controller
}
}
public static void Get_TB_PALLETS_BTL_List(TB_PALLETS_BTL p_entity, Action<ResultObject<IQueryable<TB_PALLETS_BTL>>> p_action)
{
ResultObject<IQueryable<TB_PALLETS_BTL>> _ret = new ResultObject<IQueryable<TB_PALLETS_BTL>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<TB_PALLETS_BTL> q = db.TB_PALLETS_BTL;
if (p_entity.UID != 0)
{
q = q.Where(p => p.UID == p_entity.UID);
}
if (p_entity.UIDList != null && p_entity.UIDList.Count > 0)
{
q = q.Where(p => p_entity.UIDList.Contains(p.UID));
}
if (!string.IsNullOrEmpty(p_entity.AsnBillNum))
{
q = q.Where(p => p.AsnBillNum.Contains(p_entity.AsnBillNum));
}
if (!string.IsNullOrEmpty(p_entity.VendId))
{
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
}
if (!string.IsNullOrEmpty(p_entity.PartCode))
{
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
}
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_TB_PALLETS_List", e.Message);
throw e;
}
}
public static void Get_TB_PALLETS_List(TB_PALLETS p_entity, Action<ResultObject<IQueryable<TB_PALLETS>>> p_action)
{
ResultObject<IQueryable<TB_PALLETS>> _ret = new ResultObject<IQueryable<TB_PALLETS>>();

7751
Controller/SCP_PO_CONTROLLER.cs

File diff suppressed because it is too large

64
Controller/SCP_REPORT_CONTROLLER.cs

@ -912,7 +912,71 @@ namespace CK.SCP.Controller
}
}
public static void Get_V_TB_ASK_ASN_View_List1(V_TB_REEEE p_entity, Action<ResultObject<IQueryable<V_TB_REEEE>>> p_action)
{
ResultObject<IQueryable<V_TB_REEEE>> _ret = new ResultObject<IQueryable<V_TB_REEEE>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<V_TB_REEEE> q = db.V_TB_REEEE;
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
{
q = q.Where(p => p.PoBillNum == p_entity.PoBillNum);
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{
var sb = new StringBuilder();
foreach (var error in dbEx.EntityValidationErrors.ToList())
{
error.ValidationErrors.ToList().ForEach(i =>
{
sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage);
});
}
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(dbEx);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List", sb.ToString());
throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString());
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List", ex.ToString());
throw new ScpException(ResultCode.Exception, "9999", ex.ToString());
}
catch (ScpException ex)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(ex);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List", ex.ToString());
if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException))
{
var inner = (UpdateException)ex.InnerException;
throw new ScpException(ResultCode.Exception, "0000", ex.ToString());
}
else
{
if (ex.InnerException != null) throw ex.InnerException;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_ASN_View_List", e.Message);
throw e;
}
}
public static void Get_V_TB_ASK_RECEIVE_List(TB_ASK_RECEIVE p_entity, Action<ResultObject<IQueryable<TB_ASK_RECEIVE>>> p_action)
{

998
Controller/SCP_TA_LANGUAGE_CONTROLLER.cs

File diff suppressed because it is too large

12
Controller/SCP_TB_VENDER_CONTROLLER.cs

@ -28,7 +28,6 @@ namespace CK.SCP.Controller
return db.TA_VENDER.ToList();
}
}
public static List<TA_VENDER> Getlist(List<string> lsVenderID )
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
@ -36,7 +35,7 @@ namespace CK.SCP.Controller
var query = db.TA_VENDER.Where(p => lsVenderID.Contains(p.VendId));
return query.ToList();
}
}
}
public static List<TA_VENDER> Getlist(string p_site)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
@ -45,6 +44,7 @@ namespace CK.SCP.Controller
return db.TA_VENDER.Where(p => p.Site==p_site ).ToList();
}
}
public static List<TA_VENDER> GetVenderList(List<string> p_list)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
@ -69,7 +69,13 @@ namespace CK.SCP.Controller
return db.TA_VENDER.Where(p => p.VendId==p_VenderID && p.Site==p_Site).FirstOrDefault();
}
}
public static TB_ASN Save_ASN_Asn(string ls)
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
return db.TB_ASN.Where(p => p.AsnBillNum == ls).FirstOrDefault();
}
}
public static List<TA_VENDER> GetVendNameList(List<string> p_list, string p_site)
{
List<TA_VENDER> _ls = new List<TA_VENDER>();

4
Controller/SCP_TS_BARCODE_CONTROLLER.cs

@ -107,6 +107,10 @@ namespace CK.SCP.Controller
{
q = q.Where(p => p.PartName.Contains(p_entity.PartName));
}
if (!string.IsNullOrEmpty(p_entity.Extend16))
{
q = q.Where(p => p.Extend16==p_entity.Extend16);
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);

63
Controller/UniApiController.cs

@ -116,7 +116,7 @@ namespace CK.SCP.Controller
WmsTableName tableName;
switch (uniApiType)
{
case UniApiType.PO:
case UniApiType.Pobillnum:
tableName = WmsTableName.TS_UNI_API;//中间表的名字
break;
case UniApiType.Receive:
@ -235,9 +235,9 @@ namespace CK.SCP.Controller
case "xxwms_rc_det":
sql = "select * from xxwms_rc_det a inner join xxwms_ctrl b on a.xxwms_rc_seq = b.xxwms_seq where xxwms_domain = '{1}' and (xxwms_rc_nbr in ({0}) order by xxwms_rc_nbr, b.xxwms_seq";
break;
case "xxscm_tx_mstr":
sql = "select * from xxscm_tx_mstr a inner join xxscm_ctrl b on a.xxscm_tx_seq = b.xxscm_seq where xxscm_domain = '{1}' and xxscm_tx_nbr in ({0}) order by xxscm_tx_nbr, b.xxscm_seq";
break;
//case "xxscm_tx_mstr":
// sql = "select * from xxscm_tx_mstr a inner join xxscm_ctrl b on a.xxscm_tx_seq = b.xxscm_seq where xxscm_domain = '{1}' and xxscm_tx_nbr in ({0}) order by xxscm_tx_nbr, b.xxscm_seq";
// break;
case "xxscm_inv_det":
sql = "select * from xxscm_inv_det a inner join xxscm_ctrl b on a.xxscm_inv_seq = b.xxscm_seq where xxscm_domain = '{1}' and xxscm_inv_nbr IN({0}) order by xxscm_inv_nbr,b.xxscm_seq";
break;
@ -290,13 +290,58 @@ namespace CK.SCP.Controller
apiData.VendId = bill.VendId;
apiData.BillType = (int)BillType.PuchaseOrder;
apiData.SubBillType = 0;
apiData.ValidDate = (DateTime)detail.ProduceDate;
apiData.ValidDate = bill.EndTime;
apiData.ErpBillNum = bill.PoBillNum;
apiData.ErpLineNum = detail.PoLine;
if (bill.Site == "BJCIAI")
apiData.ModType= detail.UpdateInfo;
apiData.Barcode = "";
var ts = db.TS_UNI_API.Count(p => p.ErpLineNum == detail.PoLine && p.ErpBillNum == bill.PoBillNum);
string str = "000";
string st = bill.PoBillNum.Substring(0,4);
if (ts == 0)
{
string str1= detail.PoLine.ToString();
apiData.Extend3 = str1;
}
else
{
if (ts == 1)
{
var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max();
int ts2 = ts1 + 50;
string str2 = ts2.ToString();
apiData.Extend3 = str2;
}
else if (ts == 2)
{
var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max();
int ts2 = ts1 + 60;
string str3 = ts2.ToString();
apiData.Extend3 = str3;
}
else if (ts == 3)
{
var ts1 = db.TB_PO_DETAIL.Where(p => p.PoLine == detail.PoLine && p.PoBillNum == bill.PoBillNum).Select(r => r.PoLine).Max();
int ts2 = ts1 + 70;
string str4 = ts2.ToString();
apiData.Extend3 = str4;
}
else
{
var ts3 = db.TS_UNI_API.Where(p => p.ErpLineNum == detail.PoLine && p.ErpBillNum == bill.PoBillNum).Select(r => r.Extend3).Max();
int ts4 = int.Parse(ts3) + 10;
string str5 = ts4.ToString();
apiData.Extend3 = str5;
}
}
if (bill.SubSite == "W21")
{
apiData.VendBatch = detail.Batch;
apiData.VendBatch = detail.UpdateUser;
}
else
{
@ -311,7 +356,7 @@ namespace CK.SCP.Controller
apiData.Buyer = bill.Buyer;
apiData.BuyerPhone = bill.BuyerPhone;
apiData.Domain = bill.Site;
apiData.Site = bill.SubSite;
apiData.Site = bill.SubSite ==null ? bill.Site : bill.SubSite;
apiData.Extend1 = Utils.JsonHelper.GetJson(bill);
apiData.Extend2 = Utils.JsonHelper.GetJson(detail);

6
Controller/Web References/BomList/JsonService.disco

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://10.62.144.124:8016/JsonService.asmx?wsdl" docRef="http://10.62.144.124:8016/JsonService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://10.62.144.124:8016/JsonService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:JsonServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://10.62.144.124:8016/JsonService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:JsonServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

2062
Controller/Web References/BomList/JsonService.wsdl

File diff suppressed because it is too large

1610
Controller/Web References/BomList/Reference.cs

File diff suppressed because it is too large

7
Controller/Web References/BomList/Reference.map

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://10.62.144.124:8016/JsonService.asmx?wsdl" filename="JsonService.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://10.62.144.124:8016/JsonService.asmx?disco" filename="JsonService.disco" />
</Results>
</DiscoveryClientResultsFile>

6
Controller/Web References/BomList1/JsonService.disco

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://10.62.144.124:8070/JsonService.asmx?wsdl" docRef="http://10.62.144.124:8070/JsonService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://10.62.144.124:8070/JsonService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:JsonServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://10.62.144.124:8070/JsonService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:JsonServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

2062
Controller/Web References/BomList1/JsonService.wsdl

File diff suppressed because it is too large

1610
Controller/Web References/BomList1/Reference.cs

File diff suppressed because it is too large

7
Controller/Web References/BomList1/Reference.map

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://10.62.144.124:8070/JsonService.asmx?wsdl" filename="JsonService.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://10.62.144.124:8070/JsonService.asmx?disco" filename="JsonService.disco" />
</Results>
</DiscoveryClientResultsFile>

6
Controller/Web References/BomListcompany/JsonService.disco

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://192.168.0.228:7602/JsonService.asmx?wsdl" docRef="http://192.168.0.228:7602/JsonService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://192.168.0.228:7602/JsonService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:JsonServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://192.168.0.228:7602/JsonService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:JsonServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

2062
Controller/Web References/BomListcompany/JsonService.wsdl

File diff suppressed because it is too large

1610
Controller/Web References/BomListcompany/Reference.cs

File diff suppressed because it is too large

7
Controller/Web References/BomListcompany/Reference.map

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://192.168.0.228:7602/JsonService.asmx?disco" filename="JsonService.disco" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://192.168.0.228:7602/JsonService.asmx?wsdl" filename="JsonService.wsdl" />
</Results>
</DiscoveryClientResultsFile>

6
Controller/Web References/BomVersion/JsonService.disco

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://10.62.144.124:8070/JsonService.asmx?wsdl" docRef="http://10.62.144.124:8070/JsonService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://10.62.144.124:8070/JsonService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:JsonServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://10.62.144.124:8070/JsonService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:JsonServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

1333
Controller/Web References/BomVersion/JsonService.wsdl

File diff suppressed because it is too large

1064
Controller/Web References/BomVersion/Reference.cs

File diff suppressed because it is too large

7
Controller/Web References/BomVersion/Reference.map

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://10.62.144.124:8070/JsonService.asmx?wsdl" filename="JsonService.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://10.62.144.124:8070/JsonService.asmx?disco" filename="JsonService.disco" />
</Results>
</DiscoveryClientResultsFile>

6
Controller/Web References/BomVersion1/JsonService.disco

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://10.89.25.69:8085/JsonService.asmx?wsdl" docRef="http://10.89.25.69:8085/JsonService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://10.89.25.69:8085/JsonService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:JsonServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://10.89.25.69:8085/JsonService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:JsonServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

1816
Controller/Web References/BomVersion1/JsonService.wsdl

File diff suppressed because it is too large

1426
Controller/Web References/BomVersion1/Reference.cs

File diff suppressed because it is too large

7
Controller/Web References/BomVersion1/Reference.map

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://10.89.25.69:8085/JsonService.asmx?wsdl" filename="JsonService.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://10.89.25.69:8085/JsonService.asmx?disco" filename="JsonService.disco" />
</Results>
</DiscoveryClientResultsFile>

41
Controller/app.config

@ -1,29 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="CK.SCP.Controller.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1" />
<assemblyIdentity name="EPPlus" publicKeyToken="ea159fdaa78159a1" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.5.2.1" newVersion="4.5.2.1"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
</configuration>
<applicationSettings>
<CK.SCP.Controller.Properties.Settings>
<setting name="CK_SCP_Controller_BomVersion1_JsonService" serializeAs="String">
<value>http://10.89.25.69:8085/JsonService.asmx</value>
</setting>
<setting name="CK_SCP_Controller_BomList_JsonService" serializeAs="String">
<value>http://10.62.144.124:8016/JsonService.asmx</value>
</setting>
<setting name="CK_SCP_Controller_BomListcompany_JsonService" serializeAs="String">
<value>http://192.168.0.228:7602/JsonService.asmx</value>
</setting>
<setting name="CK_SCP_Controller_BomList1_JsonService" serializeAs="String">
<value>http://10.62.144.124:8070/JsonService.asmx</value>
</setting>
</CK.SCP.Controller.Properties.Settings>
</applicationSettings>
<system.serviceModel>
<bindings/>
<client/>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/></startup></configuration>

3
Models/AppBoxEntity/AppBoxContext.cs

@ -27,7 +27,8 @@ namespace CK.SCP.Models.AppBoxEntity
public DbSet<TA_FACTORY> TA_FACTORY { get; set; }
public DbSet<VenderUsers> VenderUsers { get; set; }
public DbSet<FactoryUsers> FactoryUsers { get; set; }
public DbSet<FactoryUsers> FactoryUsers { get; set; }
public DbSet<UserToken> UserTokens { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

4
Models/AppBoxEntity/User.cs

@ -77,6 +77,10 @@ namespace CK.SCP.Models.AppBoxEntity
public DateTime? LastLoginTime { get; set; }
public DateTime? CreateTime { get; set; }
public int ErrorCount { get; set; }
public DateTime LastUpdatePasswordTime { get; set; } = DateTime.Now;
public virtual ICollection<TA_FACTORY> TA_FACTORY { get; set; }
/*
public virtual ICollection<FACTORY_ADDRESS> FACTORY_ADDRESS { get; set; }

33
Models/AppBoxEntity/UserToken.cs

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.AppBoxEntity
{
public class UserToken : IKeyID
{
[Key]
public int ID { get; set; }
[Required, StringLength(50)]
public string UserName { get; set; }
[StringLength(500)]
public string Token { get; set; }
public System.DateTime CreateTime { get; set; }
[StringLength(50)]
public string CreateUser { get; set; }
public Nullable<System.DateTime> UpdateTime { get; set; }
[StringLength(50)]
public string UpdateUser { get; set; }
[StringLength(500)]
public string Remark { get; set; }
}
}

43
Models/CK.SCP.Models.csproj

@ -11,6 +11,7 @@
<AssemblyName>CK.SCP.Models</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -46,6 +47,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@ -53,6 +55,9 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Z.EntityFramework.Extensions">
<HintPath>..\UniApiGroup\bin\Debug\Z.EntityFramework.Extensions.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AppBoxEntity\AppBoxContext.cs" />
@ -72,6 +77,7 @@
<Compile Include="AppBoxEntity\Role.cs" />
<Compile Include="AppBoxEntity\Title.cs" />
<Compile Include="AppBoxEntity\User.cs" />
<Compile Include="AppBoxEntity\UserToken.cs" />
<Compile Include="AppBoxEntity\VenderUsers.cs" />
<Compile Include="Attributes\BaseTableValidation.cs" />
<Compile Include="Attributes\ColumnSource.cs" />
@ -331,7 +337,11 @@
<Compile Include="ExchangeCenterTables\TES_WORK_CENTER.cs" />
<Compile Include="GlobalConfig.cs" />
<Compile Include="ScpCache.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_APPLIANCE_EXPOPT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_FORECAST_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_MAXPODC_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_MAXPO_DETAIL_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_MAXPO_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_MOLDSHARING_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_OTD_REPORT_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_OTD_VendId_REPORT_EXPORT.cs" />
@ -340,15 +350,34 @@
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_VENDER_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelExportEnttity\SCP_VENDER_PART_EXPORT.cs" />
<Compile Include="ScpEntity\ExcelImportEntity\SCP_ASN_EXCEL.cs" />
<Compile Include="ScpEntity\PURSubcontractor.cs" />
<Compile Include="ScpEntity\TA_Appliance.cs" />
<Compile Include="ScpEntity\TA_ASK_SUBPART.cs" />
<Compile Include="ScpEntity\TA_BOXTYPE.cs" />
<Compile Include="ScpEntity\TA_CarModel.cs" />
<Compile Include="ScpEntity\TA_MoldSharing.cs" />
<Compile Include="ScpEntity\TA_MOLDSHARING_INVOICE.cs" />
<Compile Include="ScpEntity\TA_PinFan.cs" />
<Compile Include="ScpEntity\TA_ProductionLine.cs" />
<Compile Include="ScpEntity\TA_PurchasGroup.cs" />
<Compile Include="ScpEntity\TA_Receiving_Information.cs" />
<Compile Include="ScpEntity\TA_StorageLocation.cs" />
<Compile Include="ScpEntity\TA_SubPart.cs" />
<Compile Include="ScpEntity\TA_SubPartCode.cs" />
<Compile Include="ScpEntity\TA_VENDER_EXTEND.cs" />
<Compile Include="ScpEntity\TB_ASN_PARTBOX.cs" />
<Compile Include="ScpEntity\TB_CLAIM_APPEND.cs" />
<Compile Include="ScpEntity\TB_MAXPO.cs" />
<Compile Include="ScpEntity\TB_MAXPO_CONSUME.cs" />
<Compile Include="ScpEntity\TB_MAXPO_DETAIL.cs" />
<Compile Include="ScpEntity\TB_NetPrice.cs" />
<Compile Include="ScpEntity\TB_PALLETS.cs" />
<Compile Include="ScpEntity\TB_PALLETS_BTL.cs" />
<Compile Include="ScpEntity\TB_PALLETS_RULL.cs" />
<Compile Include="ScpEntity\TB_PLAN_CUSTOM.cs" />
<Compile Include="ScpEntity\TB_PO_PLAN_EXTEND.cs" />
<Compile Include="ScpEntity\TB_PO_PLAN.cs" />
<Compile Include="ScpEntity\TB_PO_SUBDETAIL.cs" />
<Compile Include="ScpEntity\TB_RECEIVE_DETAIL_QAD.cs" />
<Compile Include="ScpEntity\TB_RECEIVE_QAD.cs" />
<Compile Include="ScpEntity\SCP_OTD_EXPORT.cs" />
@ -376,6 +405,8 @@
<Compile Include="AppBoxEntity\TA_FACTORY.cs" />
<Compile Include="ScpEntity\TB_PALLET.cs" />
<Compile Include="ScpEntity\TB_PALLET_DETAIL.cs" />
<Compile Include="ScpEntity\TB_SUPPLIER_MAIL.cs" />
<Compile Include="ScpEntity\TM_CYJ_BOM.cs" />
<Compile Include="ScpEntity\TS_BARCODE_CUSTOM.cs" />
<Compile Include="ScpEntity\TS_BARCODE_RULE_CUSTOM.cs" />
<Compile Include="ScpEntity\TS_BARCODE_RULE_SMALL.cs" />
@ -385,6 +416,8 @@
<Compile Include="ScpEntity\V_FORECAST_REPORT.cs" />
<Compile Include="ScpEntity\V_Pie_Chart.cs" />
<Compile Include="ScpEntity\V_SUPPLIERS_REGUALARLY.cs" />
<Compile Include="ScpEntity\V_TA_APPLIANCE.cs" />
<Compile Include="ScpEntity\V_TA_SubPartCode.cs" />
<Compile Include="ScpEntity\V_TA_VENDER.cs" />
<Compile Include="ScpEntity\TB_FACTORY.cs" />
<Compile Include="ScpEntity\TA_INFO.cs" />
@ -425,6 +458,9 @@
<Compile Include="ScpEntity\V_TB_ASK_DETAIL_PACKAGE.cs" />
<Compile Include="ScpEntity\V_TB_FORECAST.cs" />
<Compile Include="ScpEntity\V_TB_INVOICE_ASK.cs" />
<Compile Include="ScpEntity\V_TB_MAXPO.cs" />
<Compile Include="ScpEntity\V_TB_MAXPO_CONSUME .cs" />
<Compile Include="ScpEntity\V_TB_MAXPO_DETAIL.cs" />
<Compile Include="ScpEntity\V_TB_PALLET.cs" />
<Compile Include="ScpEntity\V_TB_PALLETS.cs" />
<Compile Include="ScpEntity\V_TB_PALLET_DETAIL .cs" />
@ -440,6 +476,8 @@
<Compile Include="ScpEntity\V_TB_PO_DETAIL.cs" />
<Compile Include="ScpEntity\V_TB_PO_PLAN.cs" />
<Compile Include="ScpEntity\V_TB_PO_PLAN_DETAIL.cs" />
<Compile Include="ScpEntity\V_TB_PO_SUBDETAIL.cs" />
<Compile Include="ScpEntity\V_TB_REEEE.cs" />
<Compile Include="ScpEntity\V_TB_RETURN.cs" />
<Compile Include="ScpEntity\V_TB_QUALITY.cs" />
<Compile Include="ScpEntity\V_TB_RECEIVE.cs" />
@ -451,6 +489,11 @@
<Compile Include="ScpEntity\V_TIMELY_DELIVERY.cs" />
<Compile Include="ScpEntity\V_TM_HYANTOLIN_REVIEW.cs" />
<Compile Include="ScpEntity\V_TS_BARCODE.cs" />
<Compile Include="UniApiEntity\PURReplenishQty.cs" />
<Compile Include="UniApiEntity\xxDiMaxes.cs" />
<Compile Include="UniApiEntity\xxDiMaxes_Po.cs" />
<Compile Include="UniApiEntity\xxerp_MaxbatchNO.cs" />
<Compile Include="UniApiEntity\xxscm_maxpo_det.cs" />
<Compile Include="UniApiEntity\xxwms_review_det.cs" />
<Compile Include="ScpEntity\TM_HUANTOLIN_REVIEW.cs" />
<Compile Include="ScpException.cs" />

2
Models/EntitiesFactory.cs

@ -174,7 +174,7 @@ namespace CK.SCP.Models
{
try
{
db.SaveChanges();
db.BulkSaveChanges();
}
catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常
{

9
Models/Enums/SCP_ENUM.cs.cs

@ -81,6 +81,15 @@ namespace CK.SCP.Models.Enums
Non_Contract = 2,
}
public enum BillFwModType
{
[Description("普通订单")]
Contract = 1,
[Description("委外订单")]
Non_Contract = 2,
[Description("期货订单")]
Qh_Contract = 3,
}
public enum AskState
{
[Description("新建")]

4
Models/Enums/UniApiType.cs

@ -5,7 +5,9 @@ namespace CK.SCP.Models.Enums
public enum UniApiType
{
[Description("订单")]
PO,
Pobillnum,
[Description("大订单")]
MaxPobillnum,
[Description("收货")]
Receive,
[Description("条码")]

11
Models/GlobalConfig.cs

@ -15,19 +15,24 @@ namespace CK.SCP.Models
public const string WmsDbFileName = "Wms数据库设置.ini";
public const string DataCenterDbFileName = "数据中心数据库设置.ini";
public const string ExchangeCenterDbFileName = "交换中心数据库设置.ini";
public const string QiMingERPDatabase = "启明ERP数据库设置.ini";
private static DbSetting _scpDatabase;
private static DbSetting _appboxDatabase;
private static DbSetting _uniApiDatabase;
private static DbSetting _wmsDatabase;
private static DbSetting _qiMingERPDatabase;
private static DbSetting _dcDB;
private static DbSetting _ecDB;
public static DbSetting qiMingERPDatabase
{
get { return _qiMingERPDatabase ?? (_qiMingERPDatabase = GetConfigValues<DbSetting>(QiMingERPDatabase)); }
set { _qiMingERPDatabase = value; }
}
public static DbSetting ScpDatabase
{
get { return _scpDatabase ?? (_scpDatabase = GetConfigValues<DbSetting>(ScpDbFileName)); }

18
Models/ScpCache.cs

@ -18,7 +18,7 @@ namespace CK.SCP.Models
private static List<User> _usersList;
private static List<TB_RECEIVE> _ReceiveList;
private static List<TB_FACTORY> _FactoryList;
private static List<TA_REVICE_PORT> _PortList;
private static List<TA_REVICE_PORT> _PortList;
private static ScpConfig _config;
public static ScpConfig Config
@ -319,5 +319,21 @@ namespace CK.SCP.Models
public bool { get; set; } = false;
public bool { get; set; } = true;
public bool { get; set; } = false;
public string { get; set; } = "^(?![0-9]+$)(?![a-zA-Z]+$)(?![0-9a-zA-Z]+$)(?![0-9\\W]+$)(?![a-zA-Z\\W]+$)[0-9A-Za-z\\W]{8,}$";
public string { get; set; } = "至少8位,必须包含字母、数字和特殊字符!";
// public string 密码验证格式 { get; set; } = "^((?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])|(?=.*[a-z])(?=.*[0-9])(?=.*[$@$!%*#?&])|(?=.*[A-Z])(?=.*[0-9])(?=.*[$@$!%*#?&])|(?=.*[A-Z])(?=.*[a-z])(?=.*[$@$!%*#?&])).{8,}$";
//public string 密码验证格式 { get; set; } = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[$@$!%*?&])[A-Za-z\\d$@$!%*?&]{8,10}";
//public string 密码验证格式 { get; set; } = "^((?=.*[a-z])(?=.*[A-Z])(?=.*\\d)|(?=.*[a-z])(?=.*[A-Z])(?=.*[$@$!%*?&])|(?=.*\\d)(?=.*[A-Z])(?=.*[$@$!%*?&])|(?=.*\\d)(?=.*[a-z])(?=.*[$@$!%*?&])).{8,}$";
// public string 密码验证格式 { get; set; } = "^((?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])|(?=.*[a-z])(?=.*[0-9])(?=.*[\\W])|(?=.*[A-Z])(?=.*[0-9])(?=.*[\\W])|(?=.*[A-Z])(?=.*[a-z])(?=.*[\\W])).{8,}$";
// public string 密码验证提示语 { get; set; } = "至少8位,必须包含大写字母、小写字母、数字和特殊字符中的三种!";
public string { get; set; } = "666666";
public string { get; set; } = "5";
public string { get; set; } = "6";
public bool { get; set; } = false;
}
}

79
Models/ScpEntities.cs

@ -32,16 +32,39 @@ namespace CK.SCP.Models
{
}
public virtual DbSet<V_TB_REEEE> V_TB_REEEE { set; get; }
public virtual DbSet<TB_SUPPLIER_MAIL> TB_SUPPLIER_MAIL { set; get; }
public virtual DbSet<TA_ProductionLine> TA_ProductionLine { get; set; }
public virtual DbSet<TA_PurchasGroup> TA_PurchasGroup { get; set; }
public virtual DbSet<TA_PinFan> TA_PinFan { get; set; }
public virtual DbSet<TA_BOXTYPE> TA_BOXTYPE { get; set; }
public virtual DbSet<TA_StorageLocation> TA_StorageLocation { get; set; }
public virtual DbSet<TA_Appliance> TA_Appliance { get; set; }
public virtual DbSet<TB_ASN_PARTBOX> TB_ASN_PARTBOX { get; set; }
public virtual DbSet<TB_PALLETS_BTL> TB_PALLETS_BTL { get; set; }
public virtual DbSet<TA_Receiving_Information> TA_Receiving_Information { get; set; }
public virtual DbSet<V_TA_APPLIANCE> V_TA_APPLIANCE { get; set; }
public virtual DbSet<TA_SubPart> TA_SubPart { get; set; }
public virtual DbSet<TB_MAXPO> TB_MAXPO { get; set; }
public virtual DbSet<TB_MAXPO_DETAIL> TB_MAXPO_DETAIL { get; set; }
public virtual DbSet<V_TB_MAXPO> V_TB_MAXPO { get; set; }
public virtual DbSet<V_TB_MAXPO_DETAIL> V_TB_MAXPO_DETAIL { get; set; }
public virtual DbSet<TA_BILLTYPE> TA_BILLTYPE { get; set; }
public virtual DbSet<TA_CONFIG> TA_CONFIG { get; set; }
public virtual DbSet<TA_PART> TA_PART { get; set; }
public virtual DbSet<TA_CarModel> TA_CarModel { get; set; }
public virtual DbSet<TA_SubPartCode> TA_SubPartCode { get; set; }
public virtual DbSet<V_TA_SubPartCode> V_TA_SubPartCode { get; set; }
public virtual DbSet<TA_ASK_SUBPART> TA_ASK_SUBPART { get; set; }
public virtual DbSet<TB_FACTORY> TB_FACTORY { get; set; }
public virtual DbSet<TA_VEND_PART> TA_VEND_PART { get; set; }
public virtual DbSet<TA_VENDER> TA_VENDER { get; set; }
public virtual DbSet<TB_ARRIVE> TB_ARRIVE { get; set; }
public virtual DbSet<TB_ARRIVE_DETAIL> TB_ARRIVE_DETAIL { get; set; }
public virtual DbSet<TB_INVOICE> TB_INVOICE { get; set; }
public virtual DbSet<TB_MAXPO_CONSUME> TB_MAXPO_CONSUME { get; set; }
public virtual DbSet<V_TB_MAXPO_CONSUME> V_TB_MAXPO_CONSUME { get; set; }
public virtual DbSet<TB_INVOICE_DETAIL> TB_INVOICE_DETAIL { get; set; }
public virtual DbSet<TB_RECEIVE> TB_RECEIVE { get; set; }
public virtual DbSet<TB_RECEIVE_DETAIL> TB_RECEIVE_DETAIL { get; set; }
@ -49,13 +72,15 @@ namespace CK.SCP.Models
public virtual DbSet<TB_REJECT_DETAIL> TB_REJECT_DETAIL { get; set; }
public virtual DbSet<TA_FACTORY_CONFIG> TA_FACTORY_CONFIG { get; set; }
public virtual DbSet<TL_BASEDATA> TL_BASEDATA { get; set; }
public virtual DbSet<TL_BILL> TL_BILL { get; set; }
public virtual DbSet<TL_BILL> TL_BILL { get; set; }
public virtual DbSet<TL_OPER> TL_OPER { get; set; }
public virtual DbSet<TS_BARCODE> TS_BARCODE { get; set; }
public virtual DbSet<V_TS_BARCODE> V_TS_BARCODE { get; set; }
public virtual DbSet<TS_BARCODE_SMALL> TS_BARCODE_SMALL { get; set; }
public virtual DbSet<TS_STOCK> TS_STOCK { get; set; }
public virtual DbSet<TS_UNI_API> TS_UNI_API { get; set; }
public virtual DbSet<TB_PO_SUBDETAIL> TB_PO_SUBDETAIL { get; set; }
public virtual DbSet<V_TB_PO_SUBDETAIL> V_TB_PO_SUBDETAIL { get; set; }
public virtual DbSet<TS_UNI_API_HIS> TS_UNI_API_HIS { get; set; }
public virtual DbSet<TT_CURRENCY> TT_CURRENCY { get; set; }
public virtual DbSet<TT_PROJECT> TT_PROJECT { get; set; }
@ -76,6 +101,7 @@ namespace CK.SCP.Models
public virtual DbSet<V_TB_ASK> V_TB_ASK { get; set; }
public virtual DbSet<TB_ASK_DETAIL> TB_ASK_DETAIL { get; set; }
public virtual DbSet<V_TB_ASK_DETAIL> V_TB_ASK_DETAIL { get; set; }
public virtual DbSet<TM_CYJ_BOM> TM_CYJ_BOM { get; set; }
public virtual DbSet<TB_PO> TB_PO { get; set; }
public virtual DbSet<TB_PO_DETAIL> TB_PO_DETAIL { get; set; }
public virtual DbSet<TB_ASN> TB_ASN { get; set; }
@ -124,6 +150,7 @@ namespace CK.SCP.Models
public virtual DbSet<TS_BARCODE_CUSTOM> TS_BARCODE_CUSTOM { get; set; }
public virtual DbSet<V_TA_VEND_PART> V_TA_VEND_PART { get; set; }
public virtual DbSet<TB_PRICE> TB_PRICE { get; set; }
public virtual DbSet<TB_NetPrice> TB_NetPrice { get; set; }
public virtual DbSet<TB_FORECAST> TB_FORECAST { get; set; }
public virtual DbSet<V_TB_FORECAST> V_TB_FORECAST { get; set; }
public virtual DbSet<TA_MOLDSHARING> TA_MoldSharing { get; set; }
@ -166,15 +193,27 @@ namespace CK.SCP.Models
modelBuilder.Entity<TB_PRICE>()
.Property(e => e.Amt)
.HasPrecision(18, 5);
modelBuilder.Entity<TB_NetPrice>()
.Property(e => e.Amt)
.HasPrecision(18, 5);
modelBuilder.Entity<TA_VENDER>()
.Property(e => e.VendAbbCode)
.IsUnicode(false);
modelBuilder.Entity<V_TB_PO_DETAIL>()
.Property(e => e.PackQty)
.HasPrecision(19, 2);
modelBuilder.Entity<TB_PO_DETAIL>()
.Property(e => e.PlanQty)
.HasPrecision(19, 6);
modelBuilder.Entity<TB_PO_DETAIL>()
.Property(e => e.PackQty)
.HasPrecision(19, 6);
modelBuilder.Entity<V_TB_PO_DETAIL>()
.Property(e => e.ReceivedQty)
.HasPrecision(19, 2);
modelBuilder.Entity<V_TB_PO_DETAIL>()
.Property(e => e.Price)
.HasPrecision(19, 5);
modelBuilder.Entity<V_TB_ASK_DETAIL>()
.Property(e => e.PackQty)
.HasPrecision(19, 2);
@ -264,15 +303,43 @@ namespace CK.SCP.Models
.HasPrecision(18, 2);
modelBuilder.Entity<TS_UNI_API>()
.Property(e => e.PackQty)
.HasPrecision(18, 5);
modelBuilder.Entity<TB_RECEIVE_DETAIL_QAD>()
.HasPrecision(18, 6);
modelBuilder.Entity<TA_SubPartCode>()
.Property(e => e.Qty)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_PO_SUBDETAIL>()
.Property(e => e.Qty)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_PO_SUBDETAIL>()
.Property(e => e.SubQty)
.HasPrecision(18, 6);
modelBuilder.Entity<TA_ASK_SUBPART>()
.Property(e => e.Qty)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_RECEIVE_DETAIL_QAD>()
.Property(e => e.Rate)
.HasPrecision(18, 5);
modelBuilder.Entity<TB_RECEIVE_DETAIL_QAD>()
.Property(e => e.CurAmt)
.HasPrecision(18, 5);
modelBuilder.Entity<TB_MAXPO_DETAIL>()
.Property(e => e.MinordQty)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_MAXPO_DETAIL>()
.Property(e => e.Singlecon)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_MAXPO_DETAIL>()
.Property(e => e.OrderQtyd)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_MAXPO_DETAIL>()
.Property(e => e.OrderQtykg)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_MAXPO_DETAIL>()
.Property(e => e.OrderNumber)
.HasPrecision(18, 6);
modelBuilder.Entity<TB_MAXPO_CONSUME>()
.Property(e => e.PoQty)
.HasPrecision(18, 6);
}
}
}

23
Models/ScpEntity/ExcelExportEnttity/SCP_APPLIANCE_EXPOPT.cs

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
{
public class SCP_APPLIANCE_EXPOPT
{
public string ;
public string ;
public string ;
public string ;
public string ;
public string ;
public string ;
public string ;
public string ;
public string ;
public string ;
}
}

2
Models/ScpEntity/ExcelExportEnttity/SCP_INVOICE_DETAIL_EXPORT.cs

@ -30,5 +30,7 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
public string { get; set; }//Qty
public string { get; set; }//Remark
public string { get; set; }
public string { get; set; }
}
}

17
Models/ScpEntity/ExcelExportEnttity/SCP_MAXPODC_EXPORT.cs

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
{
public class SCP_MAXPODC_EXPORT
{
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
}
}

31
Models/ScpEntity/ExcelExportEnttity/SCP_MAXPO_DETAIL_EXPORT.cs

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
{
public class SCP_MAXPO_DETAIL_EXPORT
{
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string 1 { get; set; }
public string 2 { get; set; }
public string 3 { get; set; }
public string 4 { get; set; }
public string 5 { get; set; }
public string 6 { get; set; }
}
}

23
Models/ScpEntity/ExcelExportEnttity/SCP_MAXPO_EXPORT.cs

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
{
public class SCP_MAXPO_EXPORT
{
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
}
}

16
Models/ScpEntity/ExcelExportEnttity/SCP_PO_DETAIL_EXPORT.cs

@ -21,8 +21,9 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
public string 退 { get; set; } //RejectQty"
public string { get; set; } //EndTime"
public string {get;set; } //PoUnit"
public string { get; set; }
public string { get; set; }
}
public class SCP_PO_DETAIL_EXPORT_MODEL
{
@ -98,5 +99,18 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string BOM版本 { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
}
}

9
Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_EXPORT.cs

@ -24,5 +24,14 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string Code39条码 { get; set; }
public string { get; set; }
}
}

22
Models/ScpEntity/ExcelExportEnttity/SCP_VENDER_PART_EXPORT.cs

@ -12,10 +12,30 @@ namespace CK.SCP.Models.ScpEntity.ExcelExportEnttity
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string 线 { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
public string { get; set; }
}
}

59
Models/ScpEntity/PURSubcontractor.cs

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class PURSubcontractors
{
[Key]
public int di_batchno { get; set; }
public string purDocNO { get; set; }
public string purDocItemNO { get; set; }
public string ordType { get; set; }
public DateTime? docDate { get; set; }
public string returnsItem { get; set; }
public string sizecoL { get; set; }
public string purDocItemCtg { get; set; }
public string plant { get; set; }
public string purOrg { get; set; }
public string companyCode { get; set; }
public string mtlNO { get; set; }
public string shortText { get; set; }
public decimal quantity { get; set; }
public DateTime? itemDeliveryDate { get; set; }
public decimal price { get; set; }
public string baseUnitMeasure { get; set; }
public string ordPriceUnit { get; set; }
public string vendorNO { get; set; }
public string responsibleSalesperson { get; set; }
public string storeLocation { get; set; }
public string purGrp { get; set; }
public string phone { get; set; }
public string ctype { get; set; }
public string remark { get; set; }
public DateTime? createdDate { get; set; }
public string createdBy { get; set; }
public DateTime? di_updatetime { get; set; }
public string updatedBy { get; set; }
public string measureBaseUnit { get; set; }
public string groupWareMaterielNO { get; set; }
public string groupWarePlant { get; set; }
public DateTime? compRequireDate { get; set; }
public decimal COMPONQUANTITY { get; set; }
public string di_message { get; set; }
public string di_status { get; set; }
public DateTime? di_writeTime { get; set; }
public string outPurDocNO { get; set; }
public string outPurDocItemNO { get; set; }
public string alternativeBOM { get; set; }
}
}

26
Models/ScpEntity/TA_ASK_SUBPART.cs

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_ASK_SUBPART
{
[Key]
public long UID { get; set; }
public string PartCode { get; set; }
public string SubPartCode { get; set; }
public string BOMedtiton { get; set; }
public string AskBillNum { get; set; }
public decimal Qty { get; set; }
public string VendBatch { get; set; }
}
}

28
Models/ScpEntity/TA_Appliance.cs

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_Appliance
{
[Key]
public long UID { get; set; }
public string PartCode { get; set; }
public string Model { get; set; }
public decimal? PackNumber { get; set;}
public string PartDesc1 { get; set; }
public string ReciteNumber { get; set; }
public string SufanLand { get; set; }
public string BoxType { get; set; }
public string PostEngineering { get; set; }
public string PartNumber { get; set; }
public string PartDesc2 { get; set; }
public string Texture { get; set; }
public string ReceivingPort { get; set; }
public string VendID { get; set; }
}
}

22
Models/ScpEntity/TA_BOXTYPE.cs

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public class TA_BOXTYPE
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
public string BoxType { get; set; }
public bool Enabled { get; set; }
public string CreateUser { get; set; }
public DateTime CreateTime { get; set; }
}
}

2
Models/ScpEntity/TA_CONFIG.cs

@ -13,7 +13,7 @@ namespace CK.SCP.Models.ScpEntity
public string ParamName { get; set; }
[Required]
[StringLength(50)]
[StringLength(500)]
public string ParamValue { get; set; }
public int? State { get; set; }

20
Models/ScpEntity/TA_CarModel.cs

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_CarModel
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
public string Model { get; set; }
}
}

21
Models/ScpEntity/TA_PinFan.cs

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_PinFan
{
[Key]
public long UID { get; set; }
public string PartCode { get; set; }
public string Barcodnt { get; set; }
public string Identification { get; set; }
}
}

22
Models/ScpEntity/TA_ProductionLine.cs

@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_ProductionLine
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
[Column(Order = 0)]
[StringLength(50)]
public string PartCode { get; set; }
public string ProductionLine { get; set; }
}
}

22
Models/ScpEntity/TA_PurchasGroup.cs

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_PurchasGroup
{
[Key]
public long UID { get; set; }
public string PurchasingGroup { get; set; }
public string ChineseName { get; set; }
public string Describe { get; set; }
}
}

19
Models/ScpEntity/TA_Receiving_Information.cs

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public class TA_Receiving_Information
{
[Key]
public long UID { get; set; }
public string Shift { get; set; }
public string Name { get; set; }
public string Phone { get; set; }
}
}

23
Models/ScpEntity/TA_StorageLocation.cs

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_StorageLocation
{
[Key]
public long UID { get; set; }
public string StLocation { get; set; }
public string Arrangement { get; set; }
public string Leveldescription { get; set; }
public string Describe { get; set; }
public string Inventoryation { get; set; }
}
}

20
Models/ScpEntity/TA_SubPart.cs

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_SubPart
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
[Column(Order = 0)]
[StringLength(50)]
public string PartCode { get; set; }
public string SubPart { get; set; }
}
}

22
Models/ScpEntity/TA_SubPartCode.cs

@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Web;
namespace CK.SCP.Models.ScpEntity
{
public partial class TA_SubPartCode
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long UID { get; set; }
public string PartCode { get; set; }
public string SubPartCode { get; set; }
public string BOMedtiton { get; set; }
public string Site { get; set; }
public decimal Qty { get; set; }
public decimal SUMQTY { get; set; }
}
}

3
Models/ScpEntity/TB_ASK.cs

@ -41,6 +41,7 @@ namespace CK.SCP.Models.ScpEntity
public string Extend2 { get; set; }
public string Extend3 { get; set; }
public string SubSite { get; set; }
public string AskType { get; set; }
}
}

2
Models/ScpEntity/TB_ASK_DETAIL.cs

@ -46,7 +46,7 @@ namespace CK.SCP.Models.ScpEntity
public string ReceivedPort { get; set; }
public string Remark1 { get; set; }
public decimal? ReduceQty { get; set; }
public string Site { get; set; }

2
Models/ScpEntity/TB_ASN_DETAIL.cs

@ -31,7 +31,7 @@ namespace CK.SCP.Models.ScpEntity
[StringLength(50)]
public string Batch { get; set; }
public DateTime? ProduceDate { get; set; }
[StringLength(50)]
public string VendBatch { get; set; }
public decimal Qty { get; set; }
[StringLength(50)]

31
Models/ScpEntity/TB_ASN_PARTBOX.cs

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_ASN_PARTBOX
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long UID { get; set; }
[StringLength(50)]
public string AsnBillNum { get; set; }
public string PartCode { get; set; }
public string BoxType { get; set; }
public int Box { get; set; }
public int Qty { get; set; }
public int Qty1 { get; set; }
public int SumBox { get; set; }
public string PoBillNum { get; set; }
public string VendId { get; set; }
public string ShipTime { get; set; }
public string Batch { get; set; }
public int PoLine { get; set; }
public decimal PackQty { get; set; }
}
}

3
Models/ScpEntity/TB_INVOICE_DETAIL.cs

@ -55,7 +55,6 @@ namespace CK.SCP.Models.ScpEntity
[StringLength(50)]
public string Site { get; set; }
[StringLength(50)]
public string SubSite { get; set; }
public string SubSite { get; set; }
}
}

31
Models/ScpEntity/TB_MAXPO.cs

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_MAXPO
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
[Column(Order = 0)]
[StringLength(50)]
public string PoBillNum { get; set; }
public string VendId { get; set; }
public DateTime CreateTime { get; set; }
public string CreateUser { get; set; }
public string ContractNo { get; set; }
public string ContractMonth { get; set; }
public string Site { get; set; }
public string Remark { get; set; }
public bool IsDeleted { get; set; }
}
}

19
Models/ScpEntity/TB_MAXPO_CONSUME.cs

@ -0,0 +1,19 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_MAXPO_CONSUME
{
[Key]
public long UID { get; set; }
public string BillNum { get; set; }
public string PartCode { get; set; }
public string VendId { get; set; }
public decimal PoQty { get; set; }
public string PoBillNum { get; set; }
public DateTime? ShipTime { get; set; }
}
}

58
Models/ScpEntity/TB_MAXPO_DETAIL.cs

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_MAXPO_DETAIL
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
[Column(Order =0)]
public string PoBillNum { get; set; }
[Key]
[Column(Order = 1)]
public string VendId { get; set; }
public DateTime CreateTime { get; set; }
public string CreateUser { get; set; }
public string ContractNo { get; set; }
[Key]
[Column(Order = 2)]
public string PartCode { get; set; }
public string PartNumber { get; set; }
public string Texture { get; set; }
public string Model { get; set; }
public string Finprspec { get; set; }
public string TechStandard { get; set; }
public decimal MinordQty { get; set; }
public decimal Singlecon { get; set; }
public decimal OrderQtyd { get; set; }
public decimal OrderQtykg { get; set; }
public decimal OrderNumber { get; set; }
public string forecastone { get; set; }
public string forecasttwo { get; set; }
public string forecastthree { get; set; }
public string forecastfour { get; set; }
public string forecastfive { get; set; }
public string forecastsix { get; set; }
public string Matermanu { get; set; }
public string ContractMonth { get; set; }
public decimal BomQty { get; set; }
public int PoLine { get; set; }
public string Site { get; set; }
public decimal SurplusQty { get; set; }
public decimal AsnQty { get; set; }
public decimal ReceQty { get; set; }
public bool IsDeleted { get; set; }
public decimal ReturnQty { get; set; }
}
}

33
Models/ScpEntity/TB_NetPrice.cs

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using ChangKeTec.Wms.Models;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_NetPrice
{
[Key]
public int UID { get; set; }
public string VendId { get; set; }
public string Site { get; set; }
public string PartCode { get; set; }
public Nullable<System.DateTime> StartTime { get; set; }
public Nullable<System.DateTime> EndTime { get; set; }
public string Curr { get; set; }
public string Unit { get; set; }
[DecimalPrecision(18, 5)]
public decimal Amt { get; set; }
public string Remarks { get; set; }
public string Extend1 { get; set; }
public string Extend2 { get; set; }
public string Extend3 { get; set; }
//public int State { get; set; }
//public decimal? VendAmt { get; set; }
}
}

47
Models/ScpEntity/TB_PALLETS_BTL.cs

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_PALLETS_BTL
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
public string PalletNum{ get; set; }
public string AsnBillNum { get; set; }
public int SumBox { get; set; }
public string PoBillNum { get; set; }
public decimal SumQty { get; set; }
public string VendId { get; set; }
public string VendName { get; set; }
public string ShipTime { get; set; }
public string PartCode { get; set; }
public string PartCode1 { get; set; }
public string PartCode2 { get; set; }
public string PartCode3 { get; set; }
public string PartCode4 { get; set; }
public string PartCode5 { get; set; }
public string Box { get; set; }
public string Box1 { get; set; }
public string Box2 { get; set; }
public string Box3 { get; set; }
public string Box4 { get; set; }
public string Box5 { get; set; }
public string PackQty { get; set; }
public string PackQty1 { get; set; }
public string PackQty2 { get; set; }
public string PackQty3 { get; set; }
public string PackQty4 { get; set; }
public string PackQty5 { get; set; }
public string PalletCode { get; set; }
[NotMapped]
public List<long> UIDList { get; set; }
public bool IsDeleted { get; set; }
}
}

43
Models/ScpEntity/TB_PO.cs

@ -15,7 +15,7 @@ namespace CK.SCP.Models.ScpEntity
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
public partial class TB_PO:RecordEntity
public partial class TB_PO : RecordEntity
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
@ -41,12 +41,12 @@ namespace CK.SCP.Models.ScpEntity
public int State { get; set; }
[StringLength(200)]
public string Remark { get; set; }
public DateTime? BeginTime { get; set; }
public DateTime? EndTime { get; set; }
[StringLength(50)]
[NotMapped]
@ -56,9 +56,40 @@ namespace CK.SCP.Models.ScpEntity
public string Extend3 { get; set; }
public string SubSite { get; set; }
public TB_PO Clone(string p_NewBill, string p_Site)
{
return new TB_PO()
{
PoBillNum = p_NewBill,
ErpBillNum = p_NewBill,
UID = UID,
ModType=ModType,
State=State,
VendId = VendId,
Contacter = Contacter,
Buyer = Buyer,
BuyerPhone = BuyerPhone,
Remark = Remark,
BeginTime = BeginTime,
EndTime = EndTime,
ReceivedPort = ReceivedPort,
Extend1 = Extend1,
Extend2 = Extend2,
Extend3 = Extend3,
SubSite = SubSite,
Site = p_Site,
CreateUser = CreateUser,
CreateTime=CreateTime,
GUID=GUID,
UpdateInfo=UpdateInfo,
};
}
}
}

1
Models/ScpEntity/TB_PO_DETAIL.cs

@ -78,5 +78,6 @@ namespace CK.SCP.Models.ScpEntity
public string Site { get; set; }
}
}

36
Models/ScpEntity/TB_PO_SUBDETAIL.cs

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TB_PO_SUBDETAIL
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long UID { get; set; }
public string PoBillNum { get; set; }
public string PartCode { get; set; }
public decimal Qty { get; set; }
public decimal SubQty { get; set; }
public string Site { get; set; }
public string SubPartCode { get; set; }
public string BOMedtiton { get; set; }
public int PoLine { get; set; }
}
}

25
Models/ScpEntity/TB_SUPPLIER_MAIL.cs

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public class TB_SUPPLIER_MAIL
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { set; get; }
public string SupplicerCode { set; get; }
public string Email { set; get; }
public int State { set; get; }
public string MailBody { set; get; }
}
}

63
Models/ScpEntity/TM_CYJ_BOM.cs

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class TM_CYJ_BOM
{
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
public int UID { get; set; }
[Key]
[Column(Order = 0)]
[StringLength(50)]
[DisplayName("物料号")]
public string PartCode { get; set; }
[Key]
[Column(Order = 1)]
[StringLength(50)]
[DisplayName("子物料")]
public string SubPartCode { get; set; }
[Key]
[Column(Order = 2)]
[DisplayName("Bom用途")]
public string BomUsage { get; set; }
[Key]
[Column(Order = 3)]
[DisplayName("Bom替代")]
public string BomFillIn { get; set; }
[DisplayName("特殊获取类型")]
public string SpecialType { get; set; }
[DisplayName("用量")]
public decimal Qty { get; set; }
[DisplayName("单位")]
public string Unit { get; set; }
[DisplayName("删除标识")]
public string IsDelete { get; set; }
[DisplayName("有效开始日期")]
public DateTime StartDate { get; set; }
[DisplayName("有效截止日期")]
public DateTime EndDate { get; set; }
[DisplayName("创建日期")]
public DateTime CreateTime { get; set; }
[DisplayName("备注")]
public string Remark { get; set; }
}
}

20
Models/ScpEntity/TS_BARCODE.cs

@ -53,8 +53,7 @@ namespace CK.SCP.Models.ScpEntity
[StringLength(50)]
public string VendId { get; set; }
[StringLength(50)]
public string VendBatch { get; set; }
[Column(TypeName = "money")]
@ -84,7 +83,7 @@ namespace CK.SCP.Models.ScpEntity
public string Extend1 { get; set; }
public string Extend2 { get; set; }
public string Extend3 { get; set; }
public string Extend3 { get; set; }
[DisplayName("¹©Ó¦ÉÌÃû³Æ")]
public string VendName => ScpCache.GetVendName(VendId,Site);
@ -106,6 +105,19 @@ namespace CK.SCP.Models.ScpEntity
public string IsScanned_Desc => IsScanned ? "ÒÑɨÃè" : "δɨÃè";
[NotMapped]
public decimal CanQty { get; set; }
public string Extend4 { get; set; }
public string Extend5 { get; set; }
public DateTime Extend6 { get; set; }
public string Extend7 { get; set; }
public string Extend8 { get; set; }
public string Extend9 { get; set; }
public string Extend10{ get; set; }
public string Extend11 { get; set; }
public string Extend12 { get; set; }
public DateTime Extend13 { get; set; }
public string Extend14 { get; set; }
public string Extend15 { get; set; }
public string Extend16 { get; set; }
public string PalletNum { get; set; }
}
}

3
Models/ScpEntity/TS_UNI_API.cs

@ -81,9 +81,10 @@ namespace CK.SCP.Models.ScpEntity
public decimal Tax { get; set; }
public string Site { get; set; }
public string Domain { get; set; }
public string SubSite { get; set; }
public string Extend1 { get; set; }
public string Extend2 { get; set; }
public string Extend3 { get; set; }
public TS_UNI_API_HIS ToHis()
{
return new TS_UNI_API_HIS

2
Models/ScpEntity/V_ASN_PRINT.cs

@ -23,6 +23,7 @@ namespace CK.SCP.Models.ScpEntity
public string CAAIPhone{get;set;}
public string CAAIFax { get; set; }
public string Total { get; set; }
public string CurrentUserPhone { get; set; }
}
@ -42,6 +43,7 @@ namespace CK.SCP.Models.ScpEntity
public string Batch { get; set; }
public string VendBatch { get; set; }
public string ProjectId { get; set; }
public string PoQty { get; set; }
public string DockCode_Desc => ScpCache.PortList.Where(p => p.PORT_NO == DockCode).FirstOrDefault() == null ? "" : ScpCache.PortList.Where(p => p.PORT_NO == DockCode).FirstOrDefault().PORT_DESCRIPTION;
}

29
Models/ScpEntity/V_TA_APPLIANCE.cs

@ -0,0 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace CK.SCP.Models.ScpEntity
{
public partial class V_TA_APPLIANCE
{
[Key]
public long UID { get; set; }
public string PartCode { get; set; }
public string Model { get; set; }
public decimal? PackNumber { get; set; }
public string PartDesc1 { get; set; }
public string ReciteNumber { get; set; }
public string SufanLand { get; set; }
public string BoxType { get; set; }
public string PostEngineering { get; set; }
public string PartNumber { get; set; }
public string PartDesc2 { get; set; }
public string Texture { get; set; }
public string ReceivingPort { get; set; }
public string VendID { get; set; }
public string VendName { get; set; }
}
}

32
Models/ScpEntity/V_TA_SubPartCode.cs

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Web;
namespace CK.SCP.Models.ScpEntity
{
public partial class V_TA_SubPartCode
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long UID { get; set; }
public string PartCode { get; set; }
public string SubPartCode { get; set; }
public string BOMedtiton { get; set; }
public string Site { get; set; }
public Decimal Qty { get; set; }
public Decimal SUMQTY { get; set; }
public string PartDesc1 { get; set; }
public string PartDesc2 { get; set; }
public string Unit { get; set; }
[NotMapped]
public string Partname { get; set; }
[NotMapped]
public List<string> PartList { set; get; }
}
}

3
Models/ScpEntity/V_TB_ASK.cs

@ -61,6 +61,7 @@ namespace CK.SCP.Models.ScpEntity
public string Extend3 { get; set; }
public string SubSite { get; set; }
//public string AskType { get; set; }
#region 条件
[NotMapped]
public string Batch { get; set; }
@ -84,6 +85,8 @@ namespace CK.SCP.Models.ScpEntity
public string Month { get; set; }
[NotMapped]
public bool IsComplete { get; set; }
public string AskType { get; set; }
#endregion
}
}

4
Models/ScpEntity/V_TB_ASK_DETAIL.cs

@ -125,7 +125,11 @@ namespace CK.SCP.Models.ScpEntity
public string ReceiveUser { get; set; }
[NotMapped]
public DateTime ProduceDate { get; set; }
[NotMapped]
public string Time { get; set; }
[NotMapped]
public string MaxTime { get; set; }
#endregion
}

2
Models/ScpEntity/V_TB_ASN.cs

@ -37,7 +37,7 @@ namespace CK.SCP.Models.ScpEntity
public DateTime? ReceiveTime { get; set; }
[StringLength(50)]
public string ReceiveUser { get; set; }
public DateTime EndTime { get; set; }
[StringLength(50)]
public string ErpBillNum { get; set; }
public int? ModType { get; set; }

4
Models/ScpEntity/V_TB_INVOICE_DETAIL.cs

@ -85,6 +85,8 @@ namespace CK.SCP.Models.ScpEntity
public string SubSite { get; set; }
public string Extend1 { get; set; }
public string Extend2 { get; set; }
}
}

35
Models/ScpEntity/V_TB_MAXPO.cs

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class V_TB_MAXPO
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long UID { get; set; }
[Key]
[Column(Order = 0)]
[StringLength(50)]
public string PoBillNum { get; set; }
public string VendId { get; set; }
public string VendName { get; set; }
public DateTime CreateTime { get; set; }
public string CreateUser { get; set; }
public string ContractNo { get; set; }
public string ContractMonth { get; set; }
public string Site { get; set; }
public string Remark { get; set; }
[NotMapped]
public DateTime? BeginTime { get; set; }
[NotMapped]
public DateTime? EndTime { get; set; }
public bool IsDeleted { get; set; }
}
}

33
Models/ScpEntity/V_TB_MAXPO_CONSUME .cs

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class V_TB_MAXPO_CONSUME
{
[Key]
public long UID { get; set; }
public string PartCode { get; set; }
public string VendId { get; set; }
public string PoBillNum { get; set; }
public string ContractMonth { get; set; }
public string BillNum { get; set; }
public string PartDesc1 { get; set; }
public string PartDesc2 { get; set; }
public string VendName{ get; set; }
public DateTime? ShipTime { get; set; }
public decimal PoQty { get; set; }
[NotMapped]
public List<string> PoList { set; get; }
[NotMapped]
public List<string> PartList { set; get; }
}
}

64
Models/ScpEntity/V_TB_MAXPO_DETAIL.cs

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CK.SCP.Models.ScpEntity
{
public partial class V_TB_MAXPO_DETAIL
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public long UID { get; set; }
[Column(Order = 0)]
[StringLength(50)]
public string PoBillNum { get; set; }
public string PartCode { get; set; }
public string PartNumber { get; set; }
public string Texture { get; set; }
public string Model { get; set; }
public string Finprspec { get; set; }
public string TechStandard { get; set; }
public decimal MinordQty { get; set; }
public decimal Singlecon { get; set; }
public decimal OrderQtyd { get; set; }
public decimal OrderQtykg { get; set; }
public decimal OrderNumber { get; set; }
public string forecastone { get; set; }
public string forecasttwo { get; set; }
public string forecastthree { get; set; }
public string forecastfour { get; set; }
public string forecastfive { get; set; }
public string forecastsix { get; set; }
public string Matermanu { get; set; }
public decimal BomQty { get; set; }
public string PartDesc2 { get; set; }
public int PoLine { get; set; }
public decimal SurplusQty { get; set; }
public string VendId { get; set; }
public string ContractMonth { get; set; }
public decimal AnQty { get; set; }
public decimal AsnQty { get; set; }
public decimal RecQty { get; set; }
public string CreateUser { get; set; }
[NotMapped]
public DateTime? BeginTime { get; set; }
[NotMapped]
public DateTime? EndTime { get; set; }
public DateTime? CreateTime { get; set; }
public string VendName { get; set; }
public decimal ReceQty { get; set; }
public decimal ReturnQty { get; set; }
public bool IsDeleted { get; set; }
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save