lvzb 1 year ago
parent
commit
44ffff39e1
  1. 5
      Controller/CK.SCP.Controller.csproj
  2. 15
      Models/CK.SCP.Models.csproj
  3. 4
      Models/EntitiesFactory.cs
  4. 5
      UniApiGroup/CK.SCP.GrupUniApi.csproj
  5. 77
      UniApiGroup/Controller/OdbcApiQadController.cs

5
Controller/CK.SCP.Controller.csproj

@ -31,8 +31,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ChangKeTec.Utils">
<HintPath>D:\连接orlcor\ChangKeTec.Utils.dll</HintPath>
<Reference Include="ChangKeTec.Utils, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\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>

15
Models/CK.SCP.Models.csproj

@ -31,6 +31,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ChangKeTec.Utils">
<HintPath>..\Controller\bin\Debug\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>
@ -768,12 +771,6 @@
<None Include="UniApiEntity\App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Utils\CK.SCP.Utils.csproj">
<Project>{4c6a951d-ad7f-47ce-b2ce-32c205d8d6ba}</Project>
<Name>CK.SCP.Utils</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="WmsEntity\TableSchema.tt">
<Generator>TextTemplatingFileGenerator</Generator>
@ -786,5 +783,11 @@
<ItemGroup>
<Folder Include="WmsEntity\HyAntolin\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Utils\CK.SCP.Utils.csproj">
<Project>{4C6A951D-AD7F-47CE-B2CE-32C205D8D6BA}</Project>
<Name>CK.SCP.Utils</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

4
Models/EntitiesFactory.cs

@ -1,17 +1,15 @@
using System;
using System.Data.Entity;
using System.Data.Entity.Core;
using System.Data.Entity.Core.EntityClient;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CK.SCP.Models.AppBoxEntity;
using CK.SCP.Models.Enums;
using CK.SCP.Models.UniApiEntity;
using CK.SCP.Utils;
using ChangKeTec.Wms.Models.Wms;
using System.ComponentModel;
using CK.SCP.Utils;
namespace CK.SCP.Models
{

5
UniApiGroup/CK.SCP.GrupUniApi.csproj

@ -48,8 +48,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ChangKeTec.Utils">
<HintPath>D:\连接orlcor\ChangKeTec.Utils.dll</HintPath>
<Reference Include="ChangKeTec.Utils, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Controller\bin\Debug\ChangKeTec.Utils.dll</HintPath>
</Reference>
<Reference Include="DevComponents.DotNetBar.Layout, Version=14.1.0.21, Culture=neutral, PublicKeyToken=7eb7c3a35b91de04, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

77
UniApiGroup/Controller/OdbcApiQadController.cs

@ -795,46 +795,27 @@ namespace CK.SCP.GrupUniApi.Controller
var wmsAskList = new List<TB_ASK>();
var wmsAskDetailList = new List<TB_ASK_DETAIL>();
var xxMaxbath = new List<xxDiMaxes_Po>();
var Dlist = list.Where(p=>p.ctype=="D");
var Dlist = list.Where(p => p.ctype == "D");
var Ilist = list.Where(p => p.ctype != "D");
var _li = Dlist.GroupBy(p=>p.purDocNO);
var _li = Dlist.GroupBy(p => p.purDocNO);
foreach (var _lii in _li)
{
var _liii = _lii.ToList();
var _entity = _liii.First();
var _askdetail = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == _entity.purDocNO && p.State > -1);
if(_askdetail== _liii.Count())
{
var ask = wdb.TB_ASK.FirstOrDefault(p=>p.PoBillNum==_entity.purDocNO);
ask.State = -1;
ask.IsDeleted = true;
wmsAskList.Add(ask);
var askdetaill=wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO).ToList();
// ¸ù¾Ý Áã¼þºÅ×÷·Ï
var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO && p.PartCode == _entity.mtlNO).ToList();
askdetaill.ForEach(p =>
{
p.State = -1;
p.IsDeleted = true;
wmsAskDetailList.Add(p);
});
}
else
{
var askdetaill = wdb.TB_ASK_DETAIL.Where(p => p.PoBillNum == _entity.purDocNO).ToList();
askdetaill.ForEach(p =>
{
p.State = -1;
p.IsDeleted = true;
wmsAskDetailList.Add(p);
});
}
}
foreach (var qadPoNbr in Ilist)
{
var qadDataList = wmsPoList.Count(p => p.PoBillNum == qadPoNbr.purDocNO);
var wmsPo1 = wdb.TB_PO.Count(p => p.PoBillNum == qadPoNbr.purDocNO);
if ( qadDataList == 0&& wmsPo1==0)
if (qadDataList == 0 && wmsPo1 == 0)
{
TB_PO wmsPo = new TB_PO
{
@ -859,7 +840,7 @@ namespace CK.SCP.GrupUniApi.Controller
var qadAskList = wmsAskList.Count(p => p.PoBillNum == qadPoNbr.purDocNO);
var wmsAs1 = wdb.TB_ASK.Count(p => p.PoBillNum == qadPoNbr.purDocNO);
if ( qadAskList == 0&& wmsAs1==0)
if (qadAskList == 0 && wmsAs1 == 0)
{
int cnt = 1;
@ -882,7 +863,7 @@ namespace CK.SCP.GrupUniApi.Controller
ErpBillNum = qadPoNbr.purDocNO,//订单号
SubSite = "W21",
};
if (qadPoNbr.returnsItem =="Y")
if (qadPoNbr.returnsItem == "Y")
{
wmsAs.State = -1;
}
@ -897,7 +878,9 @@ namespace CK.SCP.GrupUniApi.Controller
var qadASKList = wmsAskDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO);
var wmsAskDetail1 = wdb.TB_ASK_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO);
if (qadASKList == 0&& wmsAskDetail1==0)
//
var tapart = wdb.TA_PART.Where(q => q.PartCode == qadPoNbr.mtlNO.Trim()).ToList();
if (qadASKList == 0 && wmsAskDetail1 == 0)
{
String str = "k";
TB_ASK_DETAIL wmsAskDetail = new TB_ASK_DETAIL
@ -914,7 +897,7 @@ namespace CK.SCP.GrupUniApi.Controller
EndTime = qadPoNbr.itemDeliveryDate,//收货结束时间
Price = 0,
AskQty = qadPoNbr.quantity,
DockCode = "YC",
DockCode = tapart.Count()>0 ? tapart.FirstOrDefault().PartGroup:"YC",
PoUnit = qadPoNbr.baseUnitMeasure,
Currency = qadPoNbr.sizecoL,
};
@ -940,7 +923,7 @@ namespace CK.SCP.GrupUniApi.Controller
var qadDataList1 = wmsPoDetailList.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO);
var wmsPoDetail1 =
wdb.TB_PO_DETAIL.Count(p => p.PoBillNum == qadPoNbr.purDocNO && p.PartCode == qadPoNbr.mtlNO);
if ( qadDataList1 == 0&& wmsPoDetail1==0)
if (qadDataList1 == 0 && wmsPoDetail1 == 0)
{
TB_PO_DETAIL wmsPoDetail = new TB_PO_DETAIL
@ -1247,8 +1230,8 @@ namespace CK.SCP.GrupUniApi.Controller
var maxlist1 = new xxDiMaxes
{
Di_Batchno_part = 0,
Di_Batchno=0,
Di_Batchno_price=0,
Di_Batchno = 0,
Di_Batchno_price = 0,
Di_Batchno_NETprice = itm.DI_BATCHNO,
};
@ -1277,7 +1260,7 @@ namespace CK.SCP.GrupUniApi.Controller
}
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray());
item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
item.Remark = ((int) UniApiState.ʧ°Ü).ToString();
item.Remark = ((int)UniApiState.ʧ°Ü).ToString();
scpdb.TB_NetPrice.AddOrUpdate(PriceList.ToArray());
Console.WriteLine($"更新采购净价数据:{PriceList.Count}");
}
@ -1292,7 +1275,7 @@ namespace CK.SCP.GrupUniApi.Controller
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_NETprice).FirstOrDefault();
int a = max.Di_Batchno_price;
var FATCTORY = scpdb.TB_FACTORY.FirstOrDefault();
DataTable b = PriceController.GetInvBatchPrice(a,FATCTORY.FactoryId);
DataTable b = PriceController.GetInvBatchPrice(a, FATCTORY.FactoryId);
List<PURPriceDealMidTab> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURPriceDealMidTab>(b);
var xxMaxbath = new List<xxDiMaxes>();
var PriceList = new List<TB_PRICE>();
@ -1303,7 +1286,7 @@ namespace CK.SCP.GrupUniApi.Controller
Di_Batchno_part = 0,
Di_Batchno = 0,
Di_Batchno_price = itm.DI_BATCHNO,
Di_Batchno_NETprice =0,
Di_Batchno_NETprice = 0,
};
xxMaxbath.Add(maxlist1);
@ -1317,7 +1300,7 @@ namespace CK.SCP.GrupUniApi.Controller
Unit = itm.ordUnit,
PartCode = itm.MTLNO,
Site = itm.plant,
StartTime =itm.validityStartPeriod,
StartTime = itm.validityStartPeriod,
EndTime = itm.validityEndPeriod,
};
_price.Amt = decimal.Parse(itm.purchasePrice);
@ -1341,7 +1324,7 @@ namespace CK.SCP.GrupUniApi.Controller
/// <param name="idb"></param>
/// <param name="wdb"></param>
/// <param name="seq"></param>
private static void UpdateVendParts(UniApiEntities idb, ScpEntities wdb,xxerp_MaxbatchNO item)
private static void UpdateVendParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item)
{
DataTable b = vendidpartcontroller.GetInvBatchStock(item.MaxdibatchNO.ToString());
List<PURVendorpartMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURVendorpartMid>(b);
@ -1406,7 +1389,7 @@ namespace CK.SCP.GrupUniApi.Controller
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno).FirstOrDefault();
int a = max.Di_Batchno;
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault();
DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO, a,FATCTORY.FactoryId);
DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO, a, FATCTORY.FactoryId);
//DataTable b = Vendercontroller.GetInvBatchStock(item.MaxdibatchNO);
List<PURVendorMid> list = ChangKeTec.Utils.ListHelper.DataTableToList<PURVendorMid>(b);
var wmsDataList = new List<TA_VENDER>();
@ -1417,8 +1400,8 @@ namespace CK.SCP.GrupUniApi.Controller
{
var maxlist1 = new xxDiMaxes
{
Di_Batchno_NETprice=0,
Di_Batchno_price=0,
Di_Batchno_NETprice = 0,
Di_Batchno_price = 0,
Di_Batchno_part = 0,
Di_Batchno = qadData.DI_BATCHNO,
@ -1440,7 +1423,7 @@ namespace CK.SCP.GrupUniApi.Controller
var _vend = authdb.Roles.Where(p => p.Name == "供应商").FirstOrDefault();
var _factory = authdb.TA_FACTORY.Where(p => p.ErpDomain == ScpCache.Config.QAD域).FirstOrDefault();
//_first == null && _vend != null &&
if (_factory != null&& _first==null)
if (_factory != null && _first == null)
{
User _entity = new User();
_entity.Name = vendname;
@ -1487,7 +1470,7 @@ namespace CK.SCP.GrupUniApi.Controller
wdb.TA_VENDER.AddOrUpdate(p => new { p.VendId, p.Site }, wmsDataList.ToArray());
idb.xxDiMaxes.AddOrUpdate(xxMaxbath.ToArray());
item.MaxdibatchNO = item.MaxdibatchNO +list.Count;
item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
Console.WriteLine($"更新 供应商 数据:{list.Count}");
}
@ -1553,13 +1536,13 @@ namespace CK.SCP.GrupUniApi.Controller
/// <param name="idb"></param>
/// <param name="wdb"></param>
/// <param name="seq"></param>
private static void UpdateParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item )
private static void UpdateParts(UniApiEntities idb, ScpEntities wdb, xxerp_MaxbatchNO item)
{
var max = idb.xxDiMaxes.OrderByDescending(r => r.Di_Batchno_part).FirstOrDefault();
int a = max.Di_Batchno_part;
var FATCTORY = wdb.TB_FACTORY.FirstOrDefault();
DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO,a, FATCTORY.FactoryId);
List<MMRSENDMTLDATA> list= ChangKeTec.Utils.ListHelper.DataTableToList<MMRSENDMTLDATA>(b);
DataTable b = QmStockController.GetInvBatchStock(item.MaxdibatchNO, a, FATCTORY.FactoryId);
List<MMRSENDMTLDATA> list = ChangKeTec.Utils.ListHelper.DataTableToList<MMRSENDMTLDATA>(b);
var wmsDataList = new List<TA_PART>();
var xxMaxbath = new List<xxDiMaxes>();
@ -1567,8 +1550,8 @@ namespace CK.SCP.GrupUniApi.Controller
{
var maxlist1 = new xxDiMaxes
{
Di_Batchno_NETprice=0,
Di_Batchno_price=0,
Di_Batchno_NETprice = 0,
Di_Batchno_price = 0,
Di_Batchno_part = qadData.DI_BATCHNO,
Di_Batchno = 0
@ -1609,4 +1592,4 @@ namespace CK.SCP.GrupUniApi.Controller
}
}
}

Loading…
Cancel
Save