You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
314 lines
11 KiB
314 lines
11 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using CK.SCP.Models.Enums;
|
|
using CK.SCP.Models.ScpEntity;
|
|
using CK.SCP.Utils;
|
|
using CK.SCP.Controller;
|
|
using FineUI;
|
|
using SCP.Code;
|
|
using CK.SCP.Models;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
|
|
namespace SCP.Report
|
|
{
|
|
public partial class SCP_ASK_UNCOMPLETE : PageBase
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
LoadData();
|
|
}
|
|
}
|
|
public void LoadData()
|
|
{
|
|
BindData();
|
|
BindVender(ddl_Vender);
|
|
}
|
|
public void BindData()
|
|
{
|
|
SearchV_TB_ASK_RECEIVEData((result) => {
|
|
GridINCOM.RecordCount = result.Count();
|
|
var list = SortAndPage<TB_UNCOMPLETE_TEMPASK>(result, GridINCOM);
|
|
var _ls = list.ToList();
|
|
GridINCOM.DataSource =_ls;
|
|
GridINCOM.DataBind();
|
|
});
|
|
}
|
|
public void SearchV_TB_ASK_RECEIVEData(Action<IQueryable<TB_UNCOMPLETE_TEMPASK>> p_action)
|
|
{
|
|
|
|
var VendId = Request["VendID"];
|
|
var _date = Request["Year"];
|
|
ddl_Vender.SelectedValue = VendId;
|
|
|
|
TB_UNCOMPLETE_TEMPASK _entity = new TB_UNCOMPLETE_TEMPASK();
|
|
|
|
_entity.EndTime = DateTime.Parse(_date);
|
|
if (TextBoxAskNo.Text != null)
|
|
{
|
|
_entity.AskBillNum = TextBoxAskNo.Text;
|
|
}
|
|
if (TextPartCode.Text != null)
|
|
{
|
|
_entity.PartCode = TextPartCode.Text;
|
|
}
|
|
if (!string.IsNullOrEmpty(VendId))
|
|
{
|
|
_entity.VendId = VendId;
|
|
}
|
|
if (!string.IsNullOrEmpty(TextProjectId.Text))
|
|
{
|
|
_entity.ProjectId = TextProjectId.Text;
|
|
}
|
|
_entity.Site = CurrentUser.UsedDomain;
|
|
|
|
if (CurrentUser.VenderList.Count == 1 && CurrentUser.RoleList.Count == 1)
|
|
{
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
_entity.Buyer = CurrentUser.ChineseName;
|
|
}
|
|
|
|
|
|
if (DP_RecvBeginTime.SelectedDate != null)
|
|
{
|
|
_entity.RecvBeginTime = (DateTime)DP_RecvBeginTime.SelectedDate;
|
|
}
|
|
|
|
if (DP_RecvEndTime.SelectedDate != null)
|
|
{
|
|
|
|
_entity.RecvEndTime = (DateTime)DP_RecvEndTime.SelectedDate;
|
|
}
|
|
|
|
if(!string.IsNullOrEmpty(DDL_State.SelectedValue))
|
|
{
|
|
_entity.State = int.Parse(DDL_State.SelectedValue);
|
|
}
|
|
_entity.IsDeleted = false;
|
|
SCP_REPORT_CONTROLLER.Get_TB_ASK_UNCOMPLETE_List(_entity, (_ret) =>
|
|
{
|
|
if (_ret.State == ReturnStatus.Succeed)
|
|
{
|
|
p_action(_ret.Result);
|
|
}
|
|
});
|
|
}
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
BindData();
|
|
}
|
|
protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
GridINCOM.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
|
|
BindData();
|
|
}
|
|
protected void btnOutput_Click(object sender , EventArgs e)
|
|
{
|
|
var VendId = Request["VendID"];
|
|
ddl_Vender.SelectedValue = VendId;
|
|
TB_UNCOMPLETE_TEMPASK _entity = new TB_UNCOMPLETE_TEMPASK();
|
|
|
|
_entity.PoBillNum = TextBillNo.Text;
|
|
if (TextBillTime1.SelectedDate != null)
|
|
{
|
|
_entity.BeginTime = (DateTime)TextBillTime1.SelectedDate;
|
|
}
|
|
else
|
|
{
|
|
_entity.BeginTime = DateTime.Now.AddMonths(-1);
|
|
}
|
|
if (TextBillTime2.SelectedDate != null)
|
|
{
|
|
_entity.EndTime = (DateTime)TextBillTime2.SelectedDate;
|
|
}
|
|
else
|
|
{
|
|
_entity.EndTime = DateTime.Now;
|
|
}
|
|
if (TextBoxAskNo.Text != null)
|
|
{
|
|
_entity.AskBillNum = TextBoxAskNo.Text;
|
|
}
|
|
if (TextPartCode.Text != null)
|
|
{
|
|
_entity.PartCode = TextPartCode.Text;
|
|
}
|
|
if (string.IsNullOrEmpty(ddl_Vender.SelectedValue))
|
|
{
|
|
_entity.VendId = ddl_Vender.SelectedValue;
|
|
}
|
|
if (TextProjectId.Text != null)
|
|
{
|
|
_entity.ProjectId = TextProjectId.Text;
|
|
}
|
|
_entity.Site = CurrentUser.UsedDomain;
|
|
|
|
if (CurrentUser.VenderList.Count == 1 && CurrentUser.RoleList.Count == 1)
|
|
{
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
_entity.Buyer = CurrentUser.ChineseName;
|
|
}
|
|
if (DP_RecvBeginTime.SelectedDate != null)
|
|
{
|
|
_entity.RecvBeginTime = (DateTime)DP_RecvBeginTime.SelectedDate;
|
|
}
|
|
if (DP_RecvEndTime.SelectedDate != null)
|
|
{
|
|
_entity.RecvEndTime = (DateTime)DP_RecvEndTime.SelectedDate;
|
|
}
|
|
if (!string.IsNullOrEmpty(DDL_State.SelectedValue))
|
|
{
|
|
_entity.State = int.Parse(DDL_State.SelectedValue);
|
|
}
|
|
|
|
_entity.IsDeleted = false;
|
|
SCP_REPORT_CONTROLLER.Get_TB_ASK_UNCOMPLETE_List(_entity, (ret) =>
|
|
{
|
|
if (ret.State == ReturnStatus.Succeed)
|
|
{
|
|
var _ls = ret.Result.ToList();
|
|
_ls.ForEach(p =>{
|
|
|
|
if (p.AskQty == p.ReviceQty)
|
|
{
|
|
p.State_Desc = "已到货";
|
|
}
|
|
if (p.AskQty > 0 && p.Qty == 0 && (p.ReviceQty == 0 || p.ReviceQty == null))
|
|
{
|
|
p.State_Desc = "已确认";
|
|
}
|
|
if (p.AskQty > 0 && p.Qty > 0 && (p.ReviceQty == 0 || p.ReviceQty == null))
|
|
{
|
|
p.State_Desc = "已发货";
|
|
}
|
|
if (p.ReviceQty > 0 && p.AskQty > p.ReviceQty)
|
|
{
|
|
p.State_Desc = "未全收";
|
|
}
|
|
});
|
|
|
|
Dictionary<string, string> cellheader = new Dictionary<string, string>
|
|
{
|
|
{ "State_Desc", "状态" },
|
|
{ "PoBillNum", "订单号" },
|
|
{ "AskBillNum", "要货单号" },
|
|
{ "PartCode", "零件编号" },
|
|
{ "PartDesc1", "零件名称" },
|
|
{ "PoLine", "订单行号" },
|
|
{ "AskQty", "要货数量" },
|
|
{ "Qty", "发货数量" },
|
|
{ "ReviceQty", "收货数量" },
|
|
{ "Number", "未完成数量" },
|
|
{ "BeginTime", "计划订货日期" },
|
|
{ "EndTime", "计划到货日期" },
|
|
{ "RecvTime", "最后收货日期" },
|
|
{ "Buyer", "计划员" },
|
|
};
|
|
string url = EntityListToExcel2003(cellheader, ret.Result.ToList(), "收发货统计查询");
|
|
}
|
|
});
|
|
}
|
|
protected void Grid_V_TB_ASK_RECEIVE_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
GridINCOM.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
|
|
BindData();
|
|
}
|
|
protected void btn_planner_Click(object sender, EventArgs e)
|
|
{
|
|
BindData();
|
|
}
|
|
protected void GridINCOM_RowDataBound(object sender, GridRowEventArgs e)
|
|
{
|
|
System.Web.UI.WebControls.Label _label = (System.Web.UI.WebControls.Label)GridINCOM.Rows[e.RowIndex].FindControl("State");
|
|
var itm = e.DataItem as TB_UNCOMPLETE_TEMPASK;
|
|
if (itm.AskQty == itm.ReviceQty)
|
|
{
|
|
_label.Text = "已到货";
|
|
_label.BackColor = Color.DarkGreen;
|
|
_label.ForeColor = Color.White;
|
|
}
|
|
if (itm.AskQty > 0 && itm.Qty == 0 && (itm.ReviceQty == 0|| itm.ReviceQty==null))
|
|
{
|
|
_label.Text = "已确认";
|
|
_label.BackColor = Color.Black;
|
|
_label.ForeColor = Color.White;
|
|
}
|
|
if (itm.AskQty > 0 && itm.Qty > 0 && (itm.ReviceQty == 0 || itm.ReviceQty==null))
|
|
{
|
|
_label.Text = "已发货";
|
|
_label.BackColor = Color.DarkBlue;
|
|
_label.ForeColor = Color.White;
|
|
}
|
|
if (itm.ReviceQty > 0 && itm.AskQty > itm.ReviceQty)
|
|
{
|
|
_label.Text = "未全收";
|
|
_label.BackColor = Color.DarkOliveGreen;
|
|
_label.ForeColor = Color.White;
|
|
}
|
|
}
|
|
|
|
protected void GridINCOM_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
if (CurrentUser.RoleList.Contains("供应商"))
|
|
{
|
|
if (CurrentUser.RoleList.Contains("采购员") || CurrentUser.RoleList.Contains("计划员"))
|
|
{
|
|
object[] rowDataKeys = GridINCOM.DataKeys[e.RowIndex];
|
|
string AskBillNum = rowDataKeys[1] as string;
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../PlanData/SCP_ASK_DETAIL.aspx?AskBillNum={0}", AskBillNum)));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
object[] rowDataKeys = GridINCOM.DataKeys[e.RowIndex];
|
|
string AskBillNum = rowDataKeys[1] as string;
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../PlanData/SCP_ASK_DETAIL.aspx?AskBillNum={0}", AskBillNum)));
|
|
}
|
|
}
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindData();
|
|
}
|
|
|
|
protected void btnComplete_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
|
|
|
|
//var ret = SCP_ASK_CONTROLLER.Save_ASK_MODIF_QTY(_ask, _askList);
|
|
//if (ret.State == ReturnStatus.Succeed)
|
|
//{
|
|
// if (ret.Result == true)
|
|
// {
|
|
|
|
// //if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0)
|
|
// //{
|
|
// // SCP.Common.MailManager.SendMail(_ask.VendId, string.Format("要货看板编号{0}零件信息要货数量有变更", _ask.AskBillNum), string.Format("要货看板编号{0}零件信息有变更", _ask.AskBillNum), CurrentUser.FactoryList.FirstOrDefault());
|
|
// //}
|
|
// BindData();
|
|
// Alert.Show("数量修改成功");
|
|
// }
|
|
// else
|
|
// {
|
|
// Alert.Show(string.Join("<br>", ret.MessageList));
|
|
// }
|
|
//}
|
|
}
|
|
}
|
|
}
|