|
@ -169,10 +169,10 @@ namespace CK.SCP.Controller |
|
|
{ |
|
|
{ |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
{ |
|
|
{ |
|
|
return db.TA_ASK_SUBPART.Where(p=>p.AskBillNum==ASK&&string.IsNullOrEmpty(p.VendBatch)).ToList(); |
|
|
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 ) |
|
|
public static ResultObject<bool> Update_User_ErrorCount(string p_userName, int count) |
|
|
{ |
|
|
{ |
|
|
ResultObject<bool> _ret = new ResultObject<bool>(); |
|
|
ResultObject<bool> _ret = new ResultObject<bool>(); |
|
|
try |
|
|
try |
|
@ -183,7 +183,7 @@ namespace CK.SCP.Controller |
|
|
if (user != null) |
|
|
if (user != null) |
|
|
{ |
|
|
{ |
|
|
user.ErrorCount = user.ErrorCount + 1; |
|
|
user.ErrorCount = user.ErrorCount + 1; |
|
|
if(user.ErrorCount== count) |
|
|
if (user.ErrorCount == count) |
|
|
{ |
|
|
{ |
|
|
user.Enabled = false; |
|
|
user.Enabled = false; |
|
|
_ret.Message = $"密码错误超过【{count}】次,账号已锁定请联系管理员"; |
|
|
_ret.Message = $"密码错误超过【{count}】次,账号已锁定请联系管理员"; |
|
@ -377,7 +377,7 @@ namespace CK.SCP.Controller |
|
|
var sub = db.TA_SubPartCode.Where(p => p.PartCode == ak.PartCode).ToList(); |
|
|
var sub = db.TA_SubPartCode.Where(p => p.PartCode == ak.PartCode).ToList(); |
|
|
if (sub.Count() > 0) |
|
|
if (sub.Count() > 0) |
|
|
{ |
|
|
{ |
|
|
foreach(var su in sub) |
|
|
foreach (var su in sub) |
|
|
{ |
|
|
{ |
|
|
TA_ASK_SUBPART subpart = new TA_ASK_SUBPART(); |
|
|
TA_ASK_SUBPART subpart = new TA_ASK_SUBPART(); |
|
|
subpart.PartCode = su.PartCode; |
|
|
subpart.PartCode = su.PartCode; |
|
@ -1359,7 +1359,7 @@ namespace CK.SCP.Controller |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
var ret= db.TB_ASK.Where(p => p.AskBillNum == p_entitys.AskBillNum).FirstOrDefault(); |
|
|
var ret = db.TB_ASK.Where(p => p.AskBillNum == p_entitys.AskBillNum).FirstOrDefault(); |
|
|
ret.Extend1 = p_entitys.Extend1; |
|
|
ret.Extend1 = p_entitys.Extend1; |
|
|
|
|
|
|
|
|
db.TB_ASK.AddOrUpdate(ret); |
|
|
db.TB_ASK.AddOrUpdate(ret); |
|
@ -1685,10 +1685,10 @@ namespace CK.SCP.Controller |
|
|
{ |
|
|
{ |
|
|
_tDetail.VendBatch = itm.VendBatch; |
|
|
_tDetail.VendBatch = itm.VendBatch; |
|
|
} |
|
|
} |
|
|
var subpart = db.TA_ASK_SUBPART.Where(p=>p.PartCode== itm.PartCode&&p.AskBillNum==itm.AskBillNum).ToList(); |
|
|
var subpart = db.TA_ASK_SUBPART.Where(p => p.PartCode == itm.PartCode && p.AskBillNum == itm.AskBillNum).ToList(); |
|
|
string str1 = ""; |
|
|
string str1 = ""; |
|
|
string str2 = ""; |
|
|
string str2 = ""; |
|
|
foreach(var sub in subpart) |
|
|
foreach (var sub in subpart) |
|
|
{ |
|
|
{ |
|
|
string str = sub.SubPartCode + "," + sub.BOMedtiton + "," + sub.VendBatch + "#"; |
|
|
string str = sub.SubPartCode + "," + sub.BOMedtiton + "," + sub.VendBatch + "#"; |
|
|
str2 = str2 + sub.VendBatch; |
|
|
str2 = str2 + sub.VendBatch; |
|
@ -1736,17 +1736,17 @@ namespace CK.SCP.Controller |
|
|
uni.Batch = _tDetail.Batch; |
|
|
uni.Batch = _tDetail.Batch; |
|
|
uni.Qty = _tDetail.Qty; |
|
|
uni.Qty = _tDetail.Qty; |
|
|
uni.State = 2; |
|
|
uni.State = 2; |
|
|
uni.CreateOper=_t.CreateUser; |
|
|
uni.CreateOper = _t.CreateUser; |
|
|
uni.CreateTime = DateTime.Now; |
|
|
uni.CreateTime = DateTime.Now; |
|
|
uni.PutTime= DateTime.Now; |
|
|
uni.PutTime = DateTime.Now; |
|
|
uni.VendId = _t.VendId; |
|
|
uni.VendId = _t.VendId; |
|
|
uni.PoUnit = _tDetail.PoUnit; |
|
|
uni.PoUnit = _tDetail.PoUnit; |
|
|
uni.LocUnit = _tDetail.PoUnit; |
|
|
uni.LocUnit = _tDetail.PoUnit; |
|
|
uni.ValidDate= DateTime.Now; |
|
|
uni.ValidDate = DateTime.Now; |
|
|
uni.ErpBillNum = _tDetail.PoBillNum; |
|
|
uni.ErpBillNum = _tDetail.PoBillNum; |
|
|
uni.ErpLineNum = _tDetail.PoLine; |
|
|
uni.ErpLineNum = _tDetail.PoLine; |
|
|
uni.VendBatch = sub.VendBatch; |
|
|
uni.VendBatch = sub.VendBatch; |
|
|
uni.PackQty= _tDetail.Qty; |
|
|
uni.PackQty = _tDetail.Qty; |
|
|
uni.Price = _tDetail.Price; |
|
|
uni.Price = _tDetail.Price; |
|
|
uni.UmConv = 1; |
|
|
uni.UmConv = 1; |
|
|
uni.Buyer = _t.ShipUser; |
|
|
uni.Buyer = _t.ShipUser; |
|
@ -1852,7 +1852,7 @@ namespace CK.SCP.Controller |
|
|
{ |
|
|
{ |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
{ |
|
|
{ |
|
|
var po = db.TB_PO.FirstOrDefault(p=>p.PoBillNum==p_ask.PoBillNum); |
|
|
var po = db.TB_PO.FirstOrDefault(p => p.PoBillNum == p_ask.PoBillNum); |
|
|
TB_ASN _t = new TB_ASN(); |
|
|
TB_ASN _t = new TB_ASN(); |
|
|
_t.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode(); |
|
|
_t.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode(); |
|
|
_t.AskBillNum = p_ask.AskBillNum; |
|
|
_t.AskBillNum = p_ask.AskBillNum; |
|
@ -1893,7 +1893,7 @@ namespace CK.SCP.Controller |
|
|
_tDetail.PoLine = itm.PoLine; |
|
|
_tDetail.PoLine = itm.PoLine; |
|
|
_tDetail.PoUnit = itm.PoUnit; |
|
|
_tDetail.PoUnit = itm.PoUnit; |
|
|
_tDetail.Batch = itm.Batch; |
|
|
_tDetail.Batch = itm.Batch; |
|
|
if (itm.VendBatch=="55") |
|
|
if (itm.VendBatch == "55") |
|
|
{ |
|
|
{ |
|
|
_tDetail.VendBatch = ""; |
|
|
_tDetail.VendBatch = ""; |
|
|
} |
|
|
} |
|
@ -1902,12 +1902,12 @@ namespace CK.SCP.Controller |
|
|
_tDetail.VendBatch = itm.VendBatch; |
|
|
_tDetail.VendBatch = itm.VendBatch; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (_t.PoBillNum.Substring(0, 5) == "CYD03"&&_t.Site=="W21") |
|
|
if (_t.PoBillNum.Substring(0, 5) == "CYD03" && _t.Site == "W21") |
|
|
{ |
|
|
{ |
|
|
var podetail = db.TB_PO_DETAIL.FirstOrDefault(t=>t.PoBillNum==_t.PoBillNum&&t.PartCode==itm.PartCode&&t.PoLine==itm.PoLine); |
|
|
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.VendBatch = podetail.SubSite + "," + podetail.Extend3 + "," + itm.VendBatch + "#"; |
|
|
} |
|
|
} |
|
|
_tDetail.UpdateUser= itm.VendBatch; |
|
|
_tDetail.UpdateUser = itm.VendBatch; |
|
|
_tDetail.PackQty = itm.PackQty == 0 ? 1 : itm.PackQty; |
|
|
_tDetail.PackQty = itm.PackQty == 0 ? 1 : itm.PackQty; |
|
|
_tDetail.PartCode = itm.PartCode; |
|
|
_tDetail.PartCode = itm.PartCode; |
|
|
_tDetail.State = (int)AsnState.New; |
|
|
_tDetail.State = (int)AsnState.New; |
|
@ -1928,18 +1928,18 @@ namespace CK.SCP.Controller |
|
|
_tDetail.SubSite = itm.SubSite; |
|
|
_tDetail.SubSite = itm.SubSite; |
|
|
_tDetail.Site = itm.Site; |
|
|
_tDetail.Site = itm.Site; |
|
|
_tDetail.Extend2 = itm.ReceivedQty.ToString(); |
|
|
_tDetail.Extend2 = itm.ReceivedQty.ToString(); |
|
|
_tDetail.Remark= itm.ReceivedQty.ToString(); |
|
|
_tDetail.Remark = itm.ReceivedQty.ToString(); |
|
|
_tDetail.UpdateInfo = itm.UpdateInfo; |
|
|
_tDetail.UpdateInfo = itm.UpdateInfo; |
|
|
var partgroup = db.TA_PART.Where(p => p.PartCode == itm.PartCode).FirstOrDefault(); |
|
|
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(); |
|
|
var askdetail = db.TB_ASK_DETAIL.Where(p => p.PartCode == itm.PartCode && p.AskBillNum == itm.AskBillNum).FirstOrDefault(); |
|
|
_tDetail.Extend3 = partgroup.PartGroup; |
|
|
_tDetail.Extend3 = partgroup.PartGroup; |
|
|
_tDetail.Extend1 =po.VendId; |
|
|
_tDetail.Extend1 = po.VendId; |
|
|
if (itm.Site == "U32") |
|
|
if (itm.Site == "U32") |
|
|
{ |
|
|
{ |
|
|
var _applin = db.TA_Appliance.FirstOrDefault(p=>p.PartNumber==itm.SubSite&&p.VendID==p_ask.VendId); |
|
|
var _applin = db.TA_Appliance.FirstOrDefault(p => p.PartNumber == itm.SubSite && p.VendID == p_ask.VendId); |
|
|
if (_applin != null) |
|
|
if (_applin != null) |
|
|
{ |
|
|
{ |
|
|
var _boxtype = db.TA_BOXTYPE.FirstOrDefault(p=>p.BoxType==_applin.BoxType&&p.Enabled==true); |
|
|
var _boxtype = db.TA_BOXTYPE.FirstOrDefault(p => p.BoxType == _applin.BoxType && p.Enabled == true); |
|
|
if (_boxtype != null) |
|
|
if (_boxtype != null) |
|
|
{ |
|
|
{ |
|
|
TB_ASN_PARTBOX PARTBOX = new TB_ASN_PARTBOX(); |
|
|
TB_ASN_PARTBOX PARTBOX = new TB_ASN_PARTBOX(); |
|
@ -1947,14 +1947,14 @@ namespace CK.SCP.Controller |
|
|
PARTBOX.PartCode = itm.PartCode; |
|
|
PARTBOX.PartCode = itm.PartCode; |
|
|
PARTBOX.BoxType = _boxtype.BoxType; |
|
|
PARTBOX.BoxType = _boxtype.BoxType; |
|
|
PARTBOX.Box = Convert.ToInt32(_tDetail.Qty) / Convert.ToInt32(_tDetail.PackQty); |
|
|
PARTBOX.Box = Convert.ToInt32(_tDetail.Qty) / Convert.ToInt32(_tDetail.PackQty); |
|
|
if(Convert.ToInt32(_tDetail.Qty) % Convert.ToInt32(_tDetail.PackQty) > 0) |
|
|
if (Convert.ToInt32(_tDetail.Qty) % Convert.ToInt32(_tDetail.PackQty) > 0) |
|
|
{ |
|
|
{ |
|
|
PARTBOX.Box = PARTBOX.Box + 1; |
|
|
PARTBOX.Box = PARTBOX.Box + 1; |
|
|
} |
|
|
} |
|
|
PARTBOX.SumBox = PARTBOX.Box; |
|
|
PARTBOX.SumBox = PARTBOX.Box; |
|
|
PARTBOX.PoBillNum = _t.PoBillNum; |
|
|
PARTBOX.PoBillNum = _t.PoBillNum; |
|
|
PARTBOX.VendId = _t.VendId; |
|
|
PARTBOX.VendId = _t.VendId; |
|
|
PARTBOX.ShipTime =DateTime.Parse(_t.ShipTime.ToString()).ToShortDateString(); |
|
|
PARTBOX.ShipTime = DateTime.Parse(_t.ShipTime.ToString()).ToShortDateString(); |
|
|
PARTBOX.Batch = _tDetail.Batch; |
|
|
PARTBOX.Batch = _tDetail.Batch; |
|
|
PARTBOX.PoLine = _tDetail.PoLine; |
|
|
PARTBOX.PoLine = _tDetail.PoLine; |
|
|
PARTBOX.PackQty = _tDetail.PackQty; |
|
|
PARTBOX.PackQty = _tDetail.PackQty; |
|
@ -1966,7 +1966,7 @@ namespace CK.SCP.Controller |
|
|
var ModelList = db.TA_CarModel.ToList(); |
|
|
var ModelList = db.TA_CarModel.ToList(); |
|
|
foreach (var model in ModelList) |
|
|
foreach (var model in ModelList) |
|
|
{ |
|
|
{ |
|
|
if(model.Model.Length<=askdetail.Extend2.Length) |
|
|
if (model.Model.Length <= askdetail.Extend2.Length) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if (askdetail.Extend2.Contains(model.Model)) |
|
|
if (askdetail.Extend2.Contains(model.Model)) |
|
@ -2111,7 +2111,7 @@ namespace CK.SCP.Controller |
|
|
return p_list; |
|
|
return p_list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static List<V_TB_ASK> GET_IS_COMPLETED_SEND1(List<V_TB_ASK> p_list,string lz) |
|
|
public static List<V_TB_ASK> GET_IS_COMPLETED_SEND1(List<V_TB_ASK> p_list, string lz) |
|
|
{ |
|
|
{ |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
{ |
|
|
{ |
|
@ -2122,7 +2122,7 @@ namespace CK.SCP.Controller |
|
|
_buffer.Append($" WHERE Currency like '%{lz}%'"); |
|
|
_buffer.Append($" WHERE Currency like '%{lz}%'"); |
|
|
var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray())); |
|
|
var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray())); |
|
|
var _list = db.Database.SqlQuery<string>(_str).ToList(); |
|
|
var _list = db.Database.SqlQuery<string>(_str).ToList(); |
|
|
var ll= p_list.Where(p => _list.Contains(p.AskBillNum)).ToList(); |
|
|
var ll = p_list.Where(p => _list.Contains(p.AskBillNum)).ToList(); |
|
|
return ll; |
|
|
return ll; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -2211,7 +2211,7 @@ namespace CK.SCP.Controller |
|
|
|
|
|
|
|
|
p_list.ForEach(itm => |
|
|
p_list.ForEach(itm => |
|
|
{ |
|
|
{ |
|
|
var maxtime = db.TB_ASN_DETAIL.Where(p=>p.PartCode==itm.PartCode&&p.State>-1).Select(t=>t.ProduceDate).Max(); |
|
|
var maxtime = db.TB_ASN_DETAIL.Where(p => p.PartCode == itm.PartCode && p.State > -1).Select(t => t.ProduceDate).Max(); |
|
|
|
|
|
|
|
|
itm.MaxTime = maxtime.ToString(); |
|
|
itm.MaxTime = maxtime.ToString(); |
|
|
groupList.ForEach(p => |
|
|
groupList.ForEach(p => |
|
@ -2650,9 +2650,9 @@ namespace CK.SCP.Controller |
|
|
{ |
|
|
{ |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
using (ScpEntities db = EntitiesFactory.CreateScpInstance()) |
|
|
{ |
|
|
{ |
|
|
|
|
|
switch (p_state) |
|
|
if (p_state == AskState.Close) |
|
|
|
|
|
{ |
|
|
{ |
|
|
|
|
|
case AskState.Close: |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
if (_ls.Count > 0) |
|
|
if (_ls.Count > 0) |
|
|
{ |
|
|
{ |
|
@ -2688,14 +2688,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,不能关闭!"; |
|
|
_ret.Message = "选择的记录,不能关闭!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Complete) |
|
|
case AskState.Complete: |
|
|
|
|
|
var _ls1 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
|
|
|
int count1 = _ls1.Count(p => p.State == (int)AskState.Ship); |
|
|
|
|
|
if (count1 == _ls1.Count && _ls1.Count > 0) |
|
|
{ |
|
|
{ |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
_ls1.ForEach(p => |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Ship); |
|
|
|
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
_ls.ForEach(p => |
|
|
|
|
|
{ |
|
|
{ |
|
|
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList(); |
|
|
var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList(); |
|
|
if (_asnlist.Count > 0) |
|
|
if (_asnlist.Count > 0) |
|
@ -2711,7 +2710,7 @@ namespace CK.SCP.Controller |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls1.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2719,14 +2718,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录非已发货状态,不能关闭!"; |
|
|
_ret.Message = "选择的记录非已发货状态,不能关闭!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Confirm) |
|
|
case AskState.Confirm: |
|
|
{ |
|
|
var _ls2 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
int count2 = _ls2.Count(p => p.State == (int)AskState.Release); |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Release); |
|
|
if (count2 == _ls2.Count && _ls2.Count > 0) |
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls2.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Confirm; |
|
|
p.State = (int)AskState.Confirm; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2751,7 +2749,7 @@ namespace CK.SCP.Controller |
|
|
#endregion
|
|
|
#endregion
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls2.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2759,14 +2757,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.New) |
|
|
case AskState.New: |
|
|
{ |
|
|
var _ls3 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
int count3 = _ls3.Count(p => p.State == (int)AskState.Release); |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Release); |
|
|
if (count3 == _ls3.Count && _ls3.Count > 0) |
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls3.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.New; |
|
|
p.State = (int)AskState.New; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2774,7 +2771,7 @@ namespace CK.SCP.Controller |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls3.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2782,11 +2779,10 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是发布状态记录!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Release) |
|
|
case AskState.Release: |
|
|
{ |
|
|
var _ls4 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
foreach (var mail in _ls4) |
|
|
foreach (var mail in _ls) |
|
|
|
|
|
{ |
|
|
{ |
|
|
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL(); |
|
|
TB_SUPPLIER_MAIL mall = new TB_SUPPLIER_MAIL(); |
|
|
mall.State = 0; |
|
|
mall.State = 0; |
|
@ -2795,10 +2791,10 @@ namespace CK.SCP.Controller |
|
|
mall.Email = mail.PoBillNum; |
|
|
mall.Email = mail.PoBillNum; |
|
|
db.TB_SUPPLIER_MAIL.Add(mall); |
|
|
db.TB_SUPPLIER_MAIL.Add(mall); |
|
|
} |
|
|
} |
|
|
int count = _ls.Count(p => p.State == (int)AskState.New); |
|
|
int count4 = _ls4.Count(p => p.State == (int)AskState.New); |
|
|
if (count > 0) |
|
|
if (count4 > 0) |
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls4.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Release; |
|
|
p.State = (int)AskState.Release; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2811,7 +2807,7 @@ namespace CK.SCP.Controller |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls4.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2819,14 +2815,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是新建状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是新建状态记录!"; |
|
|
} |
|
|
} |
|
|
} |
|
|
break; |
|
|
if (p_state == AskState.Reject) |
|
|
case AskState.Reject: |
|
|
{ |
|
|
var _ls5 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
int count5 = _ls5.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
if (count5 == _ls5.Count && _ls5.Count > 0) |
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls5.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Reject; |
|
|
p.State = (int)AskState.Reject; |
|
|
p.IsDeleted = true; |
|
|
p.IsDeleted = true; |
|
@ -2844,7 +2839,7 @@ namespace CK.SCP.Controller |
|
|
//#endregion
|
|
|
//#endregion
|
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls5.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2852,15 +2847,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
case AskState.CompleteForce: |
|
|
if (p_state == AskState.CompleteForce) |
|
|
var _ls6 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
{ |
|
|
int count6 = _ls6.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
if (count6 == _ls6.Count && _ls6.Count > 0) |
|
|
int count = _ls.Count(p => p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship); |
|
|
|
|
|
if (count == _ls.Count && _ls.Count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls6.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
if (p.State == (int)AskState.Complete) |
|
|
if (p.State == (int)AskState.Complete) |
|
|
{ |
|
|
{ |
|
@ -2906,7 +2899,7 @@ namespace CK.SCP.Controller |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls6.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2914,15 +2907,13 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!"; |
|
|
_ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
case AskState.Receive: |
|
|
if (p_state == AskState.Receive) |
|
|
var _ls7 = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
{ |
|
|
int count7 = _ls7.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); |
|
|
if (count7 > 0) |
|
|
int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); |
|
|
|
|
|
if (count > 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
_ls.ForEach(p => |
|
|
_ls7.ForEach(p => |
|
|
{ |
|
|
{ |
|
|
p.State = (int)AskState.Receive; |
|
|
p.State = (int)AskState.Receive; |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
|
var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); |
|
@ -2935,7 +2926,7 @@ namespace CK.SCP.Controller |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); |
|
|
db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls7.ToArray()); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -2943,12 +2934,10 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
_ret.Message = "选择的记录,有不是新建或发布状态记录!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
case AskState.NoConfirm: |
|
|
if (p_state == AskState.NoConfirm) |
|
|
var _ls8 = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
{ |
|
|
if (_ls8.Count == 0) |
|
|
var _ls = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
|
|
|
if (_ls.Count == 0) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
var _askList = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); |
|
|
_askList.ForEach(p => |
|
|
_askList.ForEach(p => |
|
@ -2971,6 +2960,7 @@ namespace CK.SCP.Controller |
|
|
_ret.Result = false; |
|
|
_ret.Result = false; |
|
|
_ret.Message = "选择的记录已经有发货单据不能取消!"; |
|
|
_ret.Message = "选择的记录已经有发货单据不能取消!"; |
|
|
} |
|
|
} |
|
|
|
|
|
break; |
|
|
} |
|
|
} |
|
|
if (string.IsNullOrEmpty(_ret.Message)) |
|
|
if (string.IsNullOrEmpty(_ret.Message)) |
|
|
{ |
|
|
{ |
|
|