Browse Source

要货看板明细优化

master
qian 9 months ago
parent
commit
4054645063
  1. 12
      北京北汽/Controller/SCP_ASK_CONTROLLER.cs
  2. 72
      北京北汽/Controller/SCP_CONTRACT_CONTROLLER.cs
  3. 10
      北京北汽/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx
  4. 28
      北京北汽/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs
  5. 10
      北京北汽/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx
  6. 2
      北京北汽/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx.cs

12
北京北汽/Controller/SCP_ASK_CONTROLLER.cs

@ -1546,14 +1546,14 @@ namespace CK.SCP.Controller
//} //}
//list = db.V_TB_ASN_DETAIL.Where(p => p.IsDeleted == false && detail.AskBillNum == p.AskBillNum).ToList(); //list = db.V_TB_ASN_DETAIL.Where(p => p.IsDeleted == false && detail.AskBillNum == p.AskBillNum).ToList();
var asklist = p_list.Select(q => q.AskBillNum).ToList();
var asnlist = db.V_TB_ASN_DETAIL.Where(p => p.IsDeleted == false && asklist.Contains( p.AskBillNum)).ToList();
var arrlist = db.TB_ARRIVE_DETAIL.Where(pl => asklist.Contains(pl.Remark) && pl.IsDeleted == false && pl.State == (int)ArriveState.OK && pl.Qty < 0 && pl.BillType == 3).ToList();
p_list.ForEach(itm => p_list.ForEach(itm =>
{ {
var list = db.V_TB_ASN_DETAIL.Where(p => p.IsDeleted == false && itm.AskBillNum == p.AskBillNum).ToList(); //var list = db.V_TB_ASN_DETAIL.Where(p => p.IsDeleted == false && itm.AskBillNum == p.AskBillNum).ToList();
var groupList = list.GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode, p.AskBillNum }).Select( var groupList = asnlist.Where(q=>q.AskBillNum == itm.AskBillNum).GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode, p.AskBillNum }).Select(
p => new p => new
{ {
ShipSum = p.Sum(itm2 => itm2.Qty), ShipSum = p.Sum(itm2 => itm2.Qty),
@ -1569,7 +1569,7 @@ namespace CK.SCP.Controller
itm.ShippedQty = p.ShipSum; itm.ShippedQty = p.ShipSum;
} }
}); });
var list_back = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == itm.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.Qty < 0 && p.BillType == 3).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode, p.PoBillNum }).Select(p => new { BackSum = p.Sum(itm1 => itm1.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode, PoBillNum = p.Key.PoBillNum }).ToList(); var list_back = arrlist.Where(q=>q.Remark == itm.AskBillNum).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode, p.PoBillNum }).Select(p => new { BackSum = p.Sum(itm1 => itm1.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode, PoBillNum = p.Key.PoBillNum }).ToList();
list_back.ForEach(p => list_back.ForEach(p =>
{ {

72
北京北汽/Controller/SCP_CONTRACT_CONTROLLER.cs

@ -928,5 +928,77 @@ namespace CK.SCP.Controller
} }
public static List<V_TB_ASK_DETAIL> GET_CONTRACT_PRICE_LIST_BJ(List<V_TB_ASK_DETAIL> p_list)
{
if (p_list.Count > 0)
{
//var ret = Get_TB_CONTRACT_DETAIL_PRICE_List(new TB_CONTRACT_DETAIL_PRICE() { VendId = p_list[0].VendId });
//if (ret.State == ReturnStatus.Succeed)
//{
ScpEntities db = EntitiesFactory.CreateScpInstance();
string vendid = p_list[0].VendId;
List<TB_CONTRACT_DETAIL_PRICE> res = db.TB_CONTRACT_DETAIL_PRICE.Where(q => q.VendId == vendid && q.IsDeleted == false).ToList();
var p_priceList = res;
List<string> msgList = new List<string>();
var ls = from ask in p_list
join price in p_priceList on ask.PartCode equals price.PartCode
select new { VAL1 = ask, VAL2 = price };
var list = ls.Where(p => p.VAL1.BeginTime >= p.VAL2.BeginTime && p.VAL1.BeginTime <= p.VAL2.EndTime && p.VAL1.AskQty >= p.VAL2.QtyBegin && p.VAL1.AskQty < p.VAL2.QtyEnd);
var asklist = p_list.Select(q => q.AskBillNum).ToList();
var asndetaillist = db.V_TB_ASN_DETAIL.Where(pl => pl.IsDeleted == false && asklist.Contains(pl.AskBillNum)).ToList();
var arrlist = db.TB_ARRIVE_DETAIL.Where(pl => asklist.Contains(pl.Remark) && pl.IsDeleted == false && pl.State == (int)ArriveState.OK && pl.Qty < 0 && pl.BillType == 3).ToList();
p_list.ForEach(p =>
{
var _entity = list.ToList().Where(itm => itm.VAL1.PartCode == p.PartCode).FirstOrDefault();
if (_entity != null)
{
p.ContractPrice = _entity.VAL2.Price;
p.BlancePrice = p.ContractPrice - p.Price;
}
else
{
p.ContractPrice = p.Price;
p.BlancePrice = 0;
}
//var list11 = db.V_TB_ASN_DETAIL.Where(pl => pl.IsDeleted == false && p.AskBillNum == pl.AskBillNum).ToList();
var list_back = arrlist.Where(q => q.Remark == p.AskBillNum).GroupBy(pl => new { pl.Remark, pl.PoLine, pl.PartCode, pl.PoBillNum }).Select(pl => new { BackSum = pl.Sum(itm => itm.Qty), PoLine = pl.Key.PoLine, Remark = pl.Key.Remark, PartCode = pl.Key.PartCode, PoBillNum = pl.Key.PoBillNum }).ToList();
var groupList = asndetaillist.Where(q => q.AskBillNum == p.AskBillNum).GroupBy(pl => new { pl.PoBillNum, pl.PoLine, pl.PartCode, pl.AskBillNum }).Select(
pl => new
{
ShipSum = pl.Sum(itm => itm.Qty),
PoLine = pl.Key.PoLine,
PoBillNum = pl.Key.PoBillNum,
PartCode = pl.Key.PartCode,
AskBillNum = pl.Key.AskBillNum
}).ToList();
groupList.ForEach(pa =>
{
if (pa.PoBillNum == p.PoBillNum && pa.PoLine == p.PoLine && pa.PartCode == p.PartCode && pa.AskBillNum == p.AskBillNum)
{
p.ShippedQty = pa.ShipSum;
}
});
list_back.ForEach(pl =>
{
if (pl.PoBillNum == p.PoBillNum && pl.PoLine == p.PoLine && pl.PartCode == p.PartCode)
{
p.RejectQty = Math.Abs(pl.BackSum);//寄售退货数
}
});
decimal a = p.AskQty - (p.ShippedQty == null ? 0 : (decimal)p.ShippedQty) + p.RejectQty - (p.ReduceQty == null ? 0 : (decimal)p.ReduceQty);
p.CanQty = a;
});
//}
}
return p_list;
}
} }
} }

10
北京北汽/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx

@ -58,7 +58,7 @@
<f:Grid runat="server" ID="Grid_V_TB_ASK_DETAIL" <f:Grid runat="server" ID="Grid_V_TB_ASK_DETAIL"
DataKeyNames ="UID,PoBillNum,PoLine,PartCode,PartDesc1,PartDesc2,AskBillNum,AskQty,ReduceQty,ShippedQty,CanQty" DataKeyNames ="UID,PoBillNum,PoLine,PartCode,PartDesc1,PartDesc2,AskBillNum,AskQty,ReduceQty,ShippedQty,CanQty"
IsDatabasePaging="True" AllowPaging="True" PageSize="2000" OnPageIndexChange="Grid_V_TB_ASK_DETAIL_PageIndexChange" EnableCheckBoxSelect="true" IsDatabasePaging="True" AllowPaging="True" PageSize="20" OnPageIndexChange="Grid_V_TB_ASK_DETAIL_PageIndexChange" EnableCheckBoxSelect="true"
AutoScroll="True" SortField="PoLine" SortDirection="DESC" OnRowDataBound="Grid_V_TB_ASK_DETAIL_RowDataBound" EnableTextSelection="true" > AutoScroll="True" SortField="PoLine" SortDirection="DESC" OnRowDataBound="Grid_V_TB_ASK_DETAIL_RowDataBound" EnableTextSelection="true" >
<PageItems> <PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server"> <f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
@ -67,11 +67,11 @@
</f:ToolbarText> </f:ToolbarText>
<f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged" <f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged"
runat="server"> runat="server">
<f:ListItem Text="10" Value="10" /> <f:ListItem Text="20" Value="20" />
<f:ListItem Text="40" Value="40" /> <f:ListItem Text="50" Value="50" />
<f:ListItem Text="80" Value="80" /> <%--<f:ListItem Text="80" Value="80" />
<f:ListItem Text="100" Value="100" /> <f:ListItem Text="100" Value="100" />
<f:ListItem Text="200" Value="200" /> <f:ListItem Text="200" Value="200" />--%>
</f:DropDownList> </f:DropDownList>
</PageItems> </PageItems>
<Columns> <Columns>

