Browse Source

北汽订单导入新规则 不同订单号导入

master
qian 4 months ago
parent
commit
6969f554f7
  1. 107
      北京北汽/Controller/SCP_PO_CONTROLLER.cs
  2. 17
      北京北汽/SCP/Views/PlanData/SCP_PO.aspx.cs
  3. 34
      北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs

107
北京北汽/Controller/SCP_PO_CONTROLLER.cs

@ -1368,19 +1368,91 @@ namespace CK.SCP.Controller
ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单截止日期必须大于等于2049年!", p_excel., p_excel., p_excel.)); ErrorList.Add(string.Format("订单编号【{2}】零件名称【{0}】供应编码【{1}】的订单截止日期必须大于等于2049年!", p_excel., p_excel., p_excel.));
} }
} }
string _ponumber = p_excel..ToUpper() + subsite.Substring(1, 1) + subsite.Substring(3, 1); if (!string.IsNullOrEmpty(subsite))
if (p_excel..ToUpper() != _ponumber.ToUpper())
{ {
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel., p_excel., p_excel.)); switch (subsite)
{
case "BJ01":
string bj01ponum = p_excel..ToUpper() + "J1";
string bj01newponum = p_excel..ToUpper() + "B1";
if (p_excel..ToUpper() != bj01ponum.ToUpper() && p_excel..ToUpper() != bj01newponum.ToUpper())
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel., p_excel., p_excel.));
}
break;
case "BJ02":
string bj02ponum = p_excel..ToUpper() + "J2";
string bj02newponum = p_excel..ToUpper() + "B2";
if (p_excel..ToUpper() != bj02ponum.ToUpper() && p_excel..ToUpper() != bj02newponum.ToUpper())
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel., p_excel., p_excel.));
}
break;
case "CQ01":
string cq01ponum = p_excel..ToUpper() + "Q1";
string cq01newponum = p_excel..ToUpper() + "Q2";
if (p_excel..ToUpper() != cq01ponum.ToUpper() || p_excel..ToUpper() != cq01newponum.ToUpper())
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel., p_excel., p_excel.));
}
break;
case "ZZ01":
string zz01ponum = p_excel..ToUpper() + "Z1";
string zz01newponum = p_excel..ToUpper() + "Z2";
if (p_excel..ToUpper() != zz01ponum.ToUpper() && p_excel..ToUpper() != zz01newponum.ToUpper())
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel., p_excel., p_excel.));
}
break;
case "HF01":
string hf01ponum = p_excel..ToUpper() + "F1";
string hf01newponum = p_excel..ToUpper() + "F2";
if (p_excel..ToUpper() != hf01ponum.ToUpper() && p_excel..ToUpper() != hf01newponum.ToUpper())
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel., p_excel., p_excel.));
}
break;
}
} }
else
{
string _ponumber = p_excel..ToUpper() + subsite.Substring(1, 1) + subsite.Substring(3, 1);
if (p_excel..ToUpper() != _ponumber.ToUpper())
{
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】零件号【{2}】的订单编号不正确,请更换订单编号!", p_excel., p_excel., p_excel.));
}
}
int _polinr = Int32.Parse(p_excel.); int _polinr = Int32.Parse(p_excel.);
var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel. && p.PartCode == p_excel..Trim() && p.PoLine != _polinr).ToList(); if (string.IsNullOrEmpty(subsite))
if (_partlist.Count > 0)
{ {
ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】已经存在(系统:行号-【{2}】),请更换零件号!", p_excel., p_excel., _partlist[0].PoLine)); var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel. && p.PartCode == p_excel..Trim() && p.PoLine != _polinr).ToList();
if (_partlist.Count > 0)
{
ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】已经存在(系统:行号-【{2}】),请更换零件号!", p_excel., p_excel., _partlist[0].PoLine));
}
} }
int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel..Trim()); // 判断北汽多次导入 是否存在零件号重复现象
else
{
var _partlist = db.V_TB_PO_DETAIL.Where(p => p.VendId == p_excel..Trim()&&p.SubSite == subsite && p.PartCode == p_excel..Trim()).ToList();
if (_partlist.Count > 0)
{
var pobillnum = db.V_TB_PO_DETAIL.FirstOrDefault(p => p.VendId == p_excel..Trim() && p.SubSite == subsite && p.PartCode == p_excel..Trim()).PoBillNum;
ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】在【{2}】中存在,请更换零件号!", p_excel., p_excel., pobillnum));
}
int lcount = db.V_TB_PO_DETAIL.Count(p => p.VendId == p_excel..Trim() && p.PoLine == _polinr && p.SubSite == subsite && p.PartCode == p_excel..Trim());
if (lcount > 0)
{
var pobillnum = db.V_TB_PO_DETAIL.FirstOrDefault(p => p.VendId == p_excel..Trim() && p.SubSite == subsite && p.PoLine == _polinr && p.PartCode == p_excel..Trim()).PoBillNum;
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】在【{2}】订单中已经存在,请更换行号!", p_excel., p_excel.,pobillnum));
}
}
int linecount = db.V_TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel..Trim());
if (linecount > 0) if (linecount > 0)
{ {
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】已经存在,请更换行号!", p_excel., p_excel.)); ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】已经存在,请更换行号!", p_excel., p_excel.));
@ -1701,10 +1773,24 @@ namespace CK.SCP.Controller
//} //}
int _polinr = Int32.Parse(p_excel.); int _polinr = Int32.Parse(p_excel.);
var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel. && p.PartCode == p_excel..Trim() && p.PoLine != _polinr).ToList();
//var _partlist = db.TB_PO_DETAIL.Where(p => p.PoBillNum == p_excel.订单编号 && p.PartCode == p_excel.零件号.Trim() && p.PoLine != _polinr).ToList();
//if (_partlist.Count > 0)
//{
// ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】已经存在(系统:行号-【{2}】),请更换零件号!", p_excel.订单编号, p_excel.零件号, _partlist[0].PoLine));
//}
var _partlist = db.V_TB_PO_DETAIL.Where(p => p.VendId == p_excel..Trim() && p.SubSite == subsite && p.PartCode == p_excel..Trim()).ToList();
if (_partlist.Count > 0) if (_partlist.Count > 0)
{ {
ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】已经存在(系统:行号-【{2}】),请更换零件号!", p_excel., p_excel., _partlist[0].PoLine)); var pobillnum = db.V_TB_PO_DETAIL.FirstOrDefault(p => p.VendId == p_excel..Trim() && p.SubSite == subsite && p.PartCode == p_excel..Trim()).PoBillNum;
ErrorList.Add(string.Format("订单编号【{0}】零件号【{1}】在【{2}】中存在,请更换零件号!", p_excel., p_excel., pobillnum));
}
int lcount = db.V_TB_PO_DETAIL.Count(p => p.VendId == p_excel..Trim() && p.PoLine == _polinr && p.SubSite == subsite && p.PartCode == p_excel..Trim());
if (lcount > 0)
{
var pobillnum = db.V_TB_PO_DETAIL.FirstOrDefault(p => p.VendId == p_excel..Trim() && p.SubSite == subsite && p.PoLine == _polinr && p.PartCode == p_excel..Trim()).PoBillNum;
ErrorList.Add(string.Format("订单编号【{0}】行号【{1}】在【{2}】订单中已经存在,请更换行号!", p_excel., p_excel., pobillnum));
} }
int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel..Trim()); int linecount = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel. && p.PoLine == _polinr && p.PartCode != p_excel..Trim());
if (linecount > 0) if (linecount > 0)
@ -3279,7 +3365,7 @@ namespace CK.SCP.Controller
_lst.ForEach _lst.ForEach
(p => (p =>
{ {
var _ls = CheckExcelMode_Po(db, p, p_modtype,site); var _ls = CheckExcelMode_Po(db, p, p_modtype,site,subsite);
if (_ls.Count > 0) if (_ls.Count > 0)
{ {
lineError.Add(number.ToString()); lineError.Add(number.ToString());
@ -3753,6 +3839,7 @@ namespace CK.SCP.Controller
p_order_list.ForEach(p => p_order_list.ForEach(p =>
{ {
// 导入规则校验
var _ls = CheckExcelMode_Po(db, p, p_modtype, site, subsite); var _ls = CheckExcelMode_Po(db, p, p_modtype, site, subsite);
if (_ls.Count > 0) if (_ls.Count > 0)
{ {

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

@ -251,14 +251,27 @@ namespace SCP.PlanData
{ {
// 行号去重 // 行号去重
List<string> polineList = list.Select(a => a..Trim()).Distinct().ToList(); List<string> polineList = list.Select(a => a..Trim()).Distinct().ToList();
if (polineList.Count() == 0)
{
Alert.Show("行号不允许为空!");
FileUp.Reset();
return;
}
if (polineList.Count() != list.Count()) if (polineList.Count() != list.Count())
{ {
Alert.Show("行号不允许重复!"); Alert.Show("行号不允许重复或为空!");
FileUp.Reset();
return;
}
int maxline = int.Parse(polineList.Max());
if (maxline > 999)
{
Alert.Show("行号不允许超过999!");
FileUp.Reset(); FileUp.Reset();
return; return;
} }
} }
var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.SubSiteList[0]); var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.UserdSite);
if (checkret.State == ReturnStatus.Failed && checkret.Result == false) if (checkret.State == ReturnStatus.Failed && checkret.Result == false)
{ {
Alert.Show(string.Join("<br>", checkret.MessageList)); Alert.Show(string.Join("<br>", checkret.MessageList));

34
北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs

@ -98,6 +98,7 @@ namespace SCP.Views.PlanData
_entity.UserInAddress = CurrentUser.FactoryList; _entity.UserInAddress = CurrentUser.FactoryList;
_entity.UserInVendIds = CurrentUser.VenderList; _entity.UserInVendIds = CurrentUser.VenderList;
_entity.UserInSubSite = CurrentUser.SubSiteList; _entity.UserInSubSite = CurrentUser.SubSiteList;
_entity.SubSite = CurrentUser.UserdSite;
_entity.PartCode = TXT_PartCode.Text; _entity.PartCode = TXT_PartCode.Text;
SCP_PO_CONTROLLER.Get_V_TB_PO_List(_entity, (_ret) => SCP_PO_CONTROLLER.Get_V_TB_PO_List(_entity, (_ret) =>
{ {
@ -226,7 +227,38 @@ namespace SCP.Views.PlanData
FileUp.Reset(); FileUp.Reset();
return; return;
} }
var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD_CQ(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.SubSiteList[0]); if (partCodeList.Distinct().Count() != list.Count())
{
Alert.Show("零件号不允许重复!");
FileUp.Reset();
return;
}
// 日程单查看行号是否重复以及行号是否超过999行
if (p_modtype == BillModType.Contract)
{
// 行号去重
List<string> polineList = list.Select(a => a..Trim()).Distinct().ToList();
if (polineList.Count() == 0)
{
Alert.Show("行号不允许为空!");
FileUp.Reset();
return;
}
if (polineList.Count() != list.Count())
{
Alert.Show("行号不允许重复或为空!");
FileUp.Reset();
return;
}
int maxline = int.Parse(polineList.Max());
if (maxline > 999)
{
Alert.Show("行号不允许超过999!");
FileUp.Reset();
return;
}
}
var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD_CQ(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.UserdSite);
if (checkret.State == ReturnStatus.Failed && checkret.Result == false) if (checkret.State == ReturnStatus.Failed && checkret.Result == false)
{ {
Alert.Show(string.Join("<br>", checkret.MessageList)); Alert.Show(string.Join("<br>", checkret.MessageList));

Loading…
Cancel
Save