Browse Source

接口调整以及模具分摊优化

master
qian 2 months ago
parent
commit
72f6fecf98
  1. 1
      北京北汽/Common/CK.SCP.Common.csproj
  2. 46
      北京北汽/Controller/CK.SCP.Controller.csproj
  3. 224
      北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs
  4. 4
      北京北汽/Controller/SCP_MoldSharing_Controller.cs
  5. 390
      北京北汽/Controller/SCP_PLAN_CONTROLLER.cs
  6. 88
      北京北汽/Controller/SCP_PO_CONTROLLER.cs
  7. 11
      北京北汽/Controller/app.config
  8. 5
      北京北汽/Models/CK.SCP.Models.csproj
  9. 1
      北京北汽/Models/ScpEntities.cs
  10. 88
      北京北汽/Models/ScpEntity/TB_ASN.cs
  11. 16
      北京北汽/SCP/SCP.csproj
  12. 5
      北京北汽/SCP/Views/BasicData/SCP_MoldSharing.aspx
  13. 12
      北京北汽/SCP/Views/BasicData/SCP_MoldSharing.aspx.cs
  14. 8
      北京北汽/SCP/Views/PlanData/SCP_INCOMPLETE_ASK.aspx.cs
  15. 17
      北京北汽/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs
  16. 20
      北京北汽/UniApiWpf/MainWindow.xaml.cs

1
北京北汽/Common/CK.SCP.Common.csproj

@ -72,6 +72,7 @@
<Reference Include="System.Data.Entity" /> <Reference Include="System.Data.Entity" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Security" /> <Reference Include="System.Security" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />

46
北京北汽/Controller/CK.SCP.Controller.csproj

@ -46,7 +46,11 @@
<Reference Include="System.ComponentModel.DataAnnotations" /> <Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" /> <Reference Include="System.Transactions" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
@ -70,6 +74,11 @@
<Compile Include="EC_CONTROLLER_RETURN.cs" /> <Compile Include="EC_CONTROLLER_RETURN.cs" />
<Compile Include="EC_CONTROLLER_SUPPLIER.cs" /> <Compile Include="EC_CONTROLLER_SUPPLIER.cs" />
<Compile Include="EC_CONTROLLER_TRANSFER.cs" /> <Compile Include="EC_CONTROLLER_TRANSFER.cs" />
<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_ASK_CONTROLLER_PACKAGE.cs" />
<Compile Include="SCP_BARCODE_CONTROLLER_CUSTOM.cs" /> <Compile Include="SCP_BARCODE_CONTROLLER_CUSTOM.cs" />
<Compile Include="SCP_BARCODE_CONTROLLER _SYJB.cs" /> <Compile Include="SCP_BARCODE_CONTROLLER _SYJB.cs" />
@ -118,6 +127,11 @@
<Compile Include="SCP_V_TA_VEND_PART_CONTROLLER.cs" /> <Compile Include="SCP_V_TA_VEND_PART_CONTROLLER.cs" />
<Compile Include="UniApiController.cs" /> <Compile Include="UniApiController.cs" />
<Compile Include="VEND_USERController.cs" /> <Compile Include="VEND_USERController.cs" />
<Compile Include="Web References\WebReference\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Models\CK.SCP.Models.csproj"> <ProjectReference Include="..\Models\CK.SCP.Models.csproj">
@ -132,7 +146,37 @@
<ItemGroup> <ItemGroup>
<None Include="app.config" /> <None Include="app.config" />
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Web References\WebReference\ExchangeCenterService.wsdl" />
<None Include="Web References\WebReference\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.60.101.3:8009/ExchangeCenterService.asmx%3fop=GetSessionId">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\WebReference\</RelPath>
<UpdateFromURL>http://10.60.101.3:8009/ExchangeCenterService.asmx%3fop=GetSessionId</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>CK_SCP_Controller_WebReference_ExchangeCenterService</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<ItemGroup>
<None Include="Web References\WebReference\ExchangeCenterService.disco" />
</ItemGroup> </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

224
北京北汽/Controller/SCP_DC_UNI_CONTROLLER.cs

@ -8,17 +8,16 @@ using CK.SCP.Utils;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel;
using System.Data.Entity.Migrations; using System.Data.Entity.Migrations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks;
using System.Transactions; using System.Transactions;
using System.Data.Entity.Core; using System.Data.Entity.Core;
using System.Security.Cryptography; using System.Data;
using System.Data.Entity; using CK.SCP.Controller.WebReference;
using System.Collections.ObjectModel; using CK.SCP.Models.UniApiEntity;
using System.Threading.Tasks;
//using WebSrvAPITest; //using WebSrvAPITest;
namespace CK.SCP.Controller namespace CK.SCP.Controller
@ -194,28 +193,29 @@ namespace CK.SCP.Controller
// return list; // return list;
//} //}
public static ResultObject<List<TEA_TASK_SUB>> Get_TEA_TASK_SUB_List(TEA_TASK_SUB p_entity) public static List<TEA_TASK_SUB> Get_TEA_TASK_SUB_List(TEA_TASK_SUB p_entity)
{
ResultObject<List<TEA_TASK_SUB>> _ret = new ResultObject<List<TEA_TASK_SUB>>();
try
{ {
//ResultObject<List<TEA_TASK_SUB>> _ret = new ResultObject<List<TEA_TASK_SUB>>();
//try
//{
List<TEA_TASK_SUB> _ret = new List<TEA_TASK_SUB>();
using (var db = EntitiesFactory.CreateExchangeCenterInstance()) using (var db = EntitiesFactory.CreateExchangeCenterInstance())
{ {
string _sql = "select * from TEA_TASK_SUB with(nolock) where TaskState = '{0}' and Subscriber = '{1}'"; string _sql = "select * from TEA_TASK_SUB with(nolock) where TaskState = '{0}' and Subscriber = '{1}'";
_sql = string.Format(_sql, (int)p_entity.TaskState, p_entity.Subscriber); _sql = string.Format(_sql, (int)p_entity.TaskState, p_entity.Subscriber);
var q = db.Database.SqlQuery<TEA_TASK_SUB>(_sql).OrderBy(p=>p.CreateTime).ToList(); var q = db.Database.SqlQuery<TEA_TASK_SUB>(_sql).OrderBy(p=>p.CreateTime).ToList();
_ret.State = ReturnStatus.Succeed; //_ret.State = ReturnStatus.Succeed;
_ret.Result = q; _ret = q;
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_DC_UNI_CONTROLLER), "Get_TEA_TASK_SUB_List", e.Message);
throw e;
} }
//}
//catch (Exception e)
//{
// _ret.State = ReturnStatus.Failed;
// _ret.ErrorList.Add(e);
// LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_DC_UNI_CONTROLLER), "Get_TEA_TASK_SUB_List", e.Message);
// throw e;
//}
return _ret; return _ret;
} }
@ -360,12 +360,12 @@ namespace CK.SCP.Controller
// ResultObject<List<LogModel>> result = new ResultObject<List<LogModel>>(); // ResultObject<List<LogModel>> result = new ResultObject<List<LogModel>>();
var _result = Get_TEA_TASK_SUB_List(new TEA_TASK_SUB() { TaskState = EnumTaskState.Unread, Subscriber = "SCP"}); var _result = Get_TEA_TASK_SUB_List(new TEA_TASK_SUB() { TaskState = EnumTaskState.Unread, Subscriber = "SCP"});
//List<TEA_TASK_SUB> tasklist = Get_TEA_TASK_SUB_List(new TEA_TASK_SUB() { TaskState = EnumTaskState.Unread, Subscriber = "SCP" }); //List<TEA_TASK_SUB> tasklist = Get_TEA_TASK_SUB_List(new TEA_TASK_SUB() { TaskState = EnumTaskState.Unread, Subscriber = "SCP" });
//if (tasklist.Count() > 0) if (_result.Count() > 0)
if (_result.State == ReturnStatus.Succeed) //if (_result.State == ReturnStatus.Succeed)
{ {
//foreach (var _task in tasklist) foreach (var _task in _result)
foreach (var _task in _result.Result) //foreach (var _task in _result.Result)
{ {
ScpEntities scpdb = EntitiesFactory.CreateScpInstance(); ScpEntities scpdb = EntitiesFactory.CreateScpInstance();
DataCenterContext dc = EntitiesFactory.CreateDataCenterInstance(); DataCenterContext dc = EntitiesFactory.CreateDataCenterInstance();
@ -418,32 +418,34 @@ namespace CK.SCP.Controller
EntitiesFactory.SaveDb(dc); EntitiesFactory.SaveDb(dc);
scope.Complete(); scope.Complete();
break; break;
case "TES_SUPPLIER": #region 单独读取 供应商和零件
var _supplierlist = db.TES_SUPPLIER.Where(p => p.TaskID == _task.TaskID).ToList(); //case "TES_SUPPLIER":
result = UpdateSupplier(_supplierlist, scpdb, authdb, _task); // var _supplierlist = db.TES_SUPPLIER.Where(p => p.TaskID == _task.TaskID).ToList();
result.Message = _task.TaskID.ToString(); // result = UpdateSupplier(_supplierlist, scpdb, authdb, _task);
Update_TEA_TASK_SUB(db, _task); // result.Message = _task.TaskID.ToString();
scpdb.BulkSaveChanges(); // Update_TEA_TASK_SUB(db, _task);
db.BulkSaveChanges(); // scpdb.BulkSaveChanges();
authdb.BulkSaveChanges(); // db.BulkSaveChanges();
dc.BulkSaveChanges(); // //authdb.BulkSaveChanges();
// dc.BulkSaveChanges();
// //EntitiesFactory.SaveDb(scpdb);
// //EntitiesFactory.SaveDb(db);
// //EntitiesFactory.SaveDb(dc);
// //EntitiesFactory.SaveDb(authdb);
// //取消自动创建
// //UpdateSupplierExtend(_supplierlist);
// scope.Complete();
// break;
//case "TES_PART_MSTR":
// result = UpdatePart(db, scpdb, _task);
// result.Message = _task.TaskID.ToString();
// Update_TEA_TASK_SUB(db, _task);
// EntitiesFactory.SaveDb(scpdb); // EntitiesFactory.SaveDb(scpdb);
// EntitiesFactory.SaveDb(db); // EntitiesFactory.SaveDb(db);
// EntitiesFactory.SaveDb(dc); // EntitiesFactory.SaveDb(dc);
//EntitiesFactory.SaveDb(authdb); // scope.Complete();
//取消自动创建 // break;
//UpdateSupplierExtend(_supplierlist); #endregion
scope.Complete();
break;
case "TES_PART_MSTR":
result = UpdatePart(db, scpdb, _task);
result.Message = _task.TaskID.ToString();
Update_TEA_TASK_SUB(db, _task);
EntitiesFactory.SaveDb(scpdb);
EntitiesFactory.SaveDb(db);
EntitiesFactory.SaveDb(dc);
scope.Complete();
break;
case "TED_PPOD_DET": case "TED_PPOD_DET":
result = UpdatePPod(db, scpdb, _task); result = UpdatePPod(db, scpdb, _task);
result.Message = _task.TaskID.ToString(); result.Message = _task.TaskID.ToString();
@ -513,6 +515,103 @@ namespace CK.SCP.Controller
p_action(result); p_action(result);
} }
/// <summary>
/// 基础数据
/// </summary>
/// <param name="p_action"></param>
public static void BaseReadService(Action<ResultObject<bool>> p_action)
{
ResultObject<bool> result = new ResultObject<bool>();
ExchangeCenterService service = new ExchangeCenterService();
var jsonResult = service.GetSessionId("SCP", "5C2DE907DB859810", "");
var serviceResultEntityList = JsonConvert.DeserializeObject< List<ServiceResult>>(jsonResult);
string SessionId = "";
SessionId = serviceResultEntityList.First().Data;
var _result = Get_TEA_TASK_SUB_List(new TEA_TASK_SUB() { TaskState = EnumTaskState.Unread, Subscriber = "SCP" });
if (_result.Count() > 0)
{
foreach (var _task in _result)
//foreach (var _task in _result.Result)
{
ScpEntities scpdb = EntitiesFactory.CreateScpInstance();
DataCenterContext dc = EntitiesFactory.CreateDataCenterInstance();
AppBoxContext authdb = EntitiesFactory.CreateAppBoxInstance();
ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance();
using (var scope =
new TransactionScope(TransactionScopeOption.Suppress, new TransactionOptions()
{
IsolationLevel = System.Transactions.IsolationLevel.RepeatableRead,
Timeout = new TimeSpan(0, 20, 0)
}))
{
try
{
switch (_task.TableName)
{
case "TES_SUPPLIER":
var _supplierlist = db.TES_SUPPLIER.Where(p => p.TaskID == _task.TaskID).ToList();
result = UpdateSupplier(_supplierlist, scpdb, authdb, _task);
result.Message = _task.TaskID.ToString();
service.UpdateTaskState(SessionId, _task.TaskID.ToString(), 2,0,"");
//Update_TEA_TASK_SUB(db, _task);
scpdb.BulkSaveChanges();
scope.Complete();
break;
case "TES_PART_MSTR":
result = UpdatePart(db, scpdb, _task);
result.Message = _task.TaskID.ToString();
service.UpdateTaskState(SessionId, _task.TaskID.ToString(), 2, 0, "");
//Update_TEA_TASK_SUB(db, _task);
EntitiesFactory.SaveDb(scpdb);
scope.Complete();
break;
}
result.State = ReturnStatus.Succeed;
result.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);
});
}
scope.Dispose();
result.State = ReturnStatus.Failed;
result.ErrorList.Add(dbEx);
}
catch (OptimisticConcurrencyException ex)//并发冲突异常
{
scope.Dispose();
result.State = ReturnStatus.Failed;
result.ErrorList.Add(ex);
}
catch (Exception ex)
{
scope.Dispose();
result.State = ReturnStatus.Failed;
result.ErrorList.Add(ex);
result.Message = ex.Message; //_task.TaskID.ToString();
if (ex.InnerException != null)
{
result.Message = ex.InnerException.Message;
}
}
}
p_action(result);
}
}
p_action(result);
}
public static void WriteService(Action<ResultObject<List<LogModel>>> p_action) public static void WriteService(Action<ResultObject<List<LogModel>>> p_action)
{ {
ResultObject<List<LogModel>> result = new ResultObject<List<LogModel>>(); ResultObject<List<LogModel>> result = new ResultObject<List<LogModel>>();
@ -528,8 +627,8 @@ namespace CK.SCP.Controller
{ {
ScpEntities scpdb = EntitiesFactory.CreateScpInstance(); ScpEntities scpdb = EntitiesFactory.CreateScpInstance();
ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance(); ExchangeCenterContext db = EntitiesFactory.CreateExchangeCenterInstance();
var _list = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "BJBMPT").OrderBy(p => p.UID).ToList(); var _list = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "CDBMPT").OrderBy(p => p.UID).ToList();
var _list1 = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "BJBMPT" && p.InterfaceType == "Price").OrderBy(p => p.UID).ToList(); var _list1 = scpdb.TS_UNI_API.Where(p => p.State == (int)DataState.Enabled && p.Domain == "CDBMPT" && p.InterfaceType == "Price").OrderBy(p => p.UID).ToList();
var apiii = _list1.Count(); var apiii = _list1.Count();
if (apiii > 0) if (apiii > 0)
@ -2053,12 +2152,14 @@ namespace CK.SCP.Controller
ResultObject<bool> _ret = new ResultObject<bool>(); ResultObject<bool> _ret = new ResultObject<bool>();
try try
{ {
var _venderlist = new List<TA_VENDER>(); var _tavenderlist = scpdb.TA_VENDER.ToList();
var addlist = new List<TA_VENDER>();
var uplist = new List<TA_VENDER>();
foreach (var supplier in p_list) foreach (var supplier in p_list)
{ {
foreach (var item in _dic) foreach (var item in _dic)
{ {
var _supplier = scpdb.TA_VENDER.FirstOrDefault(p => p.VendId == supplier.SupplierCode && p.Site == item.Key); var _supplier = _tavenderlist.FirstOrDefault(p => p.VendId == supplier.SupplierCode && p.Site == item.Key);
if (_supplier == null) if (_supplier == null)
{ {
_supplier = new TA_VENDER _supplier = new TA_VENDER
@ -2067,15 +2168,25 @@ namespace CK.SCP.Controller
VendAbbCode = "0", VendAbbCode = "0",
State = 1, State = 1,
}; };
}
_supplier.VendName = string.IsNullOrEmpty(supplier.SupplierName) ? supplier.SupplierName : supplier.SupplierName; _supplier.VendName = string.IsNullOrEmpty(supplier.SupplierName) ? supplier.SupplierName : supplier.SupplierName;
_supplier.SubSite = item.Value;//地点 _supplier.SubSite = item.Value;//地点
_supplier.Site = item.Key;//域 _supplier.Site = item.Key;//域
_supplier.Remark = supplier.TaskID.ToString();//任务ID _supplier.Remark = supplier.TaskID.ToString();//任务ID
addlist.Add(_supplier);
}
else
{
_supplier.VendName = string.IsNullOrEmpty(supplier.SupplierName) ? supplier.SupplierName : supplier.SupplierName;
var vendname = string.Format("{0}@{1}", _supplier.VendId.ToUpper(), _supplier.Site.ToUpper()); _supplier.SubSite = item.Value;//地点
// 取消自动创建 _supplier.Site = item.Key;//域
_supplier.Remark = supplier.TaskID.ToString();//任务ID
uplist.Add(_supplier);
}
# region 取消自动创建
//var vendname = string.Format("{0}@{1}", _supplier.VendId.ToUpper(), _supplier.Site.ToUpper());
//
//var _first = authdb.Users.Where(p => p.Name == vendname).FirstOrDefault(); //var _first = authdb.Users.Where(p => p.Name == vendname).FirstOrDefault();
//var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault(); //var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault();
//var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == _supplier.Site.ToUpper()).FirstOrDefault(); //var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == _supplier.Site.ToUpper()).FirstOrDefault();
@ -2108,10 +2219,13 @@ namespace CK.SCP.Controller
// _entity.TA_FACTORY.Add(f); // _entity.TA_FACTORY.Add(f);
// authdb.Users.Add(_entity); // authdb.Users.Add(_entity);
//} //}
_venderlist.Add(_supplier); //_venderlist.Add(_supplier);
#endregion
} }
} }
scpdb.TA_VENDER.AddOrUpdate(q => q.UID, _venderlist.ToArray()); scpdb.BulkInsert(addlist);
scpdb.BulkUpdate(uplist);
//scpdb.TA_VENDER.AddOrUpdate(q => q.UID, _venderlist.ToArray());
_ret.State = ReturnStatus.Succeed; _ret.State = ReturnStatus.Succeed;
_ret.MessageList.Add(string.Format("更新表{0}任务ID{1}成功!", "TES_SUPPLIER", p_entity.TaskID)); _ret.MessageList.Add(string.Format("更新表{0}任务ID{1}成功!", "TES_SUPPLIER", p_entity.TaskID));
} }

4
北京北汽/Controller/SCP_MoldSharing_Controller.cs

@ -36,6 +36,10 @@ namespace CK.SCP.Controller
{ {
q = q.Where(p => p.VendId == p_entity.VendId); q = q.Where(p => p.VendId == p_entity.VendId);
} }
if (!string.IsNullOrEmpty(p_entity.Site))
{
q = q.Where(p => p.Site == p_entity.Site);
}
q = q.Where(p => p.IsDeleted == p_entity.IsDeleted); q = q.Where(p => p.IsDeleted == p_entity.IsDeleted);
_ret.State = ReturnStatus.Succeed; _ret.State = ReturnStatus.Succeed;
_ret.Result = q; _ret.Result = q;

390
北京北汽/Controller/SCP_PLAN_CONTROLLER.cs

@ -1919,6 +1919,396 @@ namespace CK.SCP.Controller
// return _ret; // return _ret;
//} //}
public static ResultObject<bool> PLAN_TO_ASK1(List<V_TB_PO_PLAN> p_order_list, User p_user)
{
ResultObject<bool> _ret = new ResultObject<bool>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
List<string> lineError = new List<string>();
List<string> ErrorList = new List<string>();
var _lst = p_order_list.Where(p => p.PlanQty != 0).ToList();
if (lineError.Count > 0)
{
_ret.State = ReturnStatus.Failed;
_ret.MessageList.AddRange(ErrorList);
_ret.Result = false;
}
else
{
var VenderList = _lst.Select(p => p.VendId).Distinct();
var PartCodeList = _lst.Select(p => p.PartCode).Distinct();
var OrderList = _lst.GroupBy(p => p.PoBillNum).ToList();
OrderList.ForEach((p) =>
{
var list = p.ToList();
if (list.Count > 0)
{
var _entity = list.FirstOrDefault();
TB_ASK _ask = new TB_ASK();
_ask.AskBillNum = SCP_BILLCODE_CONTROLLER.MakeASKCode();
_ask.VendId = _entity.VendId;
_ask.State = (int)AskState.New;
_ask.PoBillNum = _entity.PoBillNum;
_ask.ModType = (int)BillModType.Contract;
_ask.Site = _entity.Site;
_ask.Remark = _entity.Version;
_ask.State = (int)AskState.New;
DateTime date = DateTime.Now;
string str = date.Year.ToString();
string str1 = date.Month.ToString();
string datetime = str + "-" + str1;
_ask.UpdateTime = DateTime.Parse(datetime);
_ask.Buyer = p_user.ChineseName;
_ask.BuyerPhone = p_user.CellPhone;
_ask.ErpBillNum = _entity.PoBillNum;
_ask.BeginTime = DateTime.Parse( _entity.BeginTime.ToString());
_ask.EndTime = _entity.EndTime;
_ask.CreateTime = DateTime.Now.Date;
_ask.CreateUser = p_user.Name;
_ask.VendId = _entity.VendId;
_ask.GUID = Guid.NewGuid();
_ask.ReceivedPort = string.Empty;
_ask.IsDeleted = false;
_ask.SubSite = p_user.UserdSite;
db.TB_ASK.Add(_ask);
#region 供应商新任务代办接口
TB_PENING_ITEMS _item = new TB_PENING_ITEMS();
_item.ROLE_NAME = "供应商";
_item.ITEM_NO = _ask.AskBillNum;
_item.ITEM_CONTENT = "要货看盘有信息";
_item.ITEM_TYPE = (int)PENDING_MESSAGE_TYPE.NEW_ASK;
_item.VEND_ID = _ask.VendId;
_item.ITEM_STATE = (int)PENDING_STATE.WAITING;
_item.SENDER = p_user.ChineseName;
_item.SENDING_TIME = DateTime.Now;
db.TB_PENING_ITEMS.Add(_item);
#endregion
// int _number = 1;
List<TB_ASK_DETAIL> _ls = new List<TB_ASK_DETAIL>();
list.ForEach((itm) =>
{
var _number = _ls.Count(p1 => p1.PoBillNum == _ask.PoBillNum
&& p1.PoLine == itm.PoLine && p1.PartCode == itm.PartCode);
if (_number > 0)
{
_ret.MessageList.Add(string.Format("已经存在订单为{0}行号为{1}零件编码为{2}", itm.PoBillNum, itm.PoLine.ToString(), itm.PartCode));
}
TB_ASK_DETAIL _t_ASK_Detail = new TB_ASK_DETAIL();
//_t_ASK_Detail.PoLine = _number;
_t_ASK_Detail.PoLine = itm.PoLine;
_t_ASK_Detail.Currency = "CNY";
_t_ASK_Detail.AskBillNum = _ask.AskBillNum;
_t_ASK_Detail.PoBillNum = _ask.PoBillNum;
_t_ASK_Detail.PoUnit = itm.PoUnit;
_t_ASK_Detail.CreateTime = DateTime.Now;
_t_ASK_Detail.CreateUser = _ask.CreateUser;
_t_ASK_Detail.PartCode = itm.PartCode;
_t_ASK_Detail.BeginTime = _ask.BeginTime;
_t_ASK_Detail.EndTime = itm.EndTime;
_t_ASK_Detail.TempQty = itm.PlanQty;
_t_ASK_Detail.AskQty = itm.PlanQty;
_t_ASK_Detail.IsDeleted = false;
_t_ASK_Detail.LocUnit = itm.PoUnit;
_t_ASK_Detail.UnConv = 1;
_t_ASK_Detail.Remark = itm.Version;
_t_ASK_Detail.State = _ask.State;
_t_ASK_Detail.SubSite = p_user.UserdSite;
// _t_ASK_Detail.Price = string.IsNullOrEmpty(itm.) ? 0 : decimal.Parse(itm.价格);
_t_ASK_Detail.GUID = Guid.NewGuid();
_t_ASK_Detail.Remark = _ask.Site;
db.TB_ASK_DETAIL.Add(_t_ASK_Detail);
_ls.Add(_t_ASK_Detail);
// _number++;
});
}
else
{
_ret.MessageList.Add("ERP订单编号已存在,请重新导入!");
}
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), "EXCEL_PO_TO_ASK", 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), "EXCEL_PO_TO_ASK", 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), "EXCEL_PO_TO_ASK", 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), "EXCEL_PO_TO_ASK", e.Message);
_ret.Result = false;
_ret.ErrorList.Add(e);
throw e;
}
return _ret;
}
public static DataTable Get_TB_PLAN_REPORT(V_TB_PO_PLAN p_plan)
{
DataTable dt = new DataTable();
DataTable dt1 = new DataTable();
DataTable dt2 = new DataTable();
DataTable dt3 = new DataTable();
string _sqlString = "SELECT * FROM ( SELECT partcode,endtime,planqty,partdesc,pounit,domain,pobillnum,poline FROM V_TB_PO_PLAN where {0}\n " +
") A\n" +
" pivot ( sum(planQty) for a.endtime in (\n" +
" {1}\n" +
")\n" +
") as ourpivot ";
string _sql = "SELECT DISTINCT(ENDTIME) FROM V_TB_PO_PLAN where {0} ORDER BY ENDTIME";
string _askBillSql = "SELECT * FROM V_TB_ASK_DETAIL where VENDID = '{0}' AND EndTime IN ({1}) AND AskBillNum like 'E%' ";
string _asn_recive = "SELECT A.PartCode, A.PoBillNum, A.PoLine, SUM(A.Qty) AS AsnQty, SUM(ISNULL(B.Qty, 0)) AS ReciveQty,\n" +
" SUM(ISNULL(C.AskQty, 0)) AS AskQty\n" +
"FROM V_TB_ASN_DETAIL AS A LEFT OUTER JOIN\n" +
" V_TB_RECEIVE_DETAIL AS B ON A.AsnBillNum = B.AsnBillNum AND A.PartCode = B.PartCode AND\n" +
" A.PoBillNum = B.PoBillNum AND A.PoLine = B.PoLine INNER JOIN\n" +
" TB_ASK_DETAIL AS C ON A.AskBillNum = C.AskBillNum AND A.PartCode = C.PartCode AND\n" +
" A.PoBillNum = C.PoBillNum AND A.PoLine = C.PoLine\n" +
"WHERE (A.AskBillNum LIKE 'E%') AND (A.State > 0) and {0}\n" +
"GROUP BY A.PartCode, A.PoBillNum, A.PoLine";
var dbSetting = GlobalConfig.ScpDatabase;
try
{
var strConn = EntitiesFactory.GetEfConnectionString(dbSetting);
SqlConnection conn = new System.Data.SqlClient.SqlConnection();
conn.ConnectionString = strConn;
if (conn.State != ConnectionState.Open)
{
conn.Open();
}
#region 结束时间范围
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
string where1 = " 1=1 ";
if (!string.IsNullOrEmpty(p_plan.PartCode))
{
where1 += string.Format(" and partcode='{0}' ", p_plan.PartCode);
}
if (!string.IsNullOrEmpty(p_plan.VendId))
{
where1 += string.Format(" and VendId='{0}' ", p_plan.VendId);
}
if (!string.IsNullOrEmpty(p_plan.PoBillNum))
{
where1 += string.Format(" and PoBillNum='{0}' ", p_plan.PoBillNum);
}
if (p_plan.EndTime_Begin != null)
{
where1 += string.Format(" and EndTime>='{0}'", p_plan.EndTime_Begin.Value.ToString("yyyy-MM-dd"));
}
else
{
where1 += string.Format(" and EndTime>='{0}'", DateTime.Now.ToString("yyyy-MM-dd"));
}
if (p_plan.EndTime_End != null)
{
where1 += string.Format(" and EndTime<='{0}'", p_plan.EndTime_End.Value.ToString("yyyy-MM-dd"));
}
else
{
where1 += string.Format(" and EndTime<='{0}'", DateTime.Now.AddMonths(1).ToString("yyyy-MM-dd"));
}
cmd.CommandText = string.Format(_sql, where1);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(dt);
#endregion
List<string> _ls = new List<string>();
List<string> _ls1 = new List<string>();
foreach (DataRow row in dt.Rows)
{
_ls.Add(string.Format("[{0}]", row["EndTime"].ToString()));
_ls1.Add(string.Format("'{0}'", row["EndTime"].ToString()));
}
if (_ls.Count > 0)
{
#region 计划行转列
SqlCommand cmd1 = new SqlCommand();
cmd1.Connection = conn;
string where = "1=1 ";
if (!string.IsNullOrEmpty(p_plan.PartCode))
{
where += string.Format(" and partcode='{0}' ", p_plan.PartCode);
}
where += string.Format(" and VendId='{0}' ", p_plan.VendId);
if (!string.IsNullOrEmpty(p_plan.PoBillNum))
{
where += string.Format(" and PoBillNum='{0}' ", p_plan.PoBillNum);
}
cmd1.CommandText = string.Format(_sqlString, where, string.Join(",", _ls.ToArray()));
var adapter1 = new SqlDataAdapter(cmd1);
adapter1.Fill(dt1);
#endregion
#region 此范围内的看板号
SqlCommand cmd2 = new SqlCommand();
cmd2.Connection = conn;
cmd2.CommandText = string.Format(_askBillSql, p_plan.VendId, string.Join(",", _ls1.ToArray()));
SqlDataAdapter adapter2 = new SqlDataAdapter(cmd2);
adapter2.Fill(dt2);
#endregion
List<string> _askList = new List<string>();
foreach (DataRow row in dt2.Rows)
{
_askList.Add(string.Format("'{0}'", row["AskBillNum"].ToString()));
}
if (_askList.Count > 0)
{
SqlCommand cmd3 = new SqlCommand();
cmd3.Connection = conn;
cmd3.CommandText = string.Format(_asn_recive, string.Format(" A.askBillNum in ({0}) ", string.Join(",", _askList.ToArray())));
SqlDataAdapter adapter3 = new SqlDataAdapter(cmd3);
adapter3.Fill(dt3);
}
var column0 = dt1.Columns.Add("要货数量");
var column1 = dt1.Columns.Add("收货数量");
var column2 = dt1.Columns.Add("发货数量");
var column3 = dt1.Columns.Add("未发数量");
var column4 = dt1.Columns.Add("未收数量");
foreach (DataRow dr in dt1.Rows)
{
foreach (DataRow row in dt3.Rows)
{
if (
dr["PartCode"].ToString() == row["PartCode"].ToString()
&& dr["PoBillNum"].ToString() == row["PoBillNum"].ToString()
&& dr["PoLine"].ToString() == row["PoLine"].ToString())
{
dr["要货数量"] = row["ReciveQty"].ToString();
dr["收货数量"] = row["ReciveQty"].ToString();
dr["发货数量"] = row["AsnQty"].ToString();
dr["未收数量"] = decimal.Parse(row["AsnQty"].ToString()) - decimal.Parse(row["ReciveQty"].ToString());
dr["未发数量"] = decimal.Parse(row["AskQty"].ToString()) - decimal.Parse(row["AsnQty"].ToString());
}
}
}
foreach (DataColumn column in dt1.Columns)
{
try
{
var _dt1 = DateTime.Parse(column.ColumnName);
var _curDate = _dt1.ToString("yyyy-MM-dd");
column.ColumnName = _curDate + "(预测)";//要货预测头
foreach (DataRow row in dt2.Rows)
{
var _cur = DateTime.Parse(row["EndTime"].ToString()).ToString("yyyy-MM-dd");//看板时间
StringBuilder _buf = new StringBuilder();
if (_curDate == _cur)
{
var _ask = row["AskBillNum"].ToString();
column.ColumnName = _cur + "(" + _ask + ")";
switch (int.Parse(row["state"].ToString()))
{
case (int)AskState.New:
column.ColumnName = _cur + "(" + _ask + ")" + "(计划)";
break;
case (int)AskState.Ship:
column.ColumnName = _cur + "(" + _ask + ")" + "(已发货)";
break;
case (int)AskState.Confirm:
column.ColumnName = _cur + "(" + _ask + ")" + "(已确认)";
break;
case (int)AskState.Release:
column.ColumnName = _cur + "(" + _ask + ")" + "(已发布)";
break;
case (int)AskState.Receive:
column.ColumnName = _cur + "(" + _ask + ")" + "(已收货)";
break;
}
}
}
}
catch
{
continue;
}
}
dt1.Columns["PartCode"].ColumnName = "零件编码";
dt1.Columns["PartDesc"].ColumnName = "零件描述";
dt1.Columns["PoUnit"].ColumnName = "单位";
dt1.Columns["PoBillNum"].ColumnName = "订单编号";
dt1.Columns["PoLine"].ColumnName = "行号";
dt1.Columns["Domain"].ColumnName = "域";
}
conn.Close();
}
catch (SqlException ex)
{
throw new Exception($"系统无法连接到数据库:{dbSetting},请检查配置的服务器,数据库,用户名和密码等信息是否正确。{Environment.NewLine}{ex}");
}
return dt1;
}
} }
} }

88
北京北汽/Controller/SCP_PO_CONTROLLER.cs

@ -4124,6 +4124,7 @@ namespace CK.SCP.Controller
_PO_Detail.Dliverypatterncode = itm.; _PO_Detail.Dliverypatterncode = itm.;
_PO_Detail.Deliverytimecode = itm.; _PO_Detail.Deliverytimecode = itm.;
_PO_Detail.Transportdays = string.IsNullOrEmpty(itm.) ? 0 : int.Parse(itm.); _PO_Detail.Transportdays = string.IsNullOrEmpty(itm.) ? 0 : int.Parse(itm.);
_PO_Detail.Remark = itm.;
db.TB_PO_DETAIL.AddOrUpdate(_PO_Detail); db.TB_PO_DETAIL.AddOrUpdate(_PO_Detail);
}); });
_polist = _polist + _po.PoBillNum + ","; _polist = _polist + _po.PoBillNum + ",";
@ -5568,5 +5569,92 @@ namespace CK.SCP.Controller
return errorlist; return errorlist;
} }
public static void Get_V_TB_PO_PLAN_List_BJKFT(V_TB_PO_PLAN_BJBMPT p_entity, Action<ResultObject<IQueryable<V_TB_PO_PLAN_BJBMPT>>> p_action)
{
ResultObject<IQueryable<V_TB_PO_PLAN_BJBMPT>> _ret = new ResultObject<IQueryable<V_TB_PO_PLAN_BJBMPT>>();
try
{
using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{
IQueryable<V_TB_PO_PLAN_BJBMPT> q = db.V_TB_PO_PLAN_BJBMPT;
if (!string.IsNullOrEmpty(p_entity.Domain))
{
q = q.Where(p => p.Domain.Contains(p_entity.Domain));
}
if (!string.IsNullOrEmpty(p_entity.PartCode))
{
q = q.Where(p => p.PartCode.Contains(p_entity.PartCode));
}
if (!string.IsNullOrEmpty(p_entity.PoBillNum))
{
q = q.Where(p => p.PoBillNum.Contains(p_entity.PoBillNum));
}
if (!string.IsNullOrEmpty(p_entity.Site))
{
q = q.Where(p => p.Site.Contains(p_entity.Site));
}
if (!string.IsNullOrEmpty(p_entity.Buyer))
{
q = q.Where(p => p.Buyer.Contains(p_entity.Buyer));
}
if (!string.IsNullOrEmpty(p_entity.ProjectId))
{
q = q.Where(p => p.ProjectId.Contains(p_entity.ProjectId));
}
if (!string.IsNullOrEmpty(p_entity.AskBillNum))
{
q = q.Where(p => p.AskBillNum.Contains(p_entity.AskBillNum));
}
if (!string.IsNullOrEmpty(p_entity.Version))
{
q = q.Where(p => p.Version.Contains(p_entity.Version));
}
if (!string.IsNullOrEmpty(p_entity.PartDesc))
{
q = q.Where(p => p.PartDesc.Contains(p_entity.PartDesc));
}
if (!string.IsNullOrEmpty(p_entity.VendId))
{
q = q.Where(p => p.VendId.Contains(p_entity.VendId));
}
if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0)
{
q = q.Where(p => p_entity.UserInAddress.Contains(p.Domain));
}
if (p_entity.UserInVendIds != null && p_entity.UserInVendIds.Count > 0)
{
q = q.Where(p => p_entity.UserInVendIds.Contains(p.VendId));
}
if (p_entity.EndTime_Begin != null)
{
q = q.Where(p => p.EndTime >= p_entity.EndTime_Begin.Value);
}
if (p_entity.EndTime_End != null)
{
q = q.Where(p => p.EndTime <= p_entity.EndTime_End.Value);
}
if (p_entity.EndTime_Begin1 != null)
{
q = q.Where(p => p.CreateTime >= p_entity.EndTime_Begin1.Value);
}
if (p_entity.EndTime_End1 != null)
{
q = q.Where(p => p.CreateTime <= p_entity.EndTime_End1.Value);
}
_ret.State = ReturnStatus.Succeed;
_ret.Result = q;
p_action(_ret);
}
}
catch (Exception e)
{
_ret.State = ReturnStatus.Failed;
_ret.ErrorList.Add(e);
LogHelper.Writlog(LogHelper.LogType.Error, typeof(V_TB_PO_PLAN), "Get_V_TB_PO_PLAN_List", e.Message);
throw e;
}
}
} }
} }

11
北京北汽/Controller/app.config

@ -2,6 +2,7 @@
<configuration> <configuration>
<configSections> <configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.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" />
<section name="WebSrvAPITest.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> <section name="WebSrvAPITest.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup> </sectionGroup>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
@ -30,10 +31,20 @@
</providers> </providers>
</entityFramework> </entityFramework>
<applicationSettings> <applicationSettings>
<CK.SCP.Controller.Properties.Settings>
<setting name="CK_SCP_Controller_WebReference_ExchangeCenterService"
serializeAs="String">
<value>http://10.60.101.3:8009/ExchangeCenterService.asmx</value>
</setting>
</CK.SCP.Controller.Properties.Settings>
<WebSrvAPITest.Properties.Settings> <WebSrvAPITest.Properties.Settings>
<setting name="WebSrvAPITest_localhost_CommonAPISVStub" serializeAs="String"> <setting name="WebSrvAPITest_localhost_CommonAPISVStub" serializeAs="String">
<value>http://10.10.10.21/u9/Services/YY.U9.Cust.MPT.MPTSV.ICommonAPISV.svc</value> <value>http://10.10.10.21/u9/Services/YY.U9.Cust.MPT.MPTSV.ICommonAPISV.svc</value>
</setting> </setting>
</WebSrvAPITest.Properties.Settings> </WebSrvAPITest.Properties.Settings>
</applicationSettings> </applicationSettings>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
</configuration> </configuration>

5
北京北汽/Models/CK.SCP.Models.csproj

@ -47,6 +47,7 @@
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" /> <Reference Include="System.Security" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
@ -447,6 +448,9 @@
<Compile Include="ScpEntity\V_TB_PO.cs" /> <Compile Include="ScpEntity\V_TB_PO.cs" />
<Compile Include="ScpEntity\V_TB_PO_DETAIL.cs" /> <Compile Include="ScpEntity\V_TB_PO_DETAIL.cs" />
<Compile Include="ScpEntity\V_TB_PO_DETAIL_CQ.cs" /> <Compile Include="ScpEntity\V_TB_PO_DETAIL_CQ.cs" />
<Compile Include="ScpEntity\V_TB_PO_PLAN.cs" />
<Compile Include="ScpEntity\V_TB_PO_PLAN_BJBMPT.cs" />
<Compile Include="ScpEntity\V_TB_PO_PLAN_DETAIL.cs" />
<Compile Include="ScpEntity\V_TB_PRICE_DETAIL.cs" /> <Compile Include="ScpEntity\V_TB_PRICE_DETAIL.cs" />
<Compile Include="ScpEntity\V_TB_PRICE.cs" /> <Compile Include="ScpEntity\V_TB_PRICE.cs" />
<Compile Include="ScpEntity\V_TB_PRICE_TemporaryPrice.cs" /> <Compile Include="ScpEntity\V_TB_PRICE_TemporaryPrice.cs" />
@ -484,6 +488,7 @@
<Compile Include="ScpEntity\TA_FACTORY_CONFIG.cs" /> <Compile Include="ScpEntity\TA_FACTORY_CONFIG.cs" />
<Compile Include="StockIn.cs" /> <Compile Include="StockIn.cs" />
<Compile Include="StockOut.cs" /> <Compile Include="StockOut.cs" />
<Compile Include="UniApiEntity\ServiceResult.cs" />
<Compile Include="UniApiEntity\xxqad_ppod_det .cs" /> <Compile Include="UniApiEntity\xxqad_ppod_det .cs" />
<Compile Include="UniApiEntity\xxwms_qua_det.cs" /> <Compile Include="UniApiEntity\xxwms_qua_det.cs" />
<Compile Include="UniApiEntity\IControlTable.cs" /> <Compile Include="UniApiEntity\IControlTable.cs" />

1
北京北汽/Models/ScpEntities.cs

@ -166,6 +166,7 @@ namespace CK.SCP.Models
public virtual DbSet<V_TB_ASK_DETAIL_PO> V_TB_ASK_DETAIL_PO { get; set; } public virtual DbSet<V_TB_ASK_DETAIL_PO> V_TB_ASK_DETAIL_PO { get; set; }
public virtual DbSet<TB_ADDRESS_BUYER> TB_ADDRESS_BUYER { get; set; } public virtual DbSet<TB_ADDRESS_BUYER> TB_ADDRESS_BUYER { get; set; }
public virtual DbSet<V_TB_PO_PLAN_BJBMPT> V_TB_PO_PLAN_BJBMPT { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder) protected override void OnModelCreating(DbModelBuilder modelBuilder)
{ {

88
北京北汽/Models/ScpEntity/TB_ASN.cs

@ -14,61 +14,61 @@ namespace CK.SCP.Models.ScpEntity
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
public partial class V_TB_PO_PLAN_EXTEND //public partial class V_TB_PO_PLAN_EXTEND
{ //{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] // [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key] // [Key]
public long UID { get; set; } // public long UID { get; set; }
public string Domain { get; set; } // public string Domain { get; set; }
public string PartCode { get; set; } // public string PartCode { get; set; }
public Nullable<System.DateTime> EndTime { get; set; } // public Nullable<System.DateTime> EndTime { get; set; }
public string PoBillNum { get; set; } // public string PoBillNum { get; set; }
public string Site { get; set; } // public string Site { get; set; }
public string AskBillNum { get; set; } // public string AskBillNum { get; set; }
public string Version { get; set; } // public string Version { get; set; }
public string PartDesc { get; set; } // public string PartDesc { get; set; }
public decimal PlanQty { get; set; } // public decimal PlanQty { get; set; }
public string PoUnit { get; set; } // public string PoUnit { get; set; }
public int PoLine { get; set; } // public int PoLine { get; set; }
public string VendId { get; set; } // public string VendId { get; set; }
public string ProjectId { get; set; } // public string ProjectId { get; set; }
public string IsPlan { get; set; } // public string IsPlan { get; set; }
[NotMapped] // [NotMapped]
public List<string> UserInAddress { set; get; } // public List<string> UserInAddress { set; get; }
[NotMapped] // [NotMapped]
public List<string> UserInVendIds { set; get; } // public List<string> UserInVendIds { set; get; }
[NotMapped] // [NotMapped]
public List<int> BillStateList { set; get; } // public List<int> BillStateList { set; get; }
[NotMapped] // [NotMapped]
public DateTime? EndTime_Begin { set; get; } // public DateTime? EndTime_Begin { set; get; }
[NotMapped] // [NotMapped]
public DateTime? EndTime_End { set; get; } // public DateTime? EndTime_End { set; get; }
} //}
public partial class V_TB_PO_PLAN_DETAIL //public partial class V_TB_PO_PLAN_DETAIL
{ //{
[Key] // [Key]
public long UID { get; set; } // public long UID { get; set; }
public string PoBillNum { get; set; } // public string PoBillNum { get; set; }
public string VendId { get; set; } // public string VendId { get; set; }
public Nullable<System.DateTime> EndTime { get; set; } // public Nullable<System.DateTime> EndTime { get; set; }
public string PartCode { get; set; } // public string PartCode { get; set; }
public string AskBillNum { get; set; } // public string AskBillNum { get; set; }
public string Version { get; set; } // public string Version { get; set; }
public string Domain { get; set; } // public string Domain { get; set; }
public decimal PlanQty { get; set; } // public decimal PlanQty { get; set; }
public string PoUnit { get; set; } // public string PoUnit { get; set; }
} //}
public partial class TB_ASN:RecordEntity public partial class TB_ASN:RecordEntity
{ {
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]

16
北京北汽/SCP/SCP.csproj

@ -2930,6 +2930,8 @@
<Content Include="grf\SmallBarCode.grf" /> <Content Include="grf\SmallBarCode.grf" />
<Content Include="grf\InvRecBill.grf" /> <Content Include="grf\InvRecBill.grf" />
<Content Include="Handlers\MakeVerifyCode.ashx" /> <Content Include="Handlers\MakeVerifyCode.ashx" />
<Content Include="Views\PlanData\SCP_PO_BJPLAN.aspx" />
<Content Include="Views\PlanData\SCP_PO_PLAN_DETAIL.aspx" />
<Content Include="Views\PlanData\SCP_TB_ASK_DETAIL_PO.aspx" /> <Content Include="Views\PlanData\SCP_TB_ASK_DETAIL_PO.aspx" />
<Content Include="Views\PlanData\SCP_PO_CQ.aspx" /> <Content Include="Views\PlanData\SCP_PO_CQ.aspx" />
<Content Include="Views\PlanData\SCP_PO_DETAIL_CQ.aspx" /> <Content Include="Views\PlanData\SCP_PO_DETAIL_CQ.aspx" />
@ -5482,6 +5484,20 @@
<Compile Include="Views\PlanData\SCP_ASK.aspx.designer.cs"> <Compile Include="Views\PlanData\SCP_ASK.aspx.designer.cs">
<DependentUpon>SCP_ASK.aspx</DependentUpon> <DependentUpon>SCP_ASK.aspx</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\PlanData\SCP_PO_BJPLAN.aspx.cs">
<DependentUpon>SCP_PO_BJPLAN.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Views\PlanData\SCP_PO_BJPLAN.aspx.designer.cs">
<DependentUpon>SCP_PO_BJPLAN.aspx</DependentUpon>
</Compile>
<Compile Include="Views\PlanData\SCP_PO_PLAN_DETAIL.aspx.cs">
<DependentUpon>SCP_PO_PLAN_DETAIL.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Views\PlanData\SCP_PO_PLAN_DETAIL.aspx.designer.cs">
<DependentUpon>SCP_PO_PLAN_DETAIL.aspx</DependentUpon>
</Compile>
<Compile Include="Views\PlanData\SCP_TB_ASK_DETAIL_PO.aspx.cs"> <Compile Include="Views\PlanData\SCP_TB_ASK_DETAIL_PO.aspx.cs">
<DependentUpon>SCP_TB_ASK_DETAIL_PO.aspx</DependentUpon> <DependentUpon>SCP_TB_ASK_DETAIL_PO.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType> <SubType>ASPXCodeBehind</SubType>

5
北京北汽/SCP/Views/BasicData/SCP_MoldSharing.aspx

@ -55,8 +55,8 @@
</f:Form> </f:Form>
</Items> </Items>
</f:GroupPanel> </f:GroupPanel>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" PageSize="20" BoxFlex="1" CssClass="maingrid" <f:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" BoxFlex="1" CssClass="maingrid"
runat="server" DataKeyNames="UID,VendId" IsDatabasePaging="False" AllowPaging="True" OnPageIndexChange="Grid1_OnPageIndexChange" runat="server" DataKeyNames="UID,VendId" IsDatabasePaging="true" AllowPaging="True" OnPageIndexChange="Grid1_OnPageIndexChange"
EnableRowSelectEvent="True" AutoScroll="True" SortField="VendId" SortDirection="ASC" AllowSorting="True"> EnableRowSelectEvent="True" AutoScroll="True" SortField="VendId" SortDirection="ASC" AllowSorting="True">
<PageItems> <PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server"> <f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
@ -65,7 +65,6 @@
</f:ToolbarText> </f:ToolbarText>
<f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_OnSelectedIndexChanged" <f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_OnSelectedIndexChanged"
runat="server"> runat="server">
<f:ListItem Text="10" Value="10" />
<f:ListItem Text="20" Value="20" /> <f:ListItem Text="20" Value="20" />
<f:ListItem Text="50" Value="50" /> <f:ListItem Text="50" Value="50" />
<f:ListItem Text="100" Value="100" /> <f:ListItem Text="100" Value="100" />

12
北京北汽/SCP/Views/BasicData/SCP_MoldSharing.aspx.cs

@ -44,9 +44,9 @@ namespace SCP.Views.BasicData
} }
SearchV_TA_MoldSharingData((result) => SearchV_TA_MoldSharingData((result) =>
{ {
Grid1.RecordCount = result.Count();
var list = SortAndPage<V_TA_MOLDSHARING>(result, Grid1); var list = SortAndPage<V_TA_MOLDSHARING>(result, Grid1);
Grid1.DataSource = list; Grid1.DataSource = list;
Grid1.RecordCount = result.Count();
Grid1.DataBind(); Grid1.DataBind();
}); });
} }
@ -57,7 +57,15 @@ namespace SCP.Views.BasicData
public void SearchV_TA_MoldSharingData(Action<IQueryable<V_TA_MOLDSHARING>> p_action) public void SearchV_TA_MoldSharingData(Action<IQueryable<V_TA_MOLDSHARING>> p_action)
{ {
V_TA_MOLDSHARING _entity = new V_TA_MOLDSHARING(); V_TA_MOLDSHARING _entity = new V_TA_MOLDSHARING();
_entity.VendId = CurrentUser.VenderList.FirstOrDefault(); if (!string.IsNullOrEmpty(textVendId.Text))
{
_entity.VendId = textVendId.Text.Trim();
}
if (!string.IsNullOrEmpty(textPartCode.Text))
{
_entity.PartCode = textPartCode.Text.Trim();
}
_entity.Site = CurrentUser.UsedDomain;
SCP_MoldSharing_Controller.Get_V_TA_MoldSharing_List(_entity, (_ret) => SCP_MoldSharing_Controller.Get_V_TA_MoldSharing_List(_entity, (_ret) =>
{ {

8
北京北汽/SCP/Views/PlanData/SCP_INCOMPLETE_ASK.aspx.cs

@ -120,10 +120,10 @@ namespace SCP.PlanData
_entity.DayState = int.Parse(ddl_DayState.SelectedValue); _entity.DayState = int.Parse(ddl_DayState.SelectedValue);
_entity.IsDeleted = false; _entity.IsDeleted = false;
_entity.Site = CurrentUser.UsedDomain; _entity.Site = CurrentUser.UsedDomain;
if (CurrentUser.VenderList.Count > 0) //if (CurrentUser.VenderList.Count > 0)
{ //{
_entity.VendId = CurrentUser.VenderList.FirstOrDefault(); // _entity.VendId = CurrentUser.VenderList.FirstOrDefault();
} //}
_entity.SubSite = CurrentUser.UserdSite; _entity.SubSite = CurrentUser.UserdSite;

17
北京北汽/SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx.cs

@ -434,14 +434,15 @@ namespace SCP.PlanData
Alert.Show(_str); Alert.Show(_str);
return; return;
} }
if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0) // 重庆看板备注 展示
{ //if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
if (CurrentUser.FactoryList.FirstOrDefault() == "CQBMPT") //{
{ // if (CurrentUser.FactoryList.FirstOrDefault() == "CQBMPT")
qadOrder.Remark = ""; // {
qadOrderList.ForEach(p => { p.Remark = string.Empty; }); // qadOrder.Remark = "";
} // qadOrderList.ForEach(p => { p.Remark = string.Empty; });
} // }
//}
string Ssite = ""; string Ssite = "";
if ((CurrentUser.UserdSite == "CQ01") || (CurrentUser.UserdSite == "CD01")) if ((CurrentUser.UserdSite == "CQ01") || (CurrentUser.UserdSite == "CD01"))
{ {

20
北京北汽/UniApiWpf/MainWindow.xaml.cs

@ -210,6 +210,26 @@ namespace UniApiWpf
{ {
#region #region
SCP_DC_UNI_CONTROLLER.ReadService((rs) => SCP_DC_UNI_CONTROLLER.ReadService((rs) =>
{
List<LogModel> _list = new List<LogModel>();
if (rs.State == ReturnStatus.Succeed)
{
rs.MessageList.ForEach(p =>
{
_list.Add(new LogModel() { LogMessage = string.Format("{0}任务:{1}", p, rs.Message.ToString()), LogTime = DateTime.Now.ToShortDateString(), TableName = "", TaskId = rs.Message.ToString(), });
});
CreateLogDataList(_list, WriteLogEnum.Get);
}
else
{
rs.ErrorList.ForEach(p =>
{
_list.Add(new LogModel() { LogMessage = string.Format("{0}任务:{1}", p.Message, rs.Message.ToString()), LogTime = DateTime.Now.ToShortDateString(), TableName = "", TaskId = rs.Message.ToString(), });
});
CreateLogDataList(_list, WriteLogEnum.Get);
}
});
SCP_DC_UNI_CONTROLLER.BaseReadService((rs) =>
{ {
List<LogModel> _list = new List<LogModel>(); List<LogModel> _list = new List<LogModel>();
if (rs.State == ReturnStatus.Succeed) if (rs.State == ReturnStatus.Succeed)

Loading…
Cancel
Save