28
北京北汽/SCP/Views/PlanData/SCP_ASK_DETAIL.aspx.cs

@ -18,6 +18,7 @@ namespace SCP.PlanData
{ {
public partial class SCP_ASK_DETAIL : PageBase public partial class SCP_ASK_DETAIL : PageBase
{ {
private List<V_TB_ASK_DETAIL> listnorequ = new List<V_TB_ASK_DETAIL>();
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
if (!IsPostBack) if (!IsPostBack)
@ -35,9 +36,10 @@ namespace SCP.PlanData
SearchV_TB_ASK_DETAIL_VIEW((ret) => SearchV_TB_ASK_DETAIL_VIEW((ret) =>
{ {
Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count(); Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count();
listnorequ = ret.ToList();
var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL); var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL);
var _ls = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(list.ToList()); var _ls = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST_BJ(list.ToList());
Grid_V_TB_ASK_DETAIL.DataSource = SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(_ls); ; Grid_V_TB_ASK_DETAIL.DataSource = _ls; //SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(_ls);
Grid_V_TB_ASK_DETAIL.DataBind(); Grid_V_TB_ASK_DETAIL.DataBind();
}); });
} }
@ -186,20 +188,36 @@ namespace SCP.PlanData
}); });
} }
public void BindDetail() public void BindDetail()
{
var _str = Request["AskBillNum"];
if (!string.IsNullOrEmpty(_str))
{ {
SearchV_TB_ASK_DETAILData((ret) => SearchV_TB_ASK_DETAILData((ret) =>
{ {
var _str= Request["AskBillNum"];
var _list = _str.Split(',').ToList(); var _list = _str.Split(',').ToList();
ret = ret.Where(p => _list.Contains(p.AskBillNum)); ret = ret.Where(p => _list.Contains(p.AskBillNum));
Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count(); Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count();
var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL); var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL);
var _ls = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(list.ToList()); var _ls = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST_BJ(list.ToList());
Grid_V_TB_ASK_DETAIL.DataSource = SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(_ls); Grid_V_TB_ASK_DETAIL.DataSource = _ls/* SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(_ls)*/;
Grid_V_TB_ASK_DETAIL.DataBind();
});
}
else
{
SearchV_TB_ASK_DETAIL_VIEW((ret) =>
{
Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count();
listnorequ = ret.ToList();
var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL);
var _ls = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST_BJ(list.ToList());
Grid_V_TB_ASK_DETAIL.DataSource = _ls; //SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(_ls);
Grid_V_TB_ASK_DETAIL.DataBind(); Grid_V_TB_ASK_DETAIL.DataBind();
}); });
} }
}
protected void btnOutput_Click(object sender, EventArgs e) protected void btnOutput_Click(object sender, EventArgs e)
{ {

10
北京北汽/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx

@ -64,7 +64,7 @@
<f:Grid runat="server" ID="Grid_V_TB_ASK_DETAIL" <f:Grid runat="server" ID="Grid_V_TB_ASK_DETAIL"
DataKeyNames ="UID,PoBillNum,PoLine,PartCode,ShippedQty,ReceivedQty,BeginTime,EndTime,PoUnit,LocUnit,Price,Currency,PackQty,UnConv,DockCode,State,Remark,CreateTime,CreateUser,UpdateTime,UpdateUser,UpdateInfo,IsDeleted,PartDesc1,CurrencyDesc,Site,VendName,PartDesc2,AskBillNum,AskQty,TempQty,ReceivedPort,ProduceDate,ReduceQty,ValidityDays,Batch,SubSite" DataKeyNames ="UID,PoBillNum,PoLine,PartCode,ShippedQty,ReceivedQty,BeginTime,EndTime,PoUnit,LocUnit,Price,Currency,PackQty,UnConv,DockCode,State,Remark,CreateTime,CreateUser,UpdateTime,UpdateUser,UpdateInfo,IsDeleted,PartDesc1,CurrencyDesc,Site,VendName,PartDesc2,AskBillNum,AskQty,TempQty,ReceivedPort,ProduceDate,ReduceQty,ValidityDays,Batch,SubSite"
IsDatabasePaging="True" AllowPaging="True" OnPageIndexChange="Grid_V_TB_ASK_DETAIL_PageIndexChange" OnRowDataBound="Grid_V_TB_ASK_DETAIL_RowDataBound" IsDatabasePaging="True" AllowPaging="True" OnPageIndexChange="Grid_V_TB_ASK_DETAIL_PageIndexChange" OnRowDataBound="Grid_V_TB_ASK_DETAIL_RowDataBound"
EnableRowSelectEvent="True" PageSize="500" AutoScroll="True" SortField="PoLine" SortDirection="DESC" AllowCellEditing="true" ClicksToEdit="1"> EnableRowSelectEvent="True" PageSize="50" AutoScroll="True" SortField="PoLine" SortDirection="DESC" AllowCellEditing="true" ClicksToEdit="1">
<PageItems> <PageItems>
<f:ToolbarSeparator ID="ToolbarSeparator1" runat="server"> <f:ToolbarSeparator ID="ToolbarSeparator1" runat="server">
</f:ToolbarSeparator> </f:ToolbarSeparator>
@ -72,9 +72,11 @@
</f:ToolbarText> </f:ToolbarText>
<f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged" <f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged"
runat="server"> runat="server">
<f:ListItem Text="50" Value="50" />
<f:ListItem Text="100" Value="500" /> <f:ListItem Text="100" Value="100" />
<f:ListItem Text="200" Value="1000" /> <f:ListItem Text="200" Value="200" />
<f:ListItem Text="500" Value="500" />
<f:ListItem Text="1000" Value="1000" />
</f:DropDownList> </f:DropDownList>
</PageItems> </PageItems>

2
北京北汽/SCP/Views/SupplierData/SCP_ASN_CREATE.aspx.cs

@ -99,7 +99,7 @@ namespace SCP.SupplierData
{ {
Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count(); Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count();
var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL); var list = SortAndPage<V_TB_ASK_DETAIL>(ret, Grid_V_TB_ASK_DETAIL);
var _ls = SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(ret.ToList()); var _ls = SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(list.ToList());
var _notifyList = new List<string>(); var _notifyList = new List<string>();
_ls.ForEach(p => _ls.ForEach(p =>
{ {

Loading…
Cancel
Save