Browse Source

冲压机材料订单读其他表

SCP_CYJ
qian 6 months ago
parent
commit
50d7d979cc
  1. 4
      Controller/SCP_MPO_CONTROLLER.cs
  2. 1
      Models/CK.SCP.Models.csproj
  3. 1
      Models/UniApiEntity/UniApiEntities.cs
  4. 14
      Models/UniApiEntity/xxDiMaxes_Order.cs
  5. 2
      Models/UniApiEntity/xxDiMaxes_Po.cs
  6. 1
      SCP/Views/PlanData/SCP_PO_MATERIAL.aspx.cs
  7. 1
      SCP/Views/SupplierData/SCP_MPO_DETAIL.aspx.cs
  8. 8
      SCP/Views/SupplierData/SCP_PO_MATERIAL.aspx.cs
  9. 97
      UniApiGroup/Controller/OdbcApiQadController.cs
  10. 6
      UniApiGroup/Controller/PoBillNumcontroller.cs

4
Controller/SCP_MPO_CONTROLLER.cs

@ -135,6 +135,10 @@ namespace CK.SCP.Controller
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) using (ScpEntities db = EntitiesFactory.CreateScpInstance())
{ {
IQueryable<V_TB_MPO_DETAIL> q = db.V_TB_MPO_DETAIL; IQueryable<V_TB_MPO_DETAIL> q = db.V_TB_MPO_DETAIL;
if (!string.IsNullOrWhiteSpace(p_entity.Ctype))
{
q = q.Where(p => p.Ctype == p_entity.Ctype);
}
if (p_entity.purdocnolist != null && p_entity.purdocnolist.Count > 0) if (p_entity.purdocnolist != null && p_entity.purdocnolist.Count > 0)
{ {
q = q.Where(p => p_entity.purdocnolist.Contains(p.PurdocNO)); q = q.Where(p => p_entity.purdocnolist.Contains(p.PurdocNO));

1
Models/CK.SCP.Models.csproj

@ -500,6 +500,7 @@
<Compile Include="ScpEntity\V_TS_BARCODE.cs" /> <Compile Include="ScpEntity\V_TS_BARCODE.cs" />
<Compile Include="UniApiEntity\PURReplenishQty.cs" /> <Compile Include="UniApiEntity\PURReplenishQty.cs" />
<Compile Include="UniApiEntity\xxDiMaxes.cs" /> <Compile Include="UniApiEntity\xxDiMaxes.cs" />
<Compile Include="UniApiEntity\xxDiMaxes_Order.cs" />
<Compile Include="UniApiEntity\xxDiMaxes_Po.cs" /> <Compile Include="UniApiEntity\xxDiMaxes_Po.cs" />
<Compile Include="UniApiEntity\xxerp_MaxbatchNO.cs" /> <Compile Include="UniApiEntity\xxerp_MaxbatchNO.cs" />
<Compile Include="UniApiEntity\xxscm_maxpo_det.cs" /> <Compile Include="UniApiEntity\xxscm_maxpo_det.cs" />

1
Models/UniApiEntity/UniApiEntities.cs

@ -55,6 +55,7 @@ namespace CK.SCP.Models.UniApiEntity
public virtual DbSet<PURReplenishQties> PURReplenishQty { get; set; } public virtual DbSet<PURReplenishQties> PURReplenishQty { get; set; }
public virtual DbSet<xxwms_review_det> xxwms_review_det { get; set; } public virtual DbSet<xxwms_review_det> xxwms_review_det { get; set; }
public virtual DbSet<PURSubcontractors> PURSubcontractors { get; set; } public virtual DbSet<PURSubcontractors> PURSubcontractors { get; set; }
public virtual DbSet<xxDiMaxes_Order> xxDiMaxes_Order { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder) protected override void OnModelCreating(DbModelBuilder modelBuilder)
{ {
modelBuilder.Entity<xxmes_ctrl>() modelBuilder.Entity<xxmes_ctrl>()

14
Models/UniApiEntity/xxDiMaxes_Order.cs

@ -0,0 +1,14 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace CK.SCP.Models.UniApiEntity
{
public partial class xxDiMaxes_Order
{
[Key]
public int UID { get; set; }
public string PURDOCNO { get; set; }
public int DI_BATCHNO { get; set; }
public string PURDOCITEMNO { get; set; }
public DateTime CREATEDDATE { get; set; }
}
}

2
Models/UniApiEntity/xxDiMaxes_Po.cs

@ -5,7 +5,7 @@ namespace CK.SCP.Models.UniApiEntity
{ {
[Key] [Key]
public int UID { get; set; } public int UID { get; set; }
public int Di_Batchno { get; set; } public int Di_Batchno { get; set; }
} }
} }

1
SCP/Views/PlanData/SCP_PO_MATERIAL.aspx.cs

@ -152,6 +152,7 @@ namespace SCP.Views.PlanData
{"PURDOCITEMNO","行号" }, {"PURDOCITEMNO","行号" },
{ "PurchaseReqNO", "申请单号" }, { "PurchaseReqNO", "申请单号" },
{ "ProposerDesc", "申请人" }, { "ProposerDesc", "申请人" },
{"State_DESC","状态" },
{ "OASTATUS", "OA审批状态" }, { "OASTATUS", "OA审批状态" },
{ "MtlNO", "物料号" }, { "MtlNO", "物料号" },
{ "Shorttext", "物料描述" }, { "Shorttext", "物料描述" },

1
SCP/Views/SupplierData/SCP_MPO_DETAIL.aspx.cs

@ -33,6 +33,7 @@ namespace SCP.Views.SupplierData
V_TB_MPO_DETAIL _entity = new V_TB_MPO_DETAIL(); V_TB_MPO_DETAIL _entity = new V_TB_MPO_DETAIL();
string purdocnolist =Request["PurdocNO"]; string purdocnolist =Request["PurdocNO"];
_entity.purdocnolist = purdocnolist.Split(',').ToList(); _entity.purdocnolist = purdocnolist.Split(',').ToList();
_entity.Ctype = "N";
SCP_MPO_CONTROLLER.Get_V_TB_MPO_DETAIL_List(_entity,(_ret)=> { SCP_MPO_CONTROLLER.Get_V_TB_MPO_DETAIL_List(_entity,(_ret)=> {
if (_ret.State == ReturnStatus.Succeed) if (_ret.State == ReturnStatus.Succeed)
{ {

8
SCP/Views/SupplierData/SCP_PO_MATERIAL.aspx.cs

@ -127,6 +127,7 @@ namespace SCP.Views.SupplierData
{ "PurdocNO", "订单号" }, { "PurdocNO", "订单号" },
{ "PurchaseReqNO", "申请单号" }, { "PurchaseReqNO", "申请单号" },
{ "ProposerDesc", "申请人" }, { "ProposerDesc", "申请人" },
{"State_DESC","状态" },
{ "OASTATUS", "OA审批状态" }, { "OASTATUS", "OA审批状态" },
{ "MtlNO", "物料号" }, { "MtlNO", "物料号" },
{ "Shorttext", "物料描述" }, { "Shorttext", "物料描述" },
@ -151,11 +152,18 @@ namespace SCP.Views.SupplierData
{ {
int[] selections = Grid_V_TB_MPO.SelectedRowIndexArray; int[] selections = Grid_V_TB_MPO.SelectedRowIndexArray;
List<string> NOList = new List<string>(); List<string> NOList = new List<string>();
List<string> order = new List<string>();
if (selections.Count() > 0) if (selections.Count() > 0)
{ {
foreach (int rowIndex in selections) foreach (int rowIndex in selections)
{ {
NOList.Add(Grid_V_TB_MPO.DataKeys[rowIndex][1] as string); NOList.Add(Grid_V_TB_MPO.DataKeys[rowIndex][1] as string);
order.Add(Grid_V_TB_MPO.DataKeys[rowIndex][12] as string);
}
if (order.Contains("D"))
{
Alert.Show("请选择未被作废的数据进行查看明细");
return;
} }
string BillNum = String.Join(",", NOList); string BillNum = String.Join(",", NOList);
string url = string.Format("../SupplierData/SCP_MPO_DETAIL.aspx?PurdocNO={0}", BillNum); string url = string.Format("../SupplierData/SCP_MPO_DETAIL.aspx?PurdocNO={0}", BillNum);

97
UniApiGroup/Controller/OdbcApiQadController.cs

@ -927,7 +927,6 @@ namespace CK.SCP.GrupUniApi.Controller
var maxlist1 = new xxDiMaxes_Po var maxlist1 = new xxDiMaxes_Po
{ {
Di_Batchno = qadPoNbr.DI_BATCHNO, Di_Batchno = qadPoNbr.DI_BATCHNO,
}; };
xxMaxbath.Add(maxlist1); xxMaxbath.Add(maxlist1);
@ -1638,50 +1637,64 @@ namespace CK.SCP.GrupUniApi.Controller
{ {
try try
{ {
var max = idb.xxDiMaxes_Po.OrderByDescending(r => r.Di_Batchno).FirstOrDefault(); // 读取一年内 所有审批完的一般材料订单
int a = max.Di_Batchno; DataTable b = GetGeneralMaterialOrder();
var FATCTORY = sdb.TB_FACTORY.FirstOrDefault(); List<GeneralMaterialOrder> orderlist = ChangKeTec.Utils.ListHelper.DataTableToList<GeneralMaterialOrder>(b);
// 黍龰珨啜第蹋隆等 List<xxDiMaxes_Order>maxes_Orders = ChangKeTec.Utils.ListHelper.DataTableToList<xxDiMaxes_Order>(b);
DataTable b = GetGeneralMaterialOrder(a, FATCTORY.FactoryId); DateTime time = DateTime.Now.AddYears(-1);
List<GeneralMaterialOrder> list = ChangKeTec.Utils.ListHelper.DataTableToList<GeneralMaterialOrder>(b); var hisList = idb.xxDiMaxes_Order.Where(q=>q.CREATEDDATE> time).ToList();
// 取历史表不存在的数据
var expectedList = maxes_Orders.Where(x=> !hisList.Any(e=>e.DI_BATCHNO == x.DI_BATCHNO && e.PURDOCNO == x.PURDOCNO && e.PURDOCITEMNO ==x.PURDOCITEMNO)).ToList();
if (expectedList.Count() == 0)
{
return;
}
List<GeneralMaterialOrder> list = new List<GeneralMaterialOrder>();
foreach (var exitem in expectedList)
{
var selectList = orderlist.Where(q => q.PURDOCNO == exitem.PURDOCNO && q.DI_BATCHNO == exitem.DI_BATCHNO && q.PURDOCITEMNO == exitem.PURDOCITEMNO).ToList();
list.AddRange(selectList);
}
var PoList = new List<TB_MATERIALORDERS>(); var PoList = new List<TB_MATERIALORDERS>();
var PoDetailList = new List<TB_MATERIALORDERS_DETAIL>(); var PoDetailList = new List<TB_MATERIALORDERS_DETAIL>();
var InPoList = new List<TB_MATERIALORDERS>(); var InPoList = new List<TB_MATERIALORDERS>();
var InPoDetailList = new List<TB_MATERIALORDERS_DETAIL>(); var InPoDetailList = new List<TB_MATERIALORDERS_DETAIL>();
var xxMaxbath = new List<xxDiMaxes_Po>(); var xxMaxbath = new List<xxDiMaxes_Order>();
var emails = new List<TS_Email>(); var emails = new List<TS_Email>();
var Dlist = list.Where(p => p.CTYPE == "D"); var Dlist = list.Where(p => p.CTYPE == "D");
var Ilist = list.Where(p => p.CTYPE != "D").GroupBy(p => p.PURDOCNO).Distinct(); var Ilist = list.Where(p => p.CTYPE == "I").GroupBy(p => p.PURDOCNO).Distinct();
var _Dlist = Dlist.GroupBy(p => p.PURDOCNO).Distinct(); var _Dlist = Dlist.GroupBy(p => p.PURDOCNO).Distinct();
string wwadres= sdb.TA_CONFIG.FirstOrDefault(q => q.ParamName == "接口邮件网址").ParamValue; string wwadres= sdb.TA_CONFIG.FirstOrDefault(q => q.ParamName == "接口邮件网址").ParamValue;
foreach (var DeleteItem in _Dlist) foreach (var DeleteItem in _Dlist)
{ {
var _list = DeleteItem.ToList(); var _list = DeleteItem.ToList();
var _entity = _list.First(); var _entity = _list.First();
// 跦擂 隆等瘍釬煙
//var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == _entity.PURDOCNO).ToList();
//MATERIALORDERList.ForEach(p =>
//{
// p.Ctype = "D" ;
// p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel;
// PoList.Add(p);
//});
foreach (var Ditem in _list) foreach (var Ditem in _list)
{ {
var MATERIALORDERDETAILList = sdb.TB_MATERIALORDERS_DETAIL.Where(q => q.PurdocNO == Ditem.PURDOCNO && q.PURDOCITEMNO == Ditem.PURDOCITEMNO).ToList(); var MATERIALORDERDETAILList = sdb.TB_MATERIALORDERS_DETAIL.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList();
if (MATERIALORDERDETAILList.Count() == 0)
{
continue;
}
MATERIALORDERDETAILList.ForEach(p => MATERIALORDERDETAILList.ForEach(p =>
{ {
p.Ctype = "D"; if (p.PURDOCITEMNO == Ditem.PURDOCITEMNO)
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel; {
PoDetailList.Add(p); p.Ctype = Ditem.CTYPE;
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel;
PoDetailList.Add(p);
}
}); });
var valueType = MATERIALORDERDETAILList.Select(q => q.Ctype).Distinct().ToList(); var valueType = MATERIALORDERDETAILList.Select(q => q.Ctype).Distinct().ToList();
var type = valueType.FirstOrDefault(); var type = valueType.FirstOrDefault();
// 子表全是d并且唯一 更新主表
if (valueType.Count() == 1 && type =="D") if (valueType.Count() == 1 && type =="D")
{ {
var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList(); var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList();
MATERIALORDERList.ForEach(p => MATERIALORDERList.ForEach(p =>
{ {
p.AcceptStatus = (int)GeneralMaterialOrderState.Cancel;
p.Ctype = "D"; p.Ctype = "D";
PoList.Add(p); PoList.Add(p);
}); });
@ -1712,14 +1725,27 @@ namespace CK.SCP.GrupUniApi.Controller
emails.Add(email); emails.Add(email);
#endregion #endregion
} }
else //否则将主表变成新建状态
{
var MATERIALORDERList = sdb.TB_MATERIALORDERS.Where(q => q.PurdocNO == Ditem.PURDOCNO).ToList();
MATERIALORDERList.ForEach(p =>
{
p.Ctype = "N";
p.AcceptStatus = (int)GeneralMaterialOrderState.New;
PoList.Add(p);
});
}
var maxlist1 = new xxDiMaxes_Order
{
DI_BATCHNO = Ditem.DI_BATCHNO,
PURDOCNO = Ditem.PURDOCNO,
PURDOCITEMNO = Ditem.PURDOCITEMNO,
CREATEDDATE = Ditem.CREATEDDATE,
};
xxMaxbath.Add(maxlist1);
} }
var maxlist1 = new xxDiMaxes_Po
{
Di_Batchno = _entity.DI_BATCHNO,
};
xxMaxbath.Add(maxlist1);
} }
foreach (var InsertItem in Ilist) foreach (var InsertItem in Ilist)
@ -1766,6 +1792,14 @@ namespace CK.SCP.GrupUniApi.Controller
orderdetail.StoreLocation = initem.STORELOCATION; orderdetail.StoreLocation = initem.STORELOCATION;
orderdetail.PURDOCITEMNO = initem.PURDOCITEMNO; orderdetail.PURDOCITEMNO = initem.PURDOCITEMNO;
InPoDetailList.Add(orderdetail); InPoDetailList.Add(orderdetail);
var maxlist1 = new xxDiMaxes_Order
{
DI_BATCHNO = initem.DI_BATCHNO,
PURDOCNO = initem.PURDOCNO,
PURDOCITEMNO = initem.PURDOCITEMNO,
CREATEDDATE = initem.CREATEDDATE,
};
xxMaxbath.Add(maxlist1);
} }
#endregion #endregion
#region #region
@ -1793,19 +1827,14 @@ namespace CK.SCP.GrupUniApi.Controller
} }
emails.Add(email); emails.Add(email);
#endregion #endregion
var maxlist1 = new xxDiMaxes_Po
{
Di_Batchno = inentity.DI_BATCHNO,
};
xxMaxbath.Add(maxlist1);
} }
sdb.BulkInsert(emails);// 添加一般材料订单的邮件 sdb.BulkInsert(emails);// 添加一般材料订单的邮件
sdb.BulkInsert(InPoList);// 添加插入的数据 sdb.BulkInsert(InPoList);// 添加插入的数据
sdb.BulkInsert(InPoDetailList);// 添加明细 sdb.BulkInsert(InPoDetailList);// 添加明细
item.Remark = ((int)UniApiState.).ToString(); item.Remark = ((int)UniApiState.).ToString();
item.MaxdibatchNO = item.MaxdibatchNO + list.Count; item.MaxdibatchNO = item.MaxdibatchNO + list.Count;
idb.xxDiMaxes_Po.AddOrUpdate(xxMaxbath.ToArray()); idb.xxDiMaxes_Order.AddOrUpdate(xxMaxbath.ToArray());
// 更新 // 更新
sdb.TB_MATERIALORDERS.BulkUpdate(PoList); sdb.TB_MATERIALORDERS.BulkUpdate(PoList);
sdb.TB_MATERIALORDERS_DETAIL.BulkUpdate(PoDetailList); sdb.TB_MATERIALORDERS_DETAIL.BulkUpdate(PoDetailList);

6
UniApiGroup/Controller/PoBillNumcontroller.cs

@ -72,10 +72,10 @@ namespace CK.SCP.UniApi.Controller
/// <param name="di_d"></param> /// <param name="di_d"></param>
/// <param name="site"></param> /// <param name="site"></param>
/// <returns></returns> /// <returns></returns>
public static DataTable GetGeneralMaterialOrder(int di_d, string site) public static DataTable GetGeneralMaterialOrder()
{ {
string Sql = $"select * from PURStockBill"; string Sql = $"select * from PURStockBill";
Sql += $" Where ((ordType='CY02'AND APPROVALSTATUS = '4') OR (ordType='CY04' AND APPROVALSTATUS = '4') OR (ordType='CY05' AND APPROVALSTATUS = '4') OR ( ordType='CY08'AND APPROVALSTATUS = '4' ) OR (ordType='CY09' AND APPROVALSTATUS = '4') ) and plant='W21' and di_batchNO>{di_d}"; Sql += $" Where ((ordType='CY02'AND APPROVALSTATUS = '4') OR (ordType='CY04' AND APPROVALSTATUS = '4') OR (ordType='CY05' AND APPROVALSTATUS = '4') OR ( ordType='CY08'AND APPROVALSTATUS = '4' ) OR (ordType='CY09' AND APPROVALSTATUS = '4') ) and plant='W21' and docDate > add_months(trunc(SYSDATE), -12)";
var dt_Part = DBControllerByOracle.GetDataTable(Sql); var dt_Part = DBControllerByOracle.GetDataTable(Sql);
return dt_Part; return dt_Part;
} }
@ -83,7 +83,7 @@ namespace CK.SCP.UniApi.Controller
public class GeneralMaterialOrder public class GeneralMaterialOrder
{ {
public int PURSTOCKBILLID { get; set; } public int PURSTOCKBILLID { get; set; }
public DateTime? CREATEDDATE { get; set; } public DateTime CREATEDDATE { get; set; }
public decimal? NETVALUE { get; set; } public decimal? NETVALUE { get; set; }
public string PURGRP { get; set; } public string PURGRP { get; set; }
public string ORDTYPE { get; set; } public string ORDTYPE { get; set; }

Loading…
Cancel
Save