From eccecb3b7c368af6257741923dc9d95eea16829c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 9 Sep 2020 13:54:57 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/SCP_PLAN_CONTROLLER.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Controller/SCP_PLAN_CONTROLLER.cs b/Controller/SCP_PLAN_CONTROLLER.cs index d50df0e..7598f01 100644 --- a/Controller/SCP_PLAN_CONTROLLER.cs +++ b/Controller/SCP_PLAN_CONTROLLER.cs @@ -1004,6 +1004,7 @@ namespace CK.SCP.Controller _extend.VendId = dr["供应商编码"].ToString(); _extend.CreateTime = DateTime.Now; _extend.Site = dr["域"].ToString(); + _extend.PoUnit = dr["单位"].ToString(); _ls.Add(_extend); } @@ -1603,6 +1604,7 @@ namespace CK.SCP.Controller _ask.BuyerPhone = p_user.CellPhone; _ask.ErpBillNum = _entity.PoBillNum; _ask.EndTime = _entity.EndTime; + _ask.SubSite = _entity.Site; _ask.CreateTime = DateTime.Now; _ask.CreateUser = p_user.Name; _ask.VendId = _entity.VendId; @@ -1649,7 +1651,8 @@ namespace CK.SCP.Controller _t_ASK_Detail.IsDeleted = false; _t_ASK_Detail.LocUnit = itm.PoUnit; _t_ASK_Detail.UnConv = 1; - _t_ASK_Detail.Remark =_ask.Site; + _t_ASK_Detail.Site =_ask.Site; + _t_ASK_Detail.SubSite = _ask.SubSite; _t_ASK_Detail.State = _ask.State; // _t_ASK_Detail.Price = string.IsNullOrEmpty(itm.) ? 0 : decimal.Parse(itm.价格); _t_ASK_Detail.GUID = Guid.NewGuid(); From b5f3fd36ee5e18518860f78a207adb87ecb9333c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 9 Sep 2020 13:57:27 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E8=B4=A2=E5=8A=A1=EF=BC=8C=E5=92=8C=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E7=89=A9=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SCP/SCP.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SCP/SCP.csproj b/SCP/SCP.csproj index b2a17a1..8f2e9ea 100644 --- a/SCP/SCP.csproj +++ b/SCP/SCP.csproj @@ -6153,6 +6153,8 @@ + + From 4d15e58893a22194c21147491b00a4febf461542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 9 Sep 2020 16:50:33 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=95=86=E8=B4=A2=E5=8A=A1=E3=80=81=E4=BE=9B=E5=BA=94=E5=95=86?= =?UTF-8?q?=E7=89=A9=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SCP/SCP.csproj | 74 ++- .../SupplierFinance/SCP_INVOICE.aspx | 161 +++++ .../SupplierFinance/SCP_INVOICE.aspx.cs | 225 +++++++ .../SCP_INVOICE.aspx.designer.cs | 314 ++++++++++ .../SupplierFinance/SCP_INVOICE_CREATE.aspx | 103 ++++ .../SCP_INVOICE_CREATE.aspx.cs | 416 +++++++++++++ .../SCP_INVOICE_CREATE.aspx.designer.cs | 143 +++++ .../SupplierFinance/SCP_INVOICE_EDIT.aspx | 152 +++++ .../SupplierFinance/SCP_INVOICE_EDIT.aspx.cs | 560 ++++++++++++++++++ .../SCP_INVOICE_EDIT.aspx.designer.cs | 359 +++++++++++ .../SupplierFinance/SCP_RECEIVE_LIST.aspx | 250 ++++++++ .../SupplierFinance/SCP_RECEIVE_LIST.aspx.cs | 512 ++++++++++++++++ .../SCP_RECEIVE_LIST.aspx.designer.cs | 395 ++++++++++++ .../SupplierLogistics/SCP_ASK.aspx | 154 +++++ .../SupplierLogistics/SCP_ASK.aspx.cs | 351 +++++++++++ .../SCP_ASK.aspx.designer.cs | 368 ++++++++++++ .../SupplierLogistics/SCP_ASK_DETAIL.aspx | 119 ++++ .../SupplierLogistics/SCP_ASK_DETAIL.aspx.cs | 144 +++++ .../SCP_ASK_DETAIL.aspx.designer.cs | 224 +++++++ .../SupplierLogistics/SCP_ASN.aspx | 129 ++++ .../SupplierLogistics/SCP_ASN.aspx.cs | 175 ++++++ .../SCP_ASN.aspx.designer.cs | 323 ++++++++++ .../SupplierLogistics/SCP_ASN_CREATE.aspx | 217 +++++++ .../SupplierLogistics/SCP_ASN_CREATE.aspx.cs | 491 +++++++++++++++ .../SCP_ASN_CREATE.aspx.designer.cs | 359 +++++++++++ .../SupplierLogistics/SCP_ASN_DETAIL.aspx | 183 ++++++ .../SupplierLogistics/SCP_ASN_DETAIL.aspx.cs | 540 +++++++++++++++++ .../SCP_ASN_DETAIL.aspx.designer.cs | 314 ++++++++++ SCP/Web.config | 12 +- 29 files changed, 7759 insertions(+), 8 deletions(-) create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.designer.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.cs create mode 100644 SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.designer.cs diff --git a/SCP/SCP.csproj b/SCP/SCP.csproj index 8f2e9ea..9c91f6b 100644 --- a/SCP/SCP.csproj +++ b/SCP/SCP.csproj @@ -4502,6 +4502,15 @@ + + + + + + + + + @@ -5580,6 +5589,69 @@ SCP_UNPAID.aspx + + SCP_INVOICE.aspx + ASPXCodeBehind + + + SCP_INVOICE.aspx + + + SCP_INVOICE_CREATE.aspx + ASPXCodeBehind + + + SCP_INVOICE_CREATE.aspx + + + SCP_INVOICE_EDIT.aspx + ASPXCodeBehind + + + SCP_INVOICE_EDIT.aspx + + + SCP_RECEIVE_LIST.aspx + ASPXCodeBehind + + + SCP_RECEIVE_LIST.aspx + + + SCP_ASK.aspx + ASPXCodeBehind + + + SCP_ASK.aspx + + + SCP_ASK_DETAIL.aspx + ASPXCodeBehind + + + SCP_ASK_DETAIL.aspx + + + SCP_ASN.aspx + ASPXCodeBehind + + + SCP_ASN.aspx + + + SCP_ASN_CREATE.aspx + ASPXCodeBehind + + + SCP_ASN_CREATE.aspx + + + SCP_ASN_DETAIL.aspx + ASPXCodeBehind + + + SCP_ASN_DETAIL.aspx + SCP_INVOICE_VIEW.aspx ASPXCodeBehind @@ -6153,8 +6225,6 @@ - - diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx new file mode 100644 index 0000000..6a46c56 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx @@ -0,0 +1,161 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_INVOICE.aspx.cs" Inherits="SCP.Views.SupplierData.SupplierFinance.SCP_INVOICE" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + <%----%> + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.cs new file mode 100644 index 0000000..6329fb9 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.cs @@ -0,0 +1,225 @@ +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.ScpEntity; +using CK.SCP.Controller; +using FineUI; +using System.Data; +using System.Drawing; + +namespace SCP.Views.SupplierData.SupplierFinance +{ + public partial class SCP_INVOICE :PageBase + { + + public void Page_Load(object sender, EventArgs e) + { + IsRoleRight(); + + if (!IsPostBack) + { + TranslatorAgents(Toolbar1); + TranslatorAgent(Grid_V_TB_INVOICE); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + TranslatorAgents(FormRow_4); + BindInvoice(); + BindVender(DDL_VEND_LIST); + } + } + + public void IsRoleRight() + { + if (CurrentUser.RoleList.Contains("采购人员")) + { + DDL_VEND_LIST.Hidden = false; + BTN_INV.Hidden = false; + } + } + + public void BindInvoice() + { + SearchInvoice(ret => { + Grid_V_TB_INVOICE.RecordCount = ret.Count(); + ret = SortAndPage(ret, Grid_V_TB_INVOICE); + + var _ls=ret.ToList(); + + Grid_V_TB_INVOICE.DataSource = ret; + Grid_V_TB_INVOICE.DataBind(); + }); + } + public void SearchInvoice(Action> p_action) + { + V_TB_INVOICE _entity = new V_TB_INVOICE(); + _entity.InvcBillNum = TXT_InvcBillNum.Text; + _entity.VendName = TXT_VendName.Text; + _entity.InvoiceNum = TXT_InvoiceNum.Text; + _entity.UserInVendIds = CurrentUser.VenderList; + + if (CurrentUser.RoleList.Contains("采购人员")) + { + if (string.IsNullOrEmpty(DDL_VEND_LIST.SelectedValue)) + { + Alert.Show("选择开票的供应商,并点击确认!"); + return; + } + var _venderId = DDL_VEND_LIST.SelectedValue; + _entity.VendId = _venderId; + } + else + { + if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count > 0) + { + _entity.VendId = CurrentUser.VenderList[0]; + } + } + if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0) + { + _entity.Site = CurrentUser.FactoryList[0]; + } + if (string.IsNullOrEmpty(_entity.VendId)) + { + return; + } + if (DP_CreateTime1.SelectedDate != null || DP_CreateTime2.SelectedDate != null || !string.IsNullOrEmpty(TXT_PO.Text) || !string.IsNullOrEmpty(TXT_ASN.Text)) + { + _entity.InvoiceList = SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_BY_TIME(DP_CreateTime1.Text, DP_CreateTime2.Text, TXT_PO.Text, TXT_ASN.Text); + } + SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_List(_entity, (ret) => + { + if (ret.State == ReturnStatus.Succeed) + { + //if (_entity.InvoiceList == null || _entity.InvoiceList.Count == 0) + //{ + // Alert.Show("未查询到符合条件的发票!"); + //} + p_action(ret.Result); + } + }); + } + protected void btnView_OnClick(object sender, EventArgs e) + { + if (Grid_V_TB_INVOICE.SelectedRowIndexArray.Length != 1) + { + Alert.Show("请选择一行要操作的记录!"); + return; + } + string roleID = GetSelectedDataKey(Grid_V_TB_INVOICE, 1); + string url = String.Format("../SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx?ID={0}", roleID); + PageContext.RegisterStartupScript(Window1.GetShowReference(url)); + } + + + //显示面板 + protected void btnShow_OnClick(object sender, EventArgs e) + { + gp1.Hidden = false; + } + //关闭面板 + protected void OnClick(object sender, EventArgs e) + { + gp1.Hidden = true; + } + + + protected void Grid_V_TB_INVOICE_PageIndexChange(object sender, FineUI.GridPageEventArgs e) + { + BindInvoice(); + } + + protected void Grid_V_TB_INVOICE_RowDoubleClick(object sender, FineUI.GridRowClickEventArgs e) + { + //string roleID = GetSelectedDataKey(Grid1, 1); + //string url = String.Format("../SupplierData/InvoiceDetail.aspx?ID={0}", roleID); + //PageContext.RegisterStartupScript(Window1.GetShowReference(url)); + } + + protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid_V_TB_INVOICE.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + BindInvoice(); + } + protected void BTN_SEARCH_Click(object sender, EventArgs e) + { + BindInvoice(); + } + //导出 + protected void btnOutput_OnClick(object sender, EventArgs e) + { + //List _ls = new List(); + //for (int i = 0, count = Grid_V_TB_INVOICE.Rows.Count; i < count; i++) + //{ + // object[] rowDataKeys = Grid_V_TB_INVOICE.DataKeys[i]; + // _ls.Add(rowDataKeys[1] as string); + //} + //DataSet ds = SCP_EXCEL_CONTROLLER.GET_INVOICE_EXECEL(_ls); + //PageBase.DataSetToExcel(ds, "财务确认"); + + int[] _selections = Grid_V_TB_INVOICE.SelectedRowIndexArray; + if (_selections.Count() == 0) + { + Alert.Show("请选择发票记录导出!"); + } + List _ls = new List(); + for (int i = 0, count = Grid_V_TB_INVOICE.Rows.Count; i < count; i++) + { + if (_selections.Contains(i)) + { + + object[] rowDataKeys = Grid_V_TB_INVOICE.DataKeys[i]; + _ls.Add(rowDataKeys[1] as string); + } + } + if (_ls.Count == 0) + { + Alert.Show("请选择记录导出!"); + return; + } + DataSet ds = SCP_EXCEL_CONTROLLER.GET_INVOICE_EXECEL(_ls); + ds.Tables[1].Columns.Remove("成本价"); + PageBase.DataSetToExcel(ds, "导出发票"); + + + + } + + protected void Grid_V_TB_INVOICE_RowDataBound(object sender, GridRowEventArgs e) + { + int i = 0; + System.Web.UI.WebControls.Label _label = (System.Web.UI.WebControls.Label)Grid_V_TB_INVOICE.Rows[e.RowIndex].FindControl("Total1"); + if (!string.IsNullOrEmpty(_label.Text)) + { + try + { + if (decimal.Parse(_label.Text) < 0) + { + _label.ForeColor = Color.Red; + i++; + } + } + catch + { } + } + //if (i > 0) + //{ + // Alert.Show("请尽快处理索赔和退货数据,如果不处理新建发票将") + //} + } + + protected void BTN_INV_Click(object sender, EventArgs e) + { + BindInvoice(); + } + + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + + } + } +} + \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.designer.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.designer.cs new file mode 100644 index 0000000..b7f22dd --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE.aspx.designer.cs @@ -0,0 +1,314 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.Views.SupplierData.SupplierFinance +{ + + + public partial class SCP_INVOICE + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// PageManager1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.PageManager PageManager1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar1; + + /// + /// Button3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button3; + + /// + /// btnView 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnView; + + /// + /// btnOutput 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnOutput; + + /// + /// btnShow 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnShow; + + /// + /// DDL_VEND_LIST 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DDL_VEND_LIST; + + /// + /// BTN_INV 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BTN_INV; + + /// + /// gp1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.GroupPanel gp1; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// ckb 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.CheckBoxList ckb; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// TXT_InvcBillNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_InvcBillNum; + + /// + /// TXT_VendName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendName; + + /// + /// TXT_InvoiceNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_InvoiceNum; + + /// + /// TXT_PO 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_PO; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// TXT_Site 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Site; + + /// + /// TXT_ASN 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ASN; + + /// + /// DP_CreateTime1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_CreateTime1; + + /// + /// DP_CreateTime2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_CreateTime2; + + /// + /// FormRow_4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_4; + + /// + /// BTN_SEARCH 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BTN_SEARCH; + + /// + /// Grid_V_TB_INVOICE 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_V_TB_INVOICE; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// Total1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Total1; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + + /// + /// Window2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window2; + + /// + /// WindowUpload 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window WindowUpload; + } +} diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx new file mode 100644 index 0000000..3e045d9 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx @@ -0,0 +1,103 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_INVOICE_CREATE.aspx.cs" Inherits="SCP.Views.SupplierData.SupplierFinance.SCP_INVOICE_CREATE" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.cs new file mode 100644 index 0000000..db4f7e6 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.cs @@ -0,0 +1,416 @@ +using System; +using System.Collections.Generic; +using System.Data.Entity.Migrations; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using CK.SCP.Controller; +using CK.SCP.Models.AppBoxEntity; +using CK.SCP.Models.Enums; +using CK.SCP.Models.ScpEntity; +using CK.SCP.Utils; +using FineUI; +using NPOI.OpenXmlFormats.Dml; +using SCP.Code; +using SCP.WarehouseData; +using System.Drawing; + +namespace SCP.Views.SupplierData.SupplierFinance +{ + public partial class SCP_INVOICE_CREATE : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + IsRoleRight(); + if (!IsPostBack) + { + TranslatorAgents(Toolbar2); + TranslatorAgent(Grid_SCP_INVOICE_CREATE); + TranslatorAgents(FormRow_1); + LoadData(); + SetRoleRule(); + } + } + + public void IsRoleRight() + { + //if (!CurrentUser.RoleList.Contains("供应商")) + //{ + // Alert.Show("当前用户角色不能操作该模块!"); + // return; + //} + //if (CurrentUser.VenderList == null || CurrentUser.VenderList.Count == 0) + //{ + // Alert.Show("当前用户未选择地点!"); + // return; + //} + } + private void SetRoleRule() + { + //IsPriceVisible(Grid_SCP_INVOICE_CREATE, "合同价格"); + //IsPriceVisible(Grid_SCP_INVOICE_CREATE, "合同差额"); + IsPriceVisible(Grid_SCP_INVOICE_CREATE, "要货日期"); + } + + public void LoadData() + { + BindData(); + } + + + private void SearchData(Action> p_action) + { + V_TB_RECEIVE_LIST _entity = new V_TB_RECEIVE_LIST(); + + + if (Session["InvoiceCreateQueryParm"] != null) + { + InvoiceCreateQueryParm parm = Session["InvoiceCreateQueryParm"] as InvoiceCreateQueryParm; + + if (string.IsNullOrEmpty(parm.ReceiveID)) + + { Alert.Show("参数不正确!"); return; } + var ary = parm.ReceiveID.Split(','); + if (ary != null && ary.Length > 0) + { + _entity.UIDList = new List(); + foreach (var itm in ary) + { + _entity.UIDList.Add(long.Parse(itm)); + } + _entity.State = 1; + _entity.UserInVendIds = CurrentUser.VenderList; + SCP_RECIVECE_CONTROLLER.Get_V_TB_RECEIVE_LIST_List(_entity, (ret) => + { + if (ret.State == ReturnStatus.Succeed) + { + p_action(ret.Result); + } + }); + } + } + else + { + Alert.Show("操作超时!"); + } + + + + + } + + public void BindData() + { + SearchData(q => + { + + InvoiceCreateQueryParm parm = Session["InvoiceCreateQueryParm"] as InvoiceCreateQueryParm; + Grid_SCP_INVOICE_CREATE.RecordCount = q.Count(); + q = SortAndPage(q, Grid_SCP_INVOICE_CREATE); + // List temp = SCP_RECIVECE_CONTROLLER.Get_V_TB_RECEIVE_LIST(q.ToList()); + List temp = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(q.ToList()); + + foreach (V_TB_RECEIVE_LIST rec in temp) + { + rec.Qty = ToDecimal(rec.Qty, 2); + rec.CanQty = ToDecimal(rec.CanQty, 2); + } + + string _vendId = string.Empty; + if (CurrentUser.RoleList.Contains("采购人员")) + { + + _vendId = parm.VendId; + } + else + { + _vendId = CurrentUser.VenderList[0]; + } + //SCP_RECIVECE_CONTROLLER.Get_V_TB_RECEIVE_LIST_PRICE(_vendId, temp, (rs) => + //{ + + // if (rs.State == ReturnStatus.Succeed) + // { + // temp.ForEach(itm => + // { + // var _entityList = rs.Result.ToList().Where(p => p.PartCode == itm.PartCode && itm.CreateTime >= p.StartTime && itm.CreateTime <= p.EndTime).ToList(); + // if (_entityList.Count > 0) + // { + // var _max = _entityList.Select(p => p.UID).Max(); + // var _entity = _entityList.Where(p => p.UID == _max).FirstOrDefault(); + // if (itm.ModType == (int)BillModType.Contract) + // { + // if (CurrentUser.FactoryList.FirstOrDefault() == "CNS") + // { + // itm.Price = _entity.Amt; + // } + // else + // { + // itm.Price = itm.Price > 0 ? itm.Price : _entity.Amt; + // } + // } + // else + // { + // itm.Price = itm.Price > 0 ? itm.Price : _entity.Amt; + // } + // } + // }); + // } + //}); + + var _isall=parm.IsAll; + if(_isall=="0") + { + temp.ForEach(p => { + p.InputQty =0; + if (p.CanQty < 0) + { + p.InputQty = p.CanQty; + } + }); + } + else + { + temp.ForEach(p => { p.InputQty = p.CanQty; }); + } + + Grid_SCP_INVOICE_CREATE.DataSource = temp; + Grid_SCP_INVOICE_CREATE.DataBind(); + + }); + } + + + public decimal ToDecimal(decimal num, int scale) + { + decimal tempOdds = Math.Round(num, scale); + + return tempOdds; + } + + protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid_SCP_INVOICE_CREATE.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + BindData(); + } + //确认创建发票 + protected void btnOk_OnClick(object sender, EventArgs e) + { + if (Session["InvoiceCreateQueryParm"] != null) + { + + + InvoiceCreateQueryParm parm = Session["InvoiceCreateQueryParm"] as InvoiceCreateQueryParm; + + V_TB_INVOICE invoice = new V_TB_INVOICE(); + invoice.InvcBillNum = SCP_BILLCODE_CONTROLLER.MakeInvoiceCode(); + invoice.CreateTime = DateTime.Now; + invoice.InvoiceNum = ""; + invoice.Remark = txtRemark.Text; + invoice.CreateUser = CurrentUser.Name; + + string _VendId = parm.VendId; + string _tax = parm.Tax; + invoice.VendId = _VendId; + invoice.State = (int)InvoiceState.New; + invoice.Tax = decimal.Parse(_tax); + string _cj = parm.CJ; + string _tz = parm.TZ; + invoice.BlancePrice = decimal.Parse(_tz); + invoice.ContractPrice = decimal.Parse(_cj); + + int num = 0; + List _list = new List(); + for (int i = 0; i < Grid_SCP_INVOICE_CREATE.Rows.Count; i++) + { + object[] rowDataKeys = Grid_SCP_INVOICE_CREATE.DataKeys[i]; + string uid = rowDataKeys[0].ToString(); + var _entity = new V_TB_RECEIVE_LIST(); + _entity.UID = ConvertHelper.To(rowDataKeys[0]); + _entity.RecvBillNum = rowDataKeys[1] as string; + _entity.PoLine = ConvertHelper.To(rowDataKeys[2]); + _entity.PartCode = rowDataKeys[3] as string; + _entity.Batch = rowDataKeys[4] as string; + _entity.Qty = ConvertHelper.To(rowDataKeys[5]); + _entity.DockCode = rowDataKeys[6] as string; + _entity.Remark = rowDataKeys[7] as string; + _entity.CreateTime = ConvertHelper.To(rowDataKeys[8]); + _entity.CreateUser = rowDataKeys[9] as string; + if (string.IsNullOrEmpty(_entity.CreateUser)) + { + _entity.CreateUser = CurrentUser.Name; + } + _entity.IsDeleted = ConvertHelper.To(rowDataKeys[10]); + _entity.AsnBillNum = rowDataKeys[12] as string; + _entity.Site = rowDataKeys[13] as string; + invoice.Site = rowDataKeys[13] as string; + _entity.VendId = rowDataKeys[14] as string; + _entity.ShipTime = ConvertHelper.To(rowDataKeys[15]); + _entity.OperName = rowDataKeys[16] as string; + _entity.PartDesc1 = rowDataKeys[17] as string; + _entity.State = ConvertHelper.To(rowDataKeys[18]); + _entity.PoBillNum = rowDataKeys[19] as string; + _entity.VendName = rowDataKeys[20] as string; + _entity.Site_Desc = rowDataKeys[21] as string; + _entity.PoUnit = rowDataKeys[22] as string; + _entity.LocUnit = rowDataKeys[23] as string; + _entity.Price = ConvertHelper.To(rowDataKeys[24]); + _entity.VendBatch = rowDataKeys[25] as string; + _entity.Currency = rowDataKeys[26] as string; + _entity.BillType_DESC = rowDataKeys[27] as string; + _entity.ErpRecvBillNum= rowDataKeys[28] as string; + + + + + + + System.Web.UI.WebControls.Label _label = (System.Web.UI.WebControls.Label)Grid_SCP_INVOICE_CREATE.Rows[i].FindControl("Total1"); + _entity.CanQty = ConvertHelper.To(_label.Text);//ConvertHelper.To < Int32 >(rowDataKeys[2]); + GridRow row = Grid_SCP_INVOICE_CREATE.Rows[i]; + System.Web.UI.WebControls.TextBox txtQty = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty"); + System.Web.UI.WebControls.TextBox txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtPrice"); + System.Web.UI.WebControls.TextBox txtLineMemo = (System.Web.UI.WebControls.TextBox)row.FindControl("txtLineMemo"); + + decimal Qty = 0; + try + { + if (txtQty.Text.Trim() != "") + { + Qty = Convert.ToDecimal(txtQty.Text.Trim()); + } + } + catch + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("开票数量输入不正确")); + return; + } + + decimal Price = 0; + try + { + if (txtPrice.Text.Trim() != "") + { + Price = Convert.ToDecimal(txtPrice.Text.Trim()); + } + } + catch + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("单价输入不正确")); + return; + } + + if (Qty == 0) + { + continue; + } + if (Qty > _entity.CanQty) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("开票数量不能大于可用开票数量")); + return; + } + _entity.Qty = Qty; + _entity.Price = Price; + _entity.Remark = txtLineMemo.Text; + _list.Add(_entity); + num++; + } + if (num == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有可用的开票记录")); + return; + } + int _number = 0; + _list.ForEach(p => + { + if (p.Qty > 0) + { + _number++; + } + }); + if (_number == _list.Count) + { + string _modify = parm.Modify; + if (_modify == "1") + { + Alert.Show("有退货单未处理!"); + return; + } + } + var ret = SCP_INVOICE_CONTROLLER.CREATE_TB_INVOICE(invoice, _list); + if (ret.State == ReturnStatus.Succeed) + { + string script = $"alert(\'发票 {invoice.InvcBillNum} 生成成功\');"; + script += ActiveWindow.GetHidePostBackReference(); + PageContext.RegisterStartupScript(script); + } + } + else + { + Alert.Show("操作超时"); + } + + + } + + protected void Grid_SCP_INVOICE_CREATE_RowDataBound(object sender, GridRowEventArgs e) + { + object[] rowDataKeys = Grid_SCP_INVOICE_CREATE.DataKeys[e.RowIndex]; + + + System.Web.UI.WebControls.Label _label = (System.Web.UI.WebControls.Label)Grid_SCP_INVOICE_CREATE.Rows[e.RowIndex].FindControl("Total1"); + + var _number = ConvertHelper.To(_label.Text); + if (_number<= 0) + { + GridRow row = Grid_SCP_INVOICE_CREATE.Rows[e.RowIndex]; + System.Web.UI.WebControls.TextBox txtQty = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty"); + txtQty.ReadOnly = true; + txtQty.Enabled = false; + if (_number < 0) + { + + if (!string.IsNullOrEmpty(_label.Text)) + { + if (decimal.Parse(_label.Text) < 0) + { + _label.ForeColor = Color.Red; + } + } + } + } + } + + private decimal? GetTax() + { + decimal? strTax = null; + string name = GetIdentityName(); + User modelUsers = DB.Users.SingleOrDefault(p => p.Name == name); + VenderUsers vu = null; + TA_VENDER tv = null; + + if (modelUsers != null) + { + vu = DB.VenderUsers.SingleOrDefault(p => p.UserId == modelUsers.ID); + if (vu != null) + { + tv = SCPDB.TA_VENDER.SingleOrDefault(p => p.VendId == vu.VenderId); + + if (tv != null) + { + strTax = tv.Tax; + } + } + //_info.SupplierCode = vu.VenderId; + } + Session["InvoiceCreateQueryParm"] = null; + return strTax; + } + + + } + + + +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.designer.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.designer.cs new file mode 100644 index 0000000..b4cfb7d --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_CREATE.aspx.designer.cs @@ -0,0 +1,143 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.Views.SupplierData.SupplierFinance +{ + + + public partial class SCP_INVOICE_CREATE + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// btnOk 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnOk; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// txtRemark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextArea txtRemark; + + /// + /// Grid_SCP_INVOICE_CREATE 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_SCP_INVOICE_CREATE; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// txtPrice 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txtPrice; + + /// + /// Total1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Total1; + + /// + /// txtQty 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txtQty; + + /// + /// txtLineMemo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txtLineMemo; + } +} diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx new file mode 100644 index 0000000..1e38161 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx @@ -0,0 +1,152 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_INVOICE_EDIT.aspx.cs" Inherits="SCP.Views.SupplierData.SupplierFinance.SCP_INVOICE_EDIT" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.cs new file mode 100644 index 0000000..7f3d9ae --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.cs @@ -0,0 +1,560 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using CK.SCP.Common; +using CK.SCP.Controller; +using CK.SCP.Models.Enums; +using CK.SCP.Models.ScpEntity; +using CK.SCP.Utils; +using FineUI; +using System.Drawing; + +namespace SCP.Views.SupplierData.SupplierFinance +{ + public partial class SCP_INVOICE_EDIT : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + IsRoleRight(); + + if (!IsPostBack) + { + TranslatorAgents(Toolbar2); + TranslatorAgent(Grid1); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + TranslatorAgents(FormRow_4); + BindData(); + GetInvoice(); + SetRoleRule(); + + } + } + + public void IsRoleRight() + { + //if (!CurrentUser.RoleList.Contains("供应商")) + //{ + // Alert.Show("当前用户角色不能操作该模块!"); + // return; + //} + //if (CurrentUser.VenderList == null || CurrentUser.VenderList.Count == 0) + //{ + // Alert.Show("当前用户未选择地点!"); + // return; + //} + } + + private void SetRoleRule() + { + //IsPriceVisible(Grid1, "合同价格"); + //IsPriceVisible(Grid1, "合同差额"); + IsPriceVisible(Grid1, "要货日期"); + } + + public decimal ToDecimal(decimal num, int scale) + { + decimal tempOdds = Math.Round(num, scale); + //if (tempOdds > num) + //{ + // num = (decimal)((double)(tempOdds - (decimal)Math.Pow(10, -scale))); + //} + //else + //{ + // num = (decimal)((double)tempOdds); + //} + //return num; + return tempOdds; + } + + private void Search(Action> p_list) + { + + string id = GetQueryValue("ID"); + V_TB_INVOICE_DETAIL _tb = new V_TB_INVOICE_DETAIL(); + _tb.InvcBillNum = id; + SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_DETAIL_List(_tb, (ret) => { + + if (ret.State == ReturnStatus.Succeed) + { + p_list(ret.Result); + } + + }); + } + + public void BindData() + { + Search(ret => + { + Grid1.RecordCount = ret.Count(); + var list = SortAndPage(ret, Grid1); + //Grid1.DataSource =SCP_RECIVECE_CONTROLLER.Get_V_TB_INVOICE_LIST(list.ToList()); + List temp = SCP_RECIVECE_CONTROLLER.Get_V_TB_INVOICE_LIST(list.ToList()); + temp = SCP_CONTRACT_CONTROLLER.GET_CONTRACT_PRICE_LIST(temp); + + //decimal htjgSum = 0;//合同总价 + //decimal htceSum = 0;//合同差额 + //foreach (V_TB_INVOICE_DETAIL rec in temp) + //{ + // rec.Qty = ToDecimal(rec.Qty, 2); + // rec.CanQty = ToDecimal(rec.CanQty, 2); + + // htjgSum += rec.Qty * (rec.ContractPrice == null ? 0 : Convert.ToDecimal(rec.ContractPrice));//开票数量*合同价格 + // htceSum += rec.Qty * (rec.BlancePrice == null ? 0 : Convert.ToDecimal(rec.BlancePrice));//开票数量*合同差额 + //} + + //txtContractPrice1.Text = htjgSum.ToString(); + //txtBlancePrice1.Text = htceSum.ToString(); + GetInvoice(); + Grid1.DataSource = temp; + Grid1.DataBind(); + }); + + + } + + private void GetInvoice() + { + string id = GetQueryValue("ID"); + string vendid = ""; + if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count > 0) + { + vendid = CurrentUser.VenderList[0]; + } + + SCP_INVOICE_CONTROLLER.Get_V_TB_INVOICE_List(new V_TB_INVOICE { InvcBillNum = id, VendId = vendid }, (ret) => { + + if (ret.State == ReturnStatus.Succeed) + { + var _ls = ret.Result.ToList(); + if (_ls != null && _ls.Count > 0) + { + var _Model = _ls[0]; + Session["Invoice"] = _Model; + txtState.Text = _Model.State_DESC; + txtBillNo.Text = _Model.InvcBillNum; + txtBillTime.Text = Convert.ToDateTime(_Model.CreateTime).ToString("yyyy-MM-dd"); + txtSupplierName.Text = _Model.VendName; + txtInvoiceNumber.Text = _Model.InvoiceNum; + txtExpressNumber.Text = _Model.ExpressNum; + + dpUpdateTime.SelectedDate = _Model.UpdateTime; + txtTax.SelectedValue = _Model.Tax != null ? _Model.Tax.Value.ToString() : "0"; + txtTaxAmount.Text = _Model.TaxAmount!=null?_Model.TaxAmount.Value.ToString():"0"; + txtDiscountPrice.Text = _Model.DiscountPrice != null ? _Model.DiscountPrice.Value.ToString() : "0"; + //if (_Model.State != (int)InvoiceState.New) + //{ + txtContractPrice1.Text = _Model.ContractPrice != null ? _Model.ContractPrice.ToString() : string.Empty; + txtBlancePrice1.Text = _Model.BlancePrice != null ? _Model.BlancePrice.ToString() : string.Empty; + //} + txtAmount.Text = _Model.Amount.ToString(); + txtTotal.Text = _Model.Total != null ? _Model.Total.ToString() : string.Empty; + txtMemo.Text = _Model.Remark; + if (_Model.State == (int)InvoiceState.New || _Model.State == (int)InvoiceState.CheckFail) + { + this.btnOK.Hidden = false; + this.btnApply.Hidden = false; + this.btnReject.Hidden = false; + } + + if (_Model.State == (int)InvoiceState.Reject) + { + this.btnReject.Hidden = true; + this.btnOK.Hidden = false; + } + + //提交之后不能作废 + if (_Model.State == (int)InvoiceState.New) + { + this.btnOK.Hidden = false; + this.btnReject.Hidden = false; + } + + if (_Model.State == (int)InvoiceState.Apply) + { + this.btnOK.Hidden = false; + this.btnApply.Hidden = true;//提交申请 + this.btnReject.Hidden = true;//发票作废 + this.btnMail.Hidden = true;//寄出发票 + } + + if (_Model.State == (int)InvoiceState.Mail) + { + this.btnOK.Hidden = true;//确定修改 + this.btnApply.Hidden = true;//提交申请 + this.btnReject.Hidden = true;//发票作废 + this.btnMail.Hidden = true;//寄出发票 + + txtInvoiceNumber.Readonly = true; + txtInvoiceNumber.Required = false; + + txtExpressNumber.Readonly = true; + txtExpressNumber.Required = false; + + txtContractPrice1.Readonly = true; + txtContractPrice1.Required = false; + + txtBlancePrice1.Readonly = true; + txtBlancePrice1.Required = false; + } + + if ( _Model.State == (int)InvoiceState.FinanceFail || _Model.State == (int)InvoiceState.CheckSuccess ) + { + txtInvoiceNumber.Readonly = false; + txtInvoiceNumber.Required = true; + txtExpressNumber.Readonly = false; + txtContractPrice1.Readonly = false; + txtContractPrice1.Required = false; + txtBlancePrice1.Readonly = true; + txtBlancePrice1.Required = false; + this.btnMail.Hidden = false; + this.btnReject.Hidden = false; + this.btnOK.Hidden = false; + txtContractPrice1.Readonly = true; + txtContractPrice1.Required = false; + txtContractPrice1.Enabled = false; + txtBlancePrice1.Readonly = false; + } + if (_Model.State ==(int) InvoiceState.CheckSuccess) + { + this.btnOK.Hidden = true; + txtMemo.Enabled = false; + + for (int i = 0, count = Grid1.Rows.Count; i < count; i++) + { + object[] rowDataKeys = Grid1.DataKeys[i]; + GridRow row = Grid1.Rows[i]; + + var txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtPrice"); + var txtQty = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty"); + var txtLineMemo = (System.Web.UI.WebControls.TextBox)row.FindControl("txtLineMemo"); + + + txtPrice.ReadOnly = true; + txtPrice.Enabled = false; + txtQty.ReadOnly = true; + txtQty.Enabled = false; + txtLineMemo.ReadOnly = true; + txtLineMemo.Enabled = false; + + } + } + } + } + }); + + + } + + + protected void btnOK_Click(object sender, EventArgs e) + { + + var _invoice = Session["Invoice"] as V_TB_INVOICE; + + string InvoiceNumber = MyWebString.GetString(this.txtInvoiceNumber.Text.Trim()); + string Memo = MyWebString.GetString(this.txtMemo.Text.Trim()); + string ExpressNumber = MyWebString.GetString(this.txtExpressNumber.Text.Trim()); + string ContractPrice1 = MyWebString.GetString(this.txtContractPrice1.Text.Trim());//合同价格 + string BlancePrice1 = MyWebString.GetString(this.txtBlancePrice1.Text.Trim());//合同差额 + string DiscountPrice1 = MyWebString.GetString(this.txtDiscountPrice.Text.Trim()); + //if (_invoice.State != (int)InvoiceState.New && + // _invoice.State != (int)InvoiceState.CheckFail) + //{ + // Alert.Show(_invoice.InvcBillNum + " 不允许修改,只有状态为 " + "新建" + " 或 " + + // "采购退回" + " 才能修改"); + // return; + //} + if (!string.IsNullOrEmpty(txtTax.SelectedValue)) + { + _invoice.Tax = decimal.Parse(txtTax.SelectedValue); + } + _invoice.InvoiceNum = InvoiceNumber; + _invoice.Remark = Memo; + _invoice.ExpressNum = ExpressNumber; + + //_invoice.UpdateTime = dpUpdateTime.SelectedDate.Value; + //_invoice.State = (int)InvoiceState.Apply; + + if (string.IsNullOrEmpty(ContractPrice1)) + { + _invoice.ContractPrice = 0; + } + + if (string.IsNullOrEmpty(BlancePrice1)) + { + _invoice.BlancePrice = 0; + } + if (string.IsNullOrEmpty(DiscountPrice1)) + { + _invoice.DiscountPrice = 0; + } + if (_invoice.State == (int)InvoiceState.CheckSuccess) + { + + if (dpUpdateTime.SelectedDate == null) + { + Alert.Show("发票时间必须填写,时间为纸质发票开票时间"); + return; + } + else + { + _invoice.UpdateTime = dpUpdateTime.SelectedDate.Value; + } + } + + decimal c1; + decimal b1; + decimal d1; + if (decimal.TryParse(ContractPrice1, out c1)) + { + _invoice.ContractPrice = c1; + } + //else + //{ + // Alert.Show("折扣金额请填写数字!"); + // return; + //} + + if (decimal.TryParse(BlancePrice1, out b1)) + { + _invoice.BlancePrice = b1; + } + if (decimal.TryParse(DiscountPrice1, out d1)) + { + _invoice.DiscountPrice = d1; + } + //else + //{ + // Alert.Show("调整请填写数字!"); + // return; + //} + + + List _ls = new List(); + if (this.txtQty.ReadOnly == false) + { + + for (int i = 0, count = Grid1.Rows.Count; i < count; i++) + { + object[] rowDataKeys = Grid1.DataKeys[i]; + GridRow row = Grid1.Rows[i]; + + V_TB_INVOICE_DETAIL _entity = new V_TB_INVOICE_DETAIL(); + _entity.UID = ConvertHelper.To(rowDataKeys[0]); + _entity.InvcBillNum = rowDataKeys[1] as string; + _entity.Qty = ConvertHelper.To(rowDataKeys[2]); + _entity.CanQty = ConvertHelper.To(rowDataKeys[3]); + _entity.State = ConvertHelper.To(rowDataKeys[4]); + var txtQty = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty"); + var txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtPrice"); + var txtLineMemo = (System.Web.UI.WebControls.TextBox)row.FindControl("txtLineMemo"); + //var txtContractPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtContractPrice"); + //var txtBlancePrice = (System.Web.UI.WebControls.TextBox)row.FindControl("txtBlancePrice"); + + decimal QtyNew = 0; + try + { + if (txtQty.Text.Trim() != "") + { + QtyNew = Convert.ToDecimal(txtQty.Text.Trim()); + } + } + catch + { + Alert.Show("开票数量输入不正确"); + return; + } + + if (QtyNew > _entity.CanQty + _entity.Qty) + { + Alert.Show("开票数量不能大于可用开数票"); + return; + + } + + decimal PriceNew = 0; + try + { + if (txtPrice.Text.Trim() != "") + { + PriceNew = Convert.ToDecimal(txtPrice.Text.Trim()); + } + } + catch + { + Alert.Show("单价输入不正确"); + return; + } + _entity.Remark = txtLineMemo.Text; + _entity.Price = PriceNew; + _entity.Qty = QtyNew; + _ls.Add(_entity); + + } + } + + // SCPDB.Database.SqlQuery("select * from V_TB_INVOICE WHERE STATE==0 AND ").ToArray + + if (_ls.Count > 0) + { + var ret = SCP_INVOICE_CONTROLLER.SAVE_TB_INVOICE_APPLY(_invoice,_ls); + if (ret.State == ReturnStatus.Succeed) + { + + Alert.Show("发票明细修改成功!"); + + BindData(); + } + } + else + { + Alert.Show("更改记录数为零"); + } + + } + private void SET_INVOICE_STATE(string p_msg, InvoiceState p_state) + { + if (Session["Invoice"] != null) + { + var _Invoice = Session["Invoice"] as V_TB_INVOICE; + + string InvoiceNumber = MyWebString.GetString(this.txtInvoiceNumber.Text.Trim());//金税票号 + string ExpressNumber = MyWebString.GetString(this.txtExpressNumber.Text.Trim());//快递单号 + + string ContractPrice1 = MyWebString.GetString(this.txtContractPrice1.Text.Trim());//合同价格 + string BlancePrice1 = MyWebString.GetString(this.txtBlancePrice1.Text.Trim());//合同差额 + string DiscountPrice1 = MyWebString.GetString(this.txtDiscountPrice.Text.Trim()); + _Invoice.InvoiceNum = InvoiceNumber; + _Invoice.ExpressNum = ExpressNumber; + _Invoice.UpdateTime = dpUpdateTime.SelectedDate; + if (string.IsNullOrEmpty(ContractPrice1)) + { + _Invoice.ContractPrice = 0; + } + if (string.IsNullOrEmpty(BlancePrice1)) + { + _Invoice.BlancePrice = 0; + } + + decimal c1; + decimal b1; + decimal d1; + if (decimal.TryParse(ContractPrice1, out c1)) + { + _Invoice.ContractPrice = c1; + } + else + { + _Invoice.ContractPrice = 0; + } + + if (decimal.TryParse(BlancePrice1, out b1)) + { + _Invoice.BlancePrice = b1; + } + else + { + _Invoice.BlancePrice = 0; + } + if (decimal.TryParse(DiscountPrice1, out d1)) + { + _Invoice.DiscountPrice = d1; + } + else + { + _Invoice.DiscountPrice = 0; + } + if (p_state == InvoiceState.Mail) + { + if (string.IsNullOrEmpty(InvoiceNumber)) + { + Alert.Show("请填写金税票号!"); + return; + } + + if (string.IsNullOrEmpty(ExpressNumber)) + { + Alert.Show("请填写快递单号!"); + return; + } + if (dpUpdateTime.SelectedDate == null) + { + Alert.Show("发票时间必须填写,时间为纸质发票开票时间"); + return; + } + } + + var ret = SCP_INVOICE_CONTROLLER.SAVE_TB_INVOICE_STATE(_Invoice, p_state,CurrentUser.ChineseName); + if (ret.State == ReturnStatus.Succeed) + { + Alert.Show(p_msg); + + BindData(); + GetInvoice(); + } + else + { + Alert.Show(ret.Message); + } + } + } + + protected void btnApply_Click(object sender, EventArgs e) + { + + SET_INVOICE_STATE("发票申请成功!", InvoiceState.Apply); + + } + + protected void btnMail_Click(object sender, EventArgs e) + { + SET_INVOICE_STATE("发票已经寄出!", InvoiceState.Mail); + } + + protected void btnReject_Click(object sender, EventArgs e) + { + SET_INVOICE_STATE("发票已经作废!", InvoiceState.Reject); + } + + protected void Window1_OnClose(object sender, WindowCloseEventArgs e) + { + //string id = GetQueryValue("ID"); + + //TB_INVOICE model = InvoiceController.GetDataByBillInvoiceBillNum(id); + //InvoiceController.UpdateDataRemark(e.CloseArgument, model); + + } + + protected void btnRed_Click(object sender, EventArgs e) + { + string id = GetQueryValue("ID"); + V_TB_INVOICE _tb = new V_TB_INVOICE(); + _tb.InvcBillNum = id; + var ret = SCP_INVOICE_CONTROLLER.Add_New_Red_Invoice(_tb); + + if (ret.State == ReturnStatus.Succeed) + { + BindData(); + GetInvoice(); + } + } + + protected void Grid1_RowDataBound(object sender, GridRowEventArgs e) + { + System.Web.UI.WebControls.TextBox _label = (System.Web.UI.WebControls.TextBox)Grid1.Rows[e.RowIndex].FindControl("txtQty"); + if (!string.IsNullOrEmpty(_label.Text)) + { + if (decimal.Parse(_label.Text) < 0) + { + _label.ForeColor = Color.Red; + } + } + } + } +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.designer.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.designer.cs new file mode 100644 index 0000000..8564e2a --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_INVOICE_EDIT.aspx.designer.cs @@ -0,0 +1,359 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.Views.SupplierData.SupplierFinance +{ + + + public partial class SCP_INVOICE_EDIT + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// ToolbarSeparator3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator3; + + /// + /// btnOK 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnOK; + + /// + /// btnApply 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnApply; + + /// + /// btnMail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnMail; + + /// + /// btnReject 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnReject; + + /// + /// btnRed 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnRed; + + /// + /// gp1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.GroupPanel gp1; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// txtBillNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtBillNo; + + /// + /// txtState 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtState; + + /// + /// txtBillTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtBillTime; + + /// + /// txtSupplierName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtSupplierName; + + /// + /// Label3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Label Label3; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// txtAmount 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtAmount; + + /// + /// Label1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Label Label1; + + /// + /// txtTax 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList txtTax; + + /// + /// txtTaxAmount 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtTaxAmount; + + /// + /// txtTotal 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtTotal; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// txtContractPrice1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox txtContractPrice1; + + /// + /// txtDiscountPrice 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox txtDiscountPrice; + + /// + /// txtBlancePrice1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox txtBlancePrice1; + + /// + /// txtInvoiceNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtInvoiceNumber; + + /// + /// FormRow_4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_4; + + /// + /// txtExpressNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtExpressNumber; + + /// + /// dpUpdateTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker dpUpdateTime; + + /// + /// txtMemo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtMemo; + + /// + /// l1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Label l1; + + /// + /// Grid1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid1; + + /// + /// txtPrice 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txtPrice; + + /// + /// txtQty 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txtQty; + + /// + /// txtLineMemo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.TextBox txtLineMemo; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + + /// + /// WindowUpload 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window WindowUpload; + } +} diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx b/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx new file mode 100644 index 0000000..96362be --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx @@ -0,0 +1,250 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_RECEIVE_LIST.aspx.cs" Inherits="SCP.SupplierData.SupplierFinance.ReceiveList" %> + +<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %> + +<%@ Import Namespace="CK.SCP.Utils" %> +<%@ Import Namespace="CK.SCP.Models.Enums" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + <%-- + + + + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 总计: + + + 税额: + 税后金额: + + <%-- + + + --%> + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.cs new file mode 100644 index 0000000..b037bc8 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.cs @@ -0,0 +1,512 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using CK.SCP.Models.AppBoxEntity; +using CK.SCP.Models.ScpEntity; +using CK.SCP.Controller; +using FineUI; +using SCP.Code; +using System.Drawing; +using CK.SCP.Models.Enums; + +namespace SCP.SupplierData.SupplierFinance +{ + + public partial class ReceiveList : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + IsRoleRight(); + + if (!IsPostBack) + { + TranslatorAgents(Toolbar2); + TranslatorAgent(Grid_V_TB_RECEIVE_LIST); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + LoadData(); + SetRoleRule(); + BindVender(DDL_VEND_LIST); + } + } + public void IsRoleRight() + { + + //if (!CurrentUser.RoleList.Contains("供应商")) + //{ + // Alert.Show("当前用户角色不能操作该模块!"); + // return; + //} + //else + //{ + + //} + //if (CurrentUser.VenderList == null || CurrentUser.VenderList.Count == 0) + //{ + // Alert.Show("当前用户未选择地点!"); + // return; + //} + } + private void SetRoleRule() + { + if (CurrentUser.RoleList.Contains("采购人员")) + { + DDL_VEND_LIST.Hidden = false; + BTN_INV.Hidden = false; + if( CurrentUser.FactoryList!=null && CurrentUser.FactoryList.Count>0) + { + var _site= CurrentUser.FactoryList.FirstOrDefault(); + if(_site=="CNS") + { + txtContractPrice1.Enabled = false; + } + } + } + } + + public void LoadData() + { + // 每页记录数 + //Grid_V_TB_RECEIVE_LIST.PageSize = ConfigHelper.PageSize; + //ddlGridPageSize.SelectedValue = ConfigHelper.PageSize.ToString(); + //BindData(); + } + private void SearchData(Action> p_action) + { + V_TB_RECEIVE_LIST _ls = new V_TB_RECEIVE_LIST(); + _ls.PoBillNum = TXT_BillNo.Text; + _ls.VendName = TXT_VendName.Text; + + _ls.AsnBillNum = TXT_ASNBill.Text; + _ls.PartCode = TXT_PartCode.Text; + _ls.VendId = TXT_VendId.Text; + _ls.ProjectId = TXT_ProjectId.Text; + if (DP_StartDate.SelectedDate != null) + { + _ls.BeginTime = DP_StartDate.SelectedDate; + } + if (Date_EndDate.SelectedDate != null) + { + _ls.ShipTime = Date_EndDate.SelectedDate; + } + if (!string.IsNullOrEmpty(DDL_State.SelectedValue)) + { + _ls.BillType_DESC = DDL_State.SelectedValue; + } + if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0) + { + _ls.Site = CurrentUser.FactoryList[0]; + } + _ls.State = 1; + if (CurrentUser.RoleList.Contains("采购人员")) + { + if (string.IsNullOrEmpty(DDL_VEND_LIST.SelectedValue)) + { + Alert.Show("请在工具栏里选择要开票的供应商,并点击确认!"); + return; + } + var _venderId = DDL_VEND_LIST.SelectedValue; + _ls.VendId = DDL_VEND_LIST.SelectedValue; + if (!string.IsNullOrEmpty(_ls.Site) && !string.IsNullOrEmpty(_venderId)) + { + var _vender = SCP_TB_VENDER_CONTROLLER.GetVender(_venderId, _ls.Site); + if (_vender.Tax != null) + { + lbTaxRate.SelectedValue = _vender.Tax.ToString(); + } + else + { + lbTaxRate.SelectedValue = "0"; + } + } + } + else + { + if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count > 0) + { + var _venderId = CurrentUser.VenderList.FirstOrDefault(); + _ls.VendId = _venderId; + if (!string.IsNullOrEmpty(_ls.Site) && !string.IsNullOrEmpty(_venderId)) + { + var _vender = SCP_TB_VENDER_CONTROLLER.GetVender(_venderId, _ls.Site); + if (_vender.Tax != null) + { + lbTaxRate.SelectedValue = _vender.Tax.ToString(); + } + else + { + lbTaxRate.SelectedValue = _vender.Tax.ToString(); + } + } + } + } + if (string.IsNullOrEmpty(_ls.VendId)) + { + return; + } + SCP_RECIVECE_CONTROLLER.Get_V_TB_RECEIVE_LIST_List(_ls, (ret) => + { + if (ret.State == ReturnStatus.Succeed) + { + p_action(ret.Result); + } + }); + } + public void BindData() + { + SearchData(ret => + { + if (CurrentUser.RoleList.Contains("采购人员")) + { + Grid_V_TB_RECEIVE_LIST.RecordCount = ret.Count(); + ret = SortAndPage(ret, Grid_V_TB_RECEIVE_LIST,"DESC"); + + List temp = ret.ToList(); + if (string.IsNullOrEmpty(DDL_VEND_LIST.SelectedValue)) + { + Alert.Show("请在工具栏里选择要开票的供应商,并点击确认!"); + return; + } + + Grid_V_TB_RECEIVE_LIST.DataSource = temp; + Grid_V_TB_RECEIVE_LIST.DataBind(); + } + else + { + + Grid_V_TB_RECEIVE_LIST.RecordCount = ret.Count(); + ret = SortAndPage(ret, Grid_V_TB_RECEIVE_LIST,"DESC"); + List temp = ret.ToList(); + + Grid_V_TB_RECEIVE_LIST.DataSource = temp; + Grid_V_TB_RECEIVE_LIST.DataBind(); + } + }); + // 排列和数据库分页 + } + protected void Grid1_OnPageIndexChange(object sender, GridPageEventArgs e) + { + Grid_V_TB_RECEIVE_LIST.PageIndex = e.NewPageIndex; + BindData(); + } + + protected void ddlGridPageSize_OnSelectedIndexChanged(object sender, EventArgs e) + { + Grid_V_TB_RECEIVE_LIST.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + BindData(); + } + //生成发票 + protected void btnCreate_OnClick(object sender, EventArgs e) + { + CreateInvoice("0"); + } + private void CreateInvoice(string p_all) + { + try + { + + string vender = string.Empty; + if (CurrentUser.RoleList.Contains("采购人员")) + { + if (string.IsNullOrEmpty(DDL_VEND_LIST.SelectedValue)) + { + Alert.Show("请在工具栏里选择要开票的供应商,并点击确认!"); + return; + } + vender = DDL_VEND_LIST.SelectedValue; + } + else + { + vender = CurrentUser.VenderList[0]; + } + + TM_HYANTOLIN_REVIEW _entity = new TM_HYANTOLIN_REVIEW(); + _entity.UltimateName = vender; + _entity.State = 0; + var _state = 0; + SCP_QUALITY_CONTROLLER.Get_TM_HYANTOLIN_REVIEW_List(_entity, (rs) => + { + if (rs.State == ReturnStatus.Succeed) + { + var _ls = rs.Result.ToList(); + if (_ls != null && _ls.Count > 0) + { + var _sum = _ls.Sum(p => p.ClaimAmount); + var _ary = _ls.Select(p => p.ReviewBillNum).ToList(); + _state = 1; + if (_sum == 0) + { + _state = 0; + } + if (_sum > 0) + { + Alert.Show(string.Format("索赔金额合计{0}供应商存在未处理索赔单{1}!", _sum.ToString(), string.Join(",", _ary.ToArray())), "索赔管理查看"); + } + } + } + }); + if (_state == 1) + { + return; + } + var _tax = lbTaxRate.SelectedValue; + var _cj = string.IsNullOrEmpty(txtContractPrice1.Text) ? "0" : txtContractPrice1.Text; + var _tz = string.IsNullOrEmpty(txtBlancePrice1.Text) ? "0" : txtBlancePrice1.Text; + + string IsCreate = "0"; + + if (Grid_V_TB_RECEIVE_LIST.SelectedRowIndexArray.Length == 0) + { + Alert.Show("请选择要创建发票的记录!"); + return; + } + string IDS = ""; + List _list = new List(); + List _projectList = new List(); + List _rejList = new List(); + string _projectId = string.Empty; + List _recList = new List(); + List IdList = new List(); + decimal _total = 0; + + for (int i = 0; i < Grid_V_TB_RECEIVE_LIST.SelectedRowIndexArray.Length; i++) + { + int rowIndex = Grid_V_TB_RECEIVE_LIST.SelectedRowIndexArray[i]; + int ID = Convert.ToInt32(Grid_V_TB_RECEIVE_LIST.DataKeys[rowIndex][0]); + + decimal _qty = decimal.Parse(Grid_V_TB_RECEIVE_LIST.DataKeys[rowIndex][5].ToString()); + + decimal _price = decimal.Parse(Grid_V_TB_RECEIVE_LIST.DataKeys[rowIndex][6].ToString()); + + _total += (_qty * _price); + IDS += ID + ","; + _projectId = Grid_V_TB_RECEIVE_LIST.DataKeys[rowIndex][1].ToString(); + _projectList.Add(_projectId); + var _recbill = Grid_V_TB_RECEIVE_LIST.DataKeys[rowIndex][2].ToString(); + if (!string.IsNullOrEmpty(_recbill) && _recbill.IndexOf("R.") > 0) + { + _rejList.Add(_projectId); + } + IdList.Add(ID); + + + } + if (_total < 0) + { + Alert.Show("不允许开负数发票!退货、索赔零件数量有问题,请联系工厂库房和质量解决!"); + return; + } + + + if (IdList.Count > 200) + { + Alert.Show("选择零件记录超过,发票允许条数!"); + return; + } + + if (_list.Distinct().Count() > 1) + { + Alert.Show("请选择的记录不是同一个供应商,请选择供应商!"); + return; + } + + + + if (IDS != "") IDS = IDS.Substring(0, IDS.Length - 1); + + if (CurrentUser.FactoryList.FirstOrDefault() != "BJCIAI") + { + var _ls = GetIsAllChecked(vender, IDS); + if (_ls.Count > 0) + { + Alert.Show(string.Format("退货或索赔单{0}未开票!", string.Join(",", _ls.ToArray()))); + return; + } + } + + + InvoiceCreateQueryParm parm = new InvoiceCreateQueryParm(); + parm.ReceiveID = IDS; + parm.VendId = vender; + parm.Modify = IsCreate; + parm.IsAll = p_all; + parm.Tax = _tax; + parm.CJ = _cj; + parm.TZ = _tz; + + Session["InvoiceCreateQueryParm"] = parm; + string ret = Window1.GetShowReference("../../Views/SupplierData/SCP_INVOICE_CREATE.aspx", "生成发票"); + PageContext.RegisterStartupScript(ret); + } + catch (Exception ex) + { + Alert.Show(ex.Message); + } + } + private List GetIsAllChecked(string p_VendId,string p_VendIds) + { + + List unSelected = new List(); + + var _ls = SCPDB.V_TB_RECEIVE_LIST.Where(p => p.VendId == p_VendId && p.State == 1 && (p.BillType_DESC == "索赔单" || p.BillType_DESC == "退货单")).Select(p => new { p.UID, p.RecvBillNum }).ToList(); + + //SCP_RECIVECE_CONTROLLER.Get_V_TB_RECEIVE_LIST_List(_ent, (ret) => + //{ + // if (ret.State == ReturnStatus.Succeed) + // { + var _lsCompare = p_VendIds.Split(new char[] { ',' }); + // var _ls = ret.Result.Select(p => new { p.UID, p.RecvBillNum }).ToList(); + foreach (var itm in _ls) + { + if (!_lsCompare.Contains(itm.UID.ToString())) + { + unSelected.Add(itm.RecvBillNum); + } + } + // } + //}); + return unSelected.Distinct().ToList(); + } + + + protected void Grid_V_TB_RECEIVE_LIST_PageIndexChange(object sender, GridPageEventArgs e) + { + BindData(); + } + + //导出 + protected void btnOutput_OnClick(object sender, EventArgs e) + { + V_TB_RECEIVE_LIST _ls = new V_TB_RECEIVE_LIST(); + _ls.PoBillNum = TXT_BillNo.Text; + _ls.VendName = TXT_VendName.Text; + _ls.UserInVendIds = CurrentUser.VenderList; + _ls.AsnBillNum = TXT_ASNBill.Text; + _ls.PartCode = TXT_PartCode.Text; + _ls.VendId = TXT_VendId.Text; + _ls.ProjectId = TXT_ProjectId.Text; + _ls.RecvBillNum = TXT_RECEIVE.Text; + if (DP_StartDate.SelectedDate != null) + { + _ls.BeginTime = DP_StartDate.SelectedDate; + } + if (Date_EndDate.SelectedDate != null) + { + _ls.ShipTime = Date_EndDate.SelectedDate; + } + if (!string.IsNullOrEmpty(DDL_State.SelectedValue)) + { + _ls.BillType_DESC = DDL_State.SelectedValue; + } + if (CurrentUser.FactoryList != null && CurrentUser.FactoryList.Count > 0) + { + _ls.Site = CurrentUser.FactoryList[0]; + } + _ls.State = 1; + if (CurrentUser.VenderList != null && CurrentUser.VenderList.Count > 0) + { + var _venderId = CurrentUser.VenderList.FirstOrDefault(); + if (!string.IsNullOrEmpty(_ls.Site) && !string.IsNullOrEmpty(_venderId)) + { + var _vender = SCP_TB_VENDER_CONTROLLER.GetVender(_venderId, _ls.Site); + if (_vender.Tax != null) + { + lbTaxRate.SelectedValue = _vender.Tax.ToString(); + } + else + { + lbTaxRate.Text = "0"; + } + } + } + + SCP_RECIVECE_CONTROLLER.Get_V_TB_RECEIVE_LIST_List(_ls, (ret) => + { + if (ret.State == ReturnStatus.Succeed) + { + var _lst = ret.Result.ToList(); + + Dictionary cellheader = new Dictionary + { + { "ProjectId", "项目编号" }, + { "BillType_DESC", "单据类型" }, + { "RecvBillNum", "单据编号" }, + { "AsnBillNum", "发货单号" }, + { "VendName", "供应商" }, + { "VendId", "供应商编码" }, + { "PoBillNum", "订单号" }, + { "PoLine", "订单行" }, + { "PartCode", "零件号" }, + { "PartDesc1", "零件名称" }, + { "LocUnit", "单位" }, + { "Currency", "币种" }, + { "CanQty", "可开票数量" }, + { "Price", "单价" }, + { "CreateTime", "创建时间" } + }; + string url = EntityListToExcel2003(cellheader,_lst , "审核明细"); + } + }); + } + //快速查找 + protected void btnSearch_Click(object sender, EventArgs e) + { + + } + protected void btnShow_Click(object sender, EventArgs e) + { + gp1.Hidden = false; + } + protected void BtnClose_Click(object sender, EventArgs e) + { + gp1.Hidden = true; + } + protected void BtnSearch_Click(object sender, EventArgs e) + { + BindData(); + } + + protected void Grid_V_TB_RECEIVE_LIST_RowDataBound(object sender, GridRowEventArgs e) + { + System.Web.UI.WebControls.Label _label= (System.Web.UI.WebControls.Label)Grid_V_TB_RECEIVE_LIST.Rows[e.RowIndex].FindControl("Qty1"); + if (!string.IsNullOrEmpty(_label.Text)) + { + if (decimal.Parse(_label.Text) < 0) + { + _label.ForeColor = Color.Red; + } + } + } + + protected void btnCanIn_Click(object sender, EventArgs e) + { + + } + + + + protected void BTN_INV_Click(object sender, EventArgs e) + { + BindData(); + } + + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + Session["InvoiceCreateQueryParm"] = null; + BindData(); + } + + protected void btnCreateAll_Click(object sender, EventArgs e) + { + CreateInvoice("1"); + } + + + } +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.designer.cs b/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.designer.cs new file mode 100644 index 0000000..d3d9b40 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierFinance/SCP_RECEIVE_LIST.aspx.designer.cs @@ -0,0 +1,395 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.SupplierData.SupplierFinance +{ + + + public partial class ReceiveList + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button1; + + /// + /// btnCreate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnCreate; + + /// + /// btnCreateAll 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnCreateAll; + + /// + /// btn 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btn; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button2; + + /// + /// btnCanIn 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnCanIn; + + /// + /// btnShow 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnShow; + + /// + /// tb_RecvBillNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox tb_RecvBillNum; + + /// + /// btn_Search 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btn_Search; + + /// + /// DDL_VEND_LIST 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DDL_VEND_LIST; + + /// + /// BTN_INV 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BTN_INV; + + /// + /// gp1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.GroupPanel gp1; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// TXT_BillNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_BillNo; + + /// + /// TXT_ASNBill 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ASNBill; + + /// + /// TXT_VendName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendName; + + /// + /// TXT_VendId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendId; + + /// + /// DDL_State 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DDL_State; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// TXT_ProjectId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ProjectId; + + /// + /// TXT_PartCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_PartCode; + + /// + /// DP_StartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_StartDate; + + /// + /// Date_EndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker Date_EndDate; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// TXT_RECEIVE 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_RECEIVE; + + /// + /// BtnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BtnClose; + + /// + /// BtnSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BtnSearch; + + /// + /// FormRow1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow1; + + /// + /// txtContractPrice1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox txtContractPrice1; + + /// + /// txtBlancePrice1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox txtBlancePrice1; + + /// + /// FormRow2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow2; + + /// + /// lbTaxRate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList lbTaxRate; + + /// + /// btnTax 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnTax; + + /// + /// Grid_V_TB_RECEIVE_LIST 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_V_TB_RECEIVE_LIST; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// Qty1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label Qty1; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + } +} diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx new file mode 100644 index 0000000..e3d507e --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx @@ -0,0 +1,154 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_ASK.aspx.cs" Inherits="SCP.Views.SupplierData.SupplierLogistics.SCP_ASK" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.cs new file mode 100644 index 0000000..da25743 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.cs @@ -0,0 +1,351 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Linq; +using System.Linq.Expressions; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using CK.SCP.Models; +using CK.SCP.Models.AppBoxEntity; +using CK.SCP.Models.Enums; +using CK.SCP.Models.ScpEntity; +using CK.SCP.Utils; +using CK.SCP.Common; +using CK.SCP.Controller; +using EntityFramework.Audit; +using FineUI; +using Microsoft.Diagnostics.Instrumentation.Extensions.Intercept; +using SCP.Code; +using EntitiesHelper = CK.SCP.Controller.EntitiesHelper; +using System.IO; +using CK.SCP.Models.ScpEntity.ExcelImportEntity; +using System.Drawing; + +namespace SCP.Views.SupplierData.SupplierLogistics +{ + public partial class SCP_ASK : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + BindAsk(); + CheckRolesMenu(); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + TranslatorAgent(Grid_V_TB_ASK); + TranslatorAgents(Toolbar2); + } + } + //public void LoadData() + //{ + // BindAsk(); + //} + public void BindAsk() + { + SearchV_TB_ASKData((result) => { + Grid_V_TB_ASK.RecordCount = result.Count(); + var list = SortAndPage(result, Grid_V_TB_ASK); + var ls=SCP_ASK_CONTROLLER.GET_IS_COMPLETED_SEND(list.ToList()); + + Grid_V_TB_ASK.DataSource = ls; + Grid_V_TB_ASK.DataBind(); + + }); + + } + private void CheckRolesMenu() + { + if (CurrentUser.RoleList.Contains("采购人员")) + { + btnOutput.Hidden = false; + btnDetail.Hidden = false; + this.BtnSearch.Hidden = false; + //this.btnEdit.Hidden = true; + } + else + { + foreach (var itm in Grid_V_TB_ASK.Columns) + { + if (itm.HeaderText == "要货数量") + { + itm.Enabled = false; + } + } + btnOutput.Hidden = false; + btnDetail.Hidden = true; + this.BtnSearch.Hidden = true; + this.btnShow.Hidden = true; + } + } + public void SearchV_TB_ASKData(Action> p_action) + { + var ls = SCPDB.TB_FACTORY.Where(p => p.ErpDomain == CurrentUser.UsedDomain).ToList(); + DropDownList1.DataSource = ls; + DropDownList1.DataBind(); + V_TB_ASK _entity = new V_TB_ASK(); + _entity.IsDeleted = false; + _entity.PoBillNum = TXT_BillNo.Text; + _entity.VendId = TXT_VendId.Text; + _entity.State_DESC = TXT_Site_Desc.Text; + _entity.AskBillNum = TXT_AskBillNo.Text; + _entity.ErpBillNum = TXT_ProjectId.Text; + _entity.SubSite = DropDownList1.SelectedValue; + _entity.Extend1 = TXT_Extend1.Text; + _entity.Extend2 = TXT_Extend2.Text; + _entity.Extend3 = TXT_Extend3.Text; + if (DP_StartDate.SelectedDate != null) + { + _entity.BeginTime = DP_StartDate.SelectedDate; + } + if (DP_StartDate.SelectedDate != null) + { + _entity.EndTime = DP_StartDate.SelectedDate; + } + if (!string.IsNullOrEmpty(DDL_State.SelectedValue)) + { + _entity.BillStateList = new List() { int.Parse(DDL_State.SelectedValue) }; + } + _entity.UserInAddress = CurrentUser.FactoryList; + + if (CurrentUser.RoleList.Contains("供应商")) + { + if (CurrentUser.VenderList == null && CurrentUser.VenderList.Count == 0) + { + CurrentUser.VenderList = new List() { "00000000000" }; + } + _entity.UserInVendIds = CurrentUser.VenderList; + } + //if (CurrentUser.RoleList.Contains("供应商")) + //{ + // _entity.BillStateList = new List { (int)AskState.Confirm, (int)AskState.Release, (int)AskState.Ship, (int)AskState.Receive }; + //} + + SCP_ASK_CONTROLLER.Get_V_TB_ASK_List(_entity, (_ret) => { + if (_ret.State == ReturnStatus.Succeed) + { + p_action(_ret.Result); + } + }); + } + + protected void Grid_V_TB_ASK_RowDoubleClick(object sender, FineUI.GridRowClickEventArgs e) + { + object[] rowDataKeys = Grid_V_TB_ASK.DataKeys[e.RowIndex]; + string AskBillNum = rowDataKeys[2] as string; + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASK_DETAIL.aspx?AskBillNum={0}", AskBillNum))); + } + + protected void Grid_V_TB_ASK_Sort(object sender, GridSortEventArgs e) + { + + } + + + protected void Grid_V_TB_ASK_PageIndexChange(object sender, GridPageEventArgs e) + { + BindAsk(); + } + + protected void btnOutput_Click(object sender, EventArgs e) + { + if (Grid_V_TB_ASK.SelectedRowIndexArray.Count() == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!")); + return; + } + List _ls = new List(); + for (int i = 0, count = Grid_V_TB_ASK.Rows.Count; i < count; i++) + { + if (Grid_V_TB_ASK.SelectedRowIndexArray.Contains(i)) + { + object[] rowDataKeys = Grid_V_TB_ASK.DataKeys[i]; + _ls.Add(rowDataKeys[2] as string); + } + } + DataSet ds = SCP_EXCEL_CONTROLLER.GET_ASK_EXECEL(_ls); + PageBase.DataSetToExcel(ds, "要货看板"); + } + + protected void btnDetail_Click(object sender, EventArgs e) + { + if (Grid_V_TB_ASK.SelectedRowIndexArray.Count() == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!")); + return; + } + object[] rowDataKeys = Grid_V_TB_ASK.DataKeys[Grid_V_TB_ASK.SelectedRowIndex]; + + string AskBillNum = rowDataKeys[2] as string; + + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASK_DETAIL.aspx?AskBillNum={0}", AskBillNum))); + } + + protected void BtnPublish_Click(object sender, EventArgs e) + { + int[] _selections = Grid_V_TB_ASK.SelectedRowIndexArray; + List _AskList = new List(); + for (int i = 0, count = Grid_V_TB_ASK.Rows.Count; i < count; i++) + { + if (_selections.Contains(i)) + { + object[] rowDataKeys = Grid_V_TB_ASK.DataKeys[i]; + if (!string.IsNullOrEmpty(rowDataKeys[2].ToString())) + { + _AskList.Add(rowDataKeys[2].ToString()); + } + } + } + var ret = SCP_ASK_CONTROLLER.Save_TB_ASK_STATE(_AskList, AskState.Release); + if (ret.State == ReturnStatus.Succeed) + { + BindAsk(); + } + else + { + Alert.Show(ret.Message); + } + } + + protected void BtnCanclePublish_Click(object sender, EventArgs e) + { + int[] _selections = Grid_V_TB_ASK.SelectedRowIndexArray; + List _AskList = new List(); + for (int i = 0, count = Grid_V_TB_ASK.Rows.Count; i < count; i++) + { + if (_selections.Contains(i)) + { + object[] rowDataKeys = Grid_V_TB_ASK.DataKeys[i]; + if (!string.IsNullOrEmpty(rowDataKeys[2].ToString())) + { + _AskList.Add(rowDataKeys[2].ToString()); + } + } + } + var ret = SCP_ASK_CONTROLLER.Save_TB_ASK_STATE(_AskList, AskState.Confirm); + if (ret.State == ReturnStatus.Succeed) + { + BindAsk(); + } + else + { + Alert.Show(ret.Message); + } + } + + protected void btnShow_Click(object sender, EventArgs e) + { + gp1.Hidden = false; + } + protected void BtnClose_Click(object sender, EventArgs e) + { + gp1.Hidden = true; + } + protected void BtnSearch_Click(object sender, EventArgs e) + { + BindAsk(); + } + protected void btnAsn_Click(object sender, EventArgs e) + { + + if (Grid_V_TB_ASK.SelectedRowIndexArray.Count() == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!")); + return; + } + object[] rowDataKeys = Grid_V_TB_ASK.DataKeys[Grid_V_TB_ASK.SelectedRowIndex]; + if (rowDataKeys.Count() > 0) + { + if (ConvertHelper.To(rowDataKeys[7]) == (int)AskState.New || ConvertHelper.To(rowDataKeys[7]) == (int)AskState.Release) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("选择记录不是供应商确认单据")); + return; + } + string AskBillNum = rowDataKeys[2] as string; + + + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASN_CREATE.aspx?AskBillNum={0}", AskBillNum))); + } + } + + protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid_V_TB_ASK.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + BindAsk(); + } + + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + if (Session["Ask"] != null) + { + Session["Ask"] = null; + } + BindAsk(); + } + + protected void Grid_V_TB_ASK_RowDataBound(object sender, GridRowEventArgs e) + { + var itm = e.DataItem as V_TB_ASK; + if (itm.IsComplete==false) + { + System.Web.UI.WebControls.Label _label = (System.Web.UI.WebControls.Label)Grid_V_TB_ASK.Rows[e.RowIndex].FindControl("State_DESC"); + // _label.Text = "发货未完"; + _label.ForeColor = Color.Red; + } + + } + + protected void btn_Click(object sender, EventArgs e) + { + if (Grid_V_TB_ASK.SelectedRowIndexArray.Count() == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!")); + return; + } + object[] rowDataKeys = Grid_V_TB_ASK.DataKeys[Grid_V_TB_ASK.SelectedRowIndex]; + if (rowDataKeys.Count() > 0) + { + if (ConvertHelper.To(rowDataKeys[7]) == (int)AskState.New || ConvertHelper.To(rowDataKeys[7]) == (int)AskState.Release) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("选择记录不是供应商确认单据")); + return; + } + string AskBillNum = rowDataKeys[2] as string; + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASN_CREATE.aspx?AskBillNum={0}&State=1", AskBillNum))); + } + } + + protected void Button1_Click(object sender, EventArgs e) + { + DDL_State.SelectedValue = "0"; + BindAsk(); + } + + protected void Button2_Click(object sender, EventArgs e) + { + DDL_State.SelectedValue = "1"; + BindAsk(); + } + + protected void Button4_Click(object sender, EventArgs e) + { + DDL_State.SelectedValue = "2"; + BindAsk(); + } + + protected void Button6_Click(object sender, EventArgs e) + { + DDL_State.SelectedValue = string.Empty; + BindAsk(); + } + + protected void Button5_Click(object sender, EventArgs e) + { + DDL_State.SelectedValue = "3"; + BindAsk(); + } + } +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.designer.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.designer.cs new file mode 100644 index 0000000..fb2083a --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK.aspx.designer.cs @@ -0,0 +1,368 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.Views.SupplierData.SupplierLogistics +{ + + + public partial class SCP_ASK + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// button3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button button3; + + /// + /// btnOutput 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnOutput; + + /// + /// btnDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnDetail; + + /// + /// btnAsn 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnAsn; + + /// + /// btn 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btn; + + /// + /// btnShow 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnShow; + + /// + /// Button6 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button6; + + /// + /// Button2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button2; + + /// + /// Button4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button4; + + /// + /// Button5 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button5; + + /// + /// gp1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.GroupPanel gp1; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// TXT_BillNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_BillNo; + + /// + /// DropDownList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DropDownList1; + + /// + /// TXT_Extend1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend1; + + /// + /// TXT_Extend2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend2; + + /// + /// TXT_Extend3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend3; + + /// + /// TXT_AskBillNo 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_AskBillNo; + + /// + /// TXT_VendId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendId; + + /// + /// TXT_Site_Desc 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Site_Desc; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// TXT_ProjectId 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ProjectId; + + /// + /// DDL_State 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DDL_State; + + /// + /// DP_StartDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_StartDate; + + /// + /// Date_EndDate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker Date_EndDate; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// BtnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BtnClose; + + /// + /// BtnSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BtnSearch; + + /// + /// Grid_V_TB_ASK 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_V_TB_ASK; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// State_DESC 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.WebControls.Label State_DESC; + + /// + /// highlightRows 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.HiddenField highlightRows; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + + /// + /// WindowUpload 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window WindowUpload; + } +} diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx new file mode 100644 index 0000000..9cf0fc1 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx @@ -0,0 +1,119 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_ASK_DETAIL.aspx.cs" Inherits="SCP.SupplierData.SupplierLogistics.SCP_ASK_DETAIL" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + --%> + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.cs new file mode 100644 index 0000000..a1e767e --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.cs @@ -0,0 +1,144 @@ +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; + +namespace SCP.SupplierData.SupplierLogistics +{ + public partial class SCP_ASK_DETAIL : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + GetV_TB_POData(); + BindDetail(); + //SetRoleRule(); + TranslatorAgents(Toolbar2); + TranslatorAgent(Grid_V_TB_ASK_DETAIL); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + } + } + private void SetRoleRule() + { + IsPriceVisible(Grid_V_TB_ASK_DETAIL, "价格"); + } + private void BindResource() + { + BTN_refresh.Text = GetNameByKey(BTN_refresh.Text); + TXT_PoBillNum.Label = GetNameByKey(TXT_PoBillNum.Label); + TXT_Site.Label = GetNameByKey(TXT_Site.Label); + TXT_State_DESC.Label = GetNameByKey(TXT_State_DESC.Label); + TXT_VendName.Label = GetNameByKey(TXT_VendName.Label); + DP_BeginTime.Label = GetNameByKey(DP_BeginTime.Label); + //DP_EndTime.Label = GetNameByKey(DP_EndTime.Label); + foreach (var itm in Grid_V_TB_ASK_DETAIL.Columns) + { + GetNameByKey(itm.HeaderText); + } + } + public void SearchV_TB_ASK_DETAILData(Action> p_action) + { + V_TB_ASK_DETAIL _entity = new V_TB_ASK_DETAIL(); + _entity.AskBillNum= Request["AskBillNum"]; + SCP_ASK_CONTROLLER.Get_V_TB_ASK_DETAIL_List(_entity, (_ret) => { + if (_ret.State == ReturnStatus.Succeed) + { + p_action(_ret.Result); + } + }); + } + + public void GetV_TB_POData() + { + V_TB_ASK _entity = new V_TB_ASK(); + _entity.AskBillNum = Request["AskBillNum"]; + //_entity.UserInAddress = CurrentUser.FactoryList; + _entity.UserInVendIds = CurrentUser.VenderList; + SCP_ASK_CONTROLLER.Get_V_TB_ASK_List(_entity, (_ret) => + { + if (_ret.State == ReturnStatus.Succeed) + { + var _result = _ret.Result.FirstOrDefault(); + Session["Ask"] = _result; + this.TXT_PoBillNum.Text = _result.PoBillNum; + this.TXT_Site.Text = _result.Site_Desc; + this.TXT_State_DESC.Text = _result.State_DESC; + TXT_ModType.Text = _result.ModType.ToString(); + this.TXT_VendName.Text = _result.VendName; + this.txtRemark.Text = _result.Remark; + DP_BeginTime.SelectedDate = _result.BeginTime; + + } + }); + } + public void BindDetail() + { + SearchV_TB_ASK_DETAILData((ret) => { + Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count(); + var list = SortAndPage(ret, Grid_V_TB_ASK_DETAIL); + Grid_V_TB_ASK_DETAIL.DataSource = list; + Grid_V_TB_ASK_DETAIL.DataBind(); + }); + } + + + protected void btnOutput_Click(object sender, EventArgs e) + { + + } + + protected void btnConfirm_Click(object sender, EventArgs e) + { + SET_ASK_STATE("供应商确认成功!", AskState.Confirm); + } + + + private void SET_ASK_STATE(string p_msg,AskState p_state) + { + if (Session["Ask"] != null) + { + var _ask = Session["Ask"] as V_TB_ASK; + var ret = SCP_ASK_CONTROLLER.Save_TB_ASK_STATE(new List() { _ask.AskBillNum },p_state); + if (ret.State == ReturnStatus.Succeed) + { + Alert.Show(p_msg); + GetV_TB_POData(); + BindDetail(); + } + else + { + Alert.Show(ret.Message); + } + } + } + + protected void Grid_V_TB_ASK_DETAIL_PageIndexChange(object sender, GridPageEventArgs e) + { + BindDetail(); + } + + + protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid_V_TB_ASK_DETAIL.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + + BindDetail(); + } + + protected void btnNoConfirm_Click(object sender, EventArgs e) + { + SET_ASK_STATE("取消确认成功!", AskState.NoConfirm); + } + } +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.designer.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.designer.cs new file mode 100644 index 0000000..f515c85 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASK_DETAIL.aspx.designer.cs @@ -0,0 +1,224 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.SupplierData.SupplierLogistics +{ + + + public partial class SCP_ASK_DETAIL + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// BTN_refresh 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BTN_refresh; + + /// + /// btnConfirm 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnConfirm; + + /// + /// btnNoConfirm 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnNoConfirm; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// TXT_State_DESC 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_State_DESC; + + /// + /// TXT_PoBillNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_PoBillNum; + + /// + /// TXT_VendName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendName; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// TXT_Site 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Site; + + /// + /// DP_BeginTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_BeginTime; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// txtRemark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtRemark; + + /// + /// Grid_V_TB_ASK_DETAIL 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_V_TB_ASK_DETAIL; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// TXT_ModType 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.HiddenField TXT_ModType; + + /// + /// TXT_State 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.HiddenField TXT_State; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + + /// + /// WindowUpload 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window WindowUpload; + } +} diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx new file mode 100644 index 0000000..b49a16c --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx @@ -0,0 +1,129 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_ASN.aspx.cs" Inherits="SCP.SupplierData.SupplierLogistics.SCP_ASN" %> + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.cs new file mode 100644 index 0000000..02e904a --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.cs @@ -0,0 +1,175 @@ +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.ScpEntity; +using CK.SCP.Controller; +using FineUI; +using System.Data; + +namespace SCP.SupplierData.SupplierLogistics +{ + public partial class SCP_ASN : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + LoadData(); + TranslatorAgents(Toolbar2); + TranslatorAgent(Grid_V_TB_ASN); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + TranslatorAgents(FormRow_4); + } + } + public void LoadData() + { + //if (!CurrentUser.RoleList.Contains("供应商")) + //{ + // Alert.Show("当前用户角色不能操作模块!"); + // return; + //} + if (CurrentUser.VenderList.Count == 0 && CurrentUser.Name!="admin") + { + if (CurrentUser.RoleList.Contains("分厂管理员")) + { + BindASN(); + } + else + { + Alert.Show("当前用户未分配供应商!"); + return; + } + ; + } + BindASN(); + } + + public void BindASN() + { + SearchV_TB_ASN((result) => { + Grid_V_TB_ASN.RecordCount = result.Count(); + var list = SortAndPage(result, Grid_V_TB_ASN); + Grid_V_TB_ASN.DataSource = list; + Grid_V_TB_ASN.DataBind(); + }); + } + public void SearchV_TB_ASN(Action> p_action) + { + var ls = SCPDB.TB_FACTORY.Where(p => p.ErpDomain == CurrentUser.UsedDomain).ToList(); + DropDownList1.DataSource = ls; + DropDownList1.DataBind(); + V_TB_ASN _entity = new V_TB_ASN(); + _entity.IsDeleted = false; + _entity.VendId = TXT_VenderName.Text; + _entity.PoBillNum = txtPO.Text; + _entity.AsnBillNum = txtBill.Text; + _entity.AskBillNum = TXT_ASK.Text; + _entity.UserInVendIds = CurrentUser.VenderList; + _entity.UserInAddress = CurrentUser.FactoryList; + _entity.SubSite = DropDownList1.SelectedValue; + _entity.Extend1 = TXT_Extend1.Text; + _entity.Extend2 = TXT_Extend2.Text; + _entity.Extend3 = TXT_Extend3.Text; + SCP_ASN_CONTROLLER.Get_V_TB_ASN_List(_entity, (_ret) => { + if (_ret.State == ReturnStatus.Succeed) + { + p_action(_ret.Result); + } + }); + } + + protected void Grid_V_TB_ASN_RowDoubleClick(object sender, FineUI.GridRowClickEventArgs e) + { + object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[e.RowIndex]; + string AsnBillNum = rowDataKeys[1] as string; + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASN_DETAIL.aspx?AsnBillNum={0}", AsnBillNum))); + } + + protected void BtnOutPut_Click(object sender, EventArgs e) + { + List _ls = new List(); + SearchV_TB_ASN(rs => { + _ls=rs.Select(p => p.AsnBillNum).ToList(); + DataSet ds = SCP_EXCEL_CONTROLLER.GET_ASN_EXECEL(_ls); + PageBase.DataSetToExcel(ds, "发货单"); + }); + } + + protected void btnDetail_Click(object sender, EventArgs e) + { + if (Grid_V_TB_ASN.SelectedRowIndexArray.Count() == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!")); + return; + } + object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[Grid_V_TB_ASN.SelectedRowIndex]; + string AsnBillNum = rowDataKeys[1] as string; + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_ASN_DETAIL.aspx?AsnBillNum={0}", AsnBillNum))); + } + protected void btnShow_Click(object sender, EventArgs e) + { + gp1.Hidden = false; + } + protected void btnClose_Click(object sender, EventArgs e) + { + gp1.Hidden = true; + } + protected void BtnSearch_Click(object sender, EventArgs e) + { + BindASN(); + } + protected void Grid_V_TB_ASN_PageIndexChange(object sender, GridPageEventArgs e) + { + BindASN(); + } + protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid_V_TB_ASN.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + BindASN(); + } + protected void BtnOutPut_Click1(object sender, EventArgs e) + { + + } + protected void btnNew_Click(object sender, EventArgs e) + { + PageContext.RegisterStartupScript(Window1.GetShowReference("../SupplierData/SCP_ASK.aspx")); + } + + protected void Window1_Close(object sender, WindowCloseEventArgs e) + { + BindASN(); + } + + protected void btnPallet_Click(object sender, EventArgs e) + { + if (Grid_V_TB_ASN.SelectedRowIndexArray.Count() == 0 ) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!")); + return; + } + object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[Grid_V_TB_ASN.SelectedRowIndex]; + string AsnBillNum = rowDataKeys[1] as string; + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_PALLET_CREATE.aspx?AsnBillNum={0}", AsnBillNum))); + + } + + protected void btnPalletDetail_Click(object sender, EventArgs e) + { + if (Grid_V_TB_ASN.SelectedRowIndexArray.Count() == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("没有选择数据!")); + return; + } + object[] rowDataKeys = Grid_V_TB_ASN.DataKeys[Grid_V_TB_ASN.SelectedRowIndex]; + string AsnBillNum = rowDataKeys[1] as string; + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_PALLET.aspx?AsnBillNum={0}", AsnBillNum))); + + } + } +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.designer.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.designer.cs new file mode 100644 index 0000000..e4bd8b8 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN.aspx.designer.cs @@ -0,0 +1,323 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.SupplierData.SupplierLogistics +{ + + + public partial class SCP_ASN + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// Button1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button Button1; + + /// + /// BtnOutPut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BtnOutPut; + + /// + /// btnDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnDetail; + + /// + /// btnNew 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnNew; + + /// + /// btnShow 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnShow; + + /// + /// btnPallet 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnPallet; + + /// + /// btnPalletDetail 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnPalletDetail; + + /// + /// gp1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.GroupPanel gp1; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// ddl 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddl; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// txtBill 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtBill; + + /// + /// TXT_VenderName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VenderName; + + /// + /// TXT_ASK 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ASK; + + /// + /// txtPO 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtPO; + + /// + /// DropDownList1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DropDownList1; + + /// + /// TXT_Extend1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend1; + + /// + /// TXT_Extend2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend2; + + /// + /// TXT_Extend3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend3; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// txtShipTosite 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtShipTosite; + + /// + /// dateShip 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker dateShip; + + /// + /// dateReceive 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker dateReceive; + + /// + /// FormRow_4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_4; + + /// + /// btnClose 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnClose; + + /// + /// BtnSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BtnSearch; + + /// + /// Grid_V_TB_ASN 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_V_TB_ASN; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + } +} diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx new file mode 100644 index 0000000..e902ee3 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx @@ -0,0 +1,217 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_ASN_CREATE.aspx.cs" Inherits="SCP.SupplierData.SupplierLogistics.SCP_ASN_CREATE" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- --%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.cs new file mode 100644 index 0000000..89ee13c --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.cs @@ -0,0 +1,491 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using CK.SCP.Models; +using CK.SCP.Models.ScpEntity; +using CK.SCP.Utils; +using CK.SCP.Controller; +using FineUI; +using SCP.Code; +using CK.SCP.Models.Enums; + +namespace SCP.SupplierData.SupplierLogistics +{ + public partial class SCP_ASN_CREATE : PageBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + + GetV_TB_POData(); + if (Request.QueryString["State"] != null) + { + if (Request.QueryString["State"] == "1") + { + BindDetail(true); + } + else + { + BindDetail(); + } + } + else + { + BindDetail(); + } + SetRoleRule(); + TranslatorAgents(Toolbar1); + TranslatorAgent(Grid_V_TB_ASK_DETAIL); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + } + } + private void SetRoleRule() + { + IsPriceVisible(Grid_V_TB_ASK_DETAIL, "价格"); + + } + public void SearchV_TB_ASK_DETAILData(Action> p_action) + { + V_TB_ASK_DETAIL _entity = new V_TB_ASK_DETAIL(); + _entity.AskBillNum = Request["AskBillNum"]; + SCP_ASK_CONTROLLER.Get_V_TB_ASK_DETAIL_List(_entity, (_ret) => { + if (_ret.State == ReturnStatus.Succeed) + { + p_action(_ret.Result); + } + }); + } + public void GetV_TB_POData() + { + V_TB_ASK _entity = new V_TB_ASK(); + _entity.AskBillNum = Request["AskBillNum"]; + _entity.UserInAddress = CurrentUser.FactoryList; + _entity.UserInVendIds = CurrentUser.VenderList; + SCP_ASK_CONTROLLER.Get_V_TB_ASK_List(_entity, (_ret) => + { + if (_ret.State == ReturnStatus.Succeed) + { + var _result = _ret.Result.FirstOrDefault(); + Session["Ask"] = _result; + this.TXT_AskBillNum.Text = _result.AskBillNum; + this.TXT_State.Text = _result.State.ToString(); + this.TXT_Site.Text = _result.Site_Desc; + this.TXT_State_Desc.Text = _result.State_DESC; + this.TXT_VendName.Text = _result.VendName; + this.TXT_Remark.Text = _result.Remark; + this.TXT_SubSite.Text = _result.SubSite; + this.TXT_Extend1.Text = _result.Extend1; + this.TXT_Extend2.Text = _result.Extend2; + this.TXT_Extend3.Text = _result.Extend3; + DP_ShipTime.SelectedDate = DateTime.Now; + DDL_PORT.DataSource = ScpCache.PortList.Where(p => CurrentUser.FactoryList.Contains(p.FACTORY_ID)); + DDL_PORT.DataBind(); + DDL_PORT.SelectedValue = _result.ReceivedPort; + + #region 按钮控制 + + + #endregion + } + }); + } + public void BindDetail(bool p_state=false) + { + + + SearchV_TB_ASK_DETAILData((ret) => { + Grid_V_TB_ASK_DETAIL.RecordCount = ret.Count(); + var list = SortAndPage(ret, Grid_V_TB_ASK_DETAIL); + var _ls = SCP_ASK_CONTROLLER.Get_CAN_SHIPQTY(list.ToList()); + var _notifyList = new List(); + _ls.ForEach(p => + { + if (p.PackQty == 1 || p.PackQty == 0) + { + _notifyList.Add(string.Format("请注意零件编号{0}行号{1}标包数为1是否填写正确,如果不正确请修改", p.PartCode, p.PoLine)); + + } + + p.Batch = DateTime.Now.ToString("yyMMdd"); + p.ProduceDate = DateTime.Now; + if (p_state == true) + { + p.TempQty = p.CanQty; + } + else + { + p.TempQty = 0; + } + } + + ); + + Grid_V_TB_ASK_DETAIL.DataSource = _ls; + Grid_V_TB_ASK_DETAIL.DataBind(); + if (_notifyList.Count > 0) + { + Alert.Show(string.Join("", _notifyList)); + + } + + }); + + } + + + + + private void IsBatch(string batch) + { + try + { + batch = batch.Trim(); + if (batch.Length != 6) + { + Alert.Show($"批次号【{batch}】必需是6位,格式为 YYMMDD"); + } + + int y = Convert.ToInt32(batch.Substring(0, 2)); + int m = Convert.ToInt32(batch.Substring(2, 2)); + int d = Convert.ToInt32(batch.Substring(4, 2)); + + var date = new DateTime(y, m, d); + if (date.Date > DateTime.Now.Date) + { + Alert.Show($"批次号【{batch}】错误,不应大于发货日期"); + } + } + catch + { + Alert.Show($"批次号【{batch}】错误,批次必需是 YYMMDD "); + } + + + } + List _askDetaillist = new List(); + protected void btnCreate_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(TXT_AskBillNum.Text) || string.IsNullOrEmpty(TXT_ShipUser.Text) || DP_ReceiveTime.SelectedDate==null || DP_ShipTime.SelectedDate==null) + { + + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("要货看板单据编号、发货人、到货时间、收货时间不能为空")); + return; + } + + var _model=Session["Ask"] as V_TB_ASK; + + if (_model == null) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("编辑的数据不正确")); + return; + } + if (_model.State != (int)AskState.Confirm && _model.State != (int)AskState.Receive && _model.State != (int)AskState.Ship) + { + Alert.Show("要货看板必须为确认后状态"); + return; + } + + Dictionary> modifiedDict = Grid_V_TB_ASK_DETAIL.GetModifiedDict(); + + for (int i = 0, count = Grid_V_TB_ASK_DETAIL.Rows.Count; i < count; i++) + { + + V_TB_ASK_DETAIL _entity = new V_TB_ASK_DETAIL(); + object[] rowDataKeys = Grid_V_TB_ASK_DETAIL.DataKeys[i]; + _entity.UID = ConvertHelper.To(rowDataKeys[0]); + _entity.PoBillNum = rowDataKeys[1] as string; + _entity.PoLine = ConvertHelper.To(rowDataKeys[2]); + _entity.PartCode = rowDataKeys[3] as string; + _entity.ShippedQty = ConvertHelper.To(rowDataKeys[4]); + _entity.ReceivedQty = ConvertHelper.To(rowDataKeys[5]); + _entity.BeginTime = ConvertHelper.To(rowDataKeys[6]); + _entity.EndTime = ConvertHelper.To(rowDataKeys[7]); + _entity.PoUnit = rowDataKeys[8] as string; + _entity.LocUnit = rowDataKeys[9] as string; + _entity.Price = ConvertHelper.To(rowDataKeys[10]); + _entity.Currency = rowDataKeys[11] as string; + _entity.PackQty = ConvertHelper.To(rowDataKeys[12]); + _entity.UnConv = ConvertHelper.To(rowDataKeys[13]); + _entity.DockCode = rowDataKeys[14] as string; + _entity.State = ConvertHelper.To(rowDataKeys[15]); + _entity.Remark = rowDataKeys[21] as string; //把用户信息传给备注 + _entity.CreateTime = ConvertHelper.To(rowDataKeys[17]); + _entity.CreateUser = rowDataKeys[18] as string; + _entity.UpdateTime = ConvertHelper.To(rowDataKeys[19]); + _entity.UpdateUser = rowDataKeys[20] as string; + _entity.UpdateInfo = rowDataKeys[21] as string; + _entity.IsDeleted = ConvertHelper.To(rowDataKeys[22]); + _entity.PartDesc1 = rowDataKeys[23] as string; + _entity.CurrencyDesc = rowDataKeys[24] as string; + _entity.Site = rowDataKeys[25] as string; + _entity.VendName = rowDataKeys[26] as string; + _entity.PartDesc2 = rowDataKeys[27] as string; + _entity.AskBillNum = rowDataKeys[28] as string; + _entity.AskQty = ConvertHelper.To(rowDataKeys[29]); + _entity.TempQty = ConvertHelper.To(rowDataKeys[30]); + _entity.ReceivedPort = rowDataKeys[31] as string; + _entity.ReduceQty = ConvertHelper.To(rowDataKeys[33]); + _entity.ValidityDays = ConvertHelper.To(rowDataKeys[34]); + _entity.Batch = ConvertHelper.To(rowDataKeys[35]); + + _entity.ProduceDate = DateTime.Now; + if (Convert.ToDecimal(_entity.AskQty) == 0) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference("要货看板数量不能为 0")); + return; + } + if (modifiedDict.Keys.Contains(i)) + { + var modifyValue = modifiedDict[i]; + var _Qty1 = modifyValue.Keys.Contains("TempQty") ? modifyValue["TempQty"] : _entity.TempQty; + var _Batch1 = modifyValue.Keys.Contains("Batch") ? modifyValue["Batch"] : _entity.Batch; + var _VendBatch = modifyValue.Keys.Contains("VendBatch") ? modifyValue["VendBatch"].ToString() : _entity.Batch; + var _ProduceDate = modifyValue.Keys.Contains("ProduceDate") ? modifyValue["ProduceDate"].ToString() : _entity.ProduceDate.ToString(); + if (modifyValue.Keys.Contains("SubSite")) + { + _entity.SubSite = modifyValue["SubSite"].ToString(); + } + + + if (modifyValue.Keys.Contains("Extend1")) + { + _entity.Extend1 = modifyValue["Extend1"].ToString(); + } + + if (modifyValue.Keys.Contains("Extend2")) + { + _entity.Extend2 = modifyValue["Extend2"].ToString(); + } + + if (modifyValue.Keys.Contains("Extend3")) + { + _entity.Extend3 = modifyValue["Extend3"].ToString(); + } + + if (string.IsNullOrEmpty(_VendBatch) || string.IsNullOrEmpty(_ProduceDate)) + { + Alert.Show("供应商批次和生产日期不能为空!"); + return; + } + object _PackQty = 0; + if (modifyValue.Keys.Contains("PackQty")) + { + _PackQty = modifyValue["PackQty"]; + } + else + { + _PackQty = _entity.PackQty; + } + decimal QtyAll = 0; + if (ConvertHelper.To(_Qty1) > 0) + { + V_TB_ASK_DETAIL _detail = ConvertHelper.GetObjectClone(_entity); + var number = ConvertHelper.To(_Qty1); + QtyAll += number; + if (QtyAll > 0) + { + DateTime _d = DateTime.Now; + if (_ProduceDate == null && DateTime.TryParse(_ProduceDate.ToString(), out _d) == false) + { + Alert.Show("日期填写错误!"); + return; + } + DateTime dt = DateTime.Parse(_ProduceDate.ToString()); + _detail.Batch = _Batch1.ToString().Trim(); + _detail.TempQty = number; + _detail.PackQty = ConvertHelper.To(_PackQty); + _detail.VendBatch = _VendBatch.ToString(); + _detail.ProduceDate = dt; + _askDetaillist.Add(_detail); + } + } + + if (modifyValue.Keys.Contains("Qty2") && modifyValue.Keys.Contains("Batch2")) + { + var _Qty2 = modifyValue["Qty2"]; + var _Batch2 = modifyValue["Batch2"]; + + if (_Batch2.ToString().Trim() != "" && ConvertHelper.To(_Qty2) > 0) + { + V_TB_ASK_DETAIL _detail = ConvertHelper.GetObjectClone(_entity); + IsBatch(_Batch2.ToString().Trim()); + var number = ConvertHelper.To(_Qty2); + QtyAll += number; + if (QtyAll > 0) + { + _detail.Batch = _Batch2.ToString().Trim(); + _detail.TempQty = number; + _detail.PackQty = ConvertHelper.To(_PackQty); + _detail.VendBatch = _VendBatch.ToString(); + _detail.ProduceDate = DateTime.Parse(_ProduceDate.ToString()); + _askDetaillist.Add(_detail); + } + } + } + + if (modifyValue.Keys.Contains("Qty3") && modifyValue.Keys.Contains("Batch3")) + { + var _Qty3 = modifyValue["Qty3"]; + var _Batch3 = modifyValue["Batch3"]; + if (_Batch3.ToString().Trim() != "" && ConvertHelper.To(_Qty3) > 0) + { + V_TB_ASK_DETAIL _detail = ConvertHelper.GetObjectClone(_entity); + IsBatch(_Batch3.ToString().Trim()); + var number = ConvertHelper.To(_Qty3); + QtyAll += number; + if (QtyAll > 0) + { + _detail.Batch = _Batch3.ToString().Trim(); + _detail.TempQty = number; + _detail.PackQty = ConvertHelper.To(_PackQty); + _detail.VendBatch = _VendBatch.ToString(); + _detail.ProduceDate = DateTime.Parse(_ProduceDate.ToString()); + _askDetaillist.Add(_detail); + } + } + } + if (QtyAll > _entity.AskQty - _entity.ShippedQty - _entity.ReduceQty) + { + PageContext.RegisterStartupScript(Alert.GetShowInTopReference(_entity.PartCode + "发货数量>可发数量-减产数量")); + return; + } + _entity.ShippedQty = _entity.ShippedQty + QtyAll; + } + else + { + if (_entity.TempQty > 0) + { + V_TB_ASK_DETAIL _detail = ConvertHelper.GetObjectClone(_entity); + _entity.Batch = DateTime.Now.ToString("yyMMdd"); + _entity.VendBatch = DateTime.Now.ToString("yyMMdd"); + _entity.ShippedQty = _entity.TempQty; + _entity.ProduceDate = DateTime.Now; + _entity.PackQty = _entity.PackQty; + _askDetaillist.Add(_detail); + } + } + } + _model.ShipTime = DP_ShipTime.SelectedDate; + _model.ShipUser = TXT_ShipUser.Text; + _model.ReceiveTime = DP_ReceiveTime.SelectedDate; + _model.ReceiveUser = _model.Buyer; + List _ls = new List(); + if (_askDetaillist.Count == 0) + { + Alert.Show("发货数量未填写"); + return; + } + + if (CurrentUser.FactoryList.Count > 0) + { + if (CurrentUser.FactoryList.FirstOrDefault()== "CNS" || CurrentUser.FactoryList.FirstOrDefault() == "BJCIAI") + { + _askDetaillist.ForEach(p => + { + p.VendBatch = p.Batch; + + }); + } + } + + var ret=SCP_ASK_CONTROLLER.Save_ASK_TO_ASN(_model, _askDetaillist, TXT_PlateNumber.Text, CurrentUser.ChineseName ,CurrentUser.CellPhone); + if (ret.State == ReturnStatus.Succeed) + { + Alert.Show("生成发货单成功!"); + GetV_TB_POData(); + BindDetail(); + } + } + + private string GetBatch(DateTime dt) + { + string strResult = ""; + + if (dt != null) + { + string strYear = dt.Year.ToString().Substring(2, 2); + string strMonth = ""; + int iMonth = dt.Month; + + if (iMonth.ToString().Length == 1) + { + strMonth = "0" + iMonth.ToString(); + } + else + { + strMonth = iMonth.ToString(); + } + string strDay = dt.Day.ToString(); + if (strDay.Length == 1) + { + strDay = "0" + strDay; + } + + strResult = strYear + strMonth + strDay; + } + + return strResult; + } + protected void Grid_V_TB_ASK_DETAIL_PageIndexChange(object sender, GridPageEventArgs e) + { + BindDetail(); + } + + protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid_V_TB_ASK_DETAIL.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + BindDetail(); + } + + protected void Grid_V_TB_ASK_DETAIL_RowDataBound(object sender, GridRowEventArgs e) + { + + //GridRow row = Grid_V_TB_ASK_DETAIL.Rows[e.RowIndex]; + //object[] rowDataKeys = Grid_V_TB_ASK_DETAIL.DataKeys[e.RowIndex]; + + ////var TXT_PackQty = (NumberBox)row.FindControl("TXT_PackQty"); + ////var txtBatch1 = (System.Web.UI.WebControls.TextBox)row.FindControl("txtBatch1"); + ////var txtBatch2 = (System.Web.UI.WebControls.TextBox)row.FindControl("txtBatch2"); + ////var txtBatch3 = (System.Web.UI.WebControls.TextBox)row.FindControl("txtBatch3"); + ////var txtQty1 = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty1"); + ////var txtQty2 = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty2"); + ////var txtQty3 = (System.Web.UI.WebControls.TextBox)row.FindControl("txtQty3"); + //var _shippedQty = ConvertHelper.To(rowDataKeys[4]); + //var _askQty = ConvertHelper.To(rowDataKeys[29]); + //var a = row.TemplateContainers; + //if (_shippedQty >= _askQty) + //{ + + // //foreach (GridColumn column in Grid_V_TB_ASK_DETAIL.Columns) + // //{ + // // e + // // e.CellCssClasses[column.ColumnIndex] = "f-grid-cell-uneditable"; + // //} + //} + //else + //{ + // //txtQty1.Text = "0"; + + // //txtBatch1.Text = DateTime.Now.ToString("yyMMdd"); + //} + } + + protected void btnAll_Click(object sender, EventArgs e) + { + BindDetail(true); + } + + //protected void btnSet_Click(object sender, EventArgs e) + //{ + + //} + } +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.designer.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.designer.cs new file mode 100644 index 0000000..ee49754 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_CREATE.aspx.designer.cs @@ -0,0 +1,359 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.SupplierData.SupplierLogistics +{ + + + public partial class SCP_ASN_CREATE + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// pmg1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.PageManager pmg1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar1; + + /// + /// btnCreate 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnCreate; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// TXT_State_Desc 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_State_Desc; + + /// + /// TXT_AskBillNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_AskBillNum; + + /// + /// TXT_VendName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendName; + + /// + /// TXT_Site 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Site; + + /// + /// TXT_SubSite 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_SubSite; + + /// + /// TXT_Extend1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend1; + + /// + /// TXT_Extend2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend2; + + /// + /// TXT_Extend3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Extend3; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// TXT_PlateNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_PlateNumber; + + /// + /// TXT_ShipUser 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ShipUser; + + /// + /// DP_ShipTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_ShipTime; + + /// + /// DP_ReceiveTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_ReceiveTime; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// DDL_PORT 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DDL_PORT; + + /// + /// TXT_Remark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Remark; + + /// + /// Grid_V_TB_ASK_DETAIL 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_V_TB_ASK_DETAIL; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// TXT_PackQty 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox TXT_PackQty; + + /// + /// txtBatch1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox txtBatch1; + + /// + /// NumberBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox NumberBox1; + + /// + /// DatePicker1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DatePicker1; + + /// + /// TextBox1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TextBox1; + + /// + /// NumberBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox NumberBox2; + + /// + /// TextBox2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TextBox2; + + /// + /// NumberBox4 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.NumberBox NumberBox4; + + /// + /// TXT_VendBatch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendBatch; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + + /// + /// WindowUpload 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window WindowUpload; + + /// + /// TXT_State 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.HiddenField TXT_State; + } +} diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx new file mode 100644 index 0000000..9a99eac --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx @@ -0,0 +1,183 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SCP_ASN_DETAIL.aspx.cs" Inherits="SCP.SupplierData.SupplierLogistics.SCP_ASN_DETAIL" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + --%> + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + + + + + + + + --%> + + + + + + + + <%----%> + + + + + + + <%-- + + + + + + + + + + + --%> + + + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.cs new file mode 100644 index 0000000..f4b9987 --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.cs @@ -0,0 +1,540 @@ +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.ScpEntity; +using CK.SCP.Controller; +using System.Data; +using CK.SCP.Models.Enums; +using FineUI; +using CK.SCP.Utils; +using System.Data.Entity.Migrations; + +namespace SCP.SupplierData.SupplierLogistics +{ + public partial class SCP_ASN_DETAIL : PageBase + { + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + GetV_TB_ASNData(); + BindDetail(); + SetRoleRule(); + TranslatorAgents(Toolbar2); + TranslatorAgents(Toolbar1); + TranslatorAgent(Grid_V_TB_ASN_DETAIL); + TranslatorAgents(FormRow_1); + TranslatorAgents(FormRow_2); + TranslatorAgents(FormRow_3); + } + } + private void SetRoleRule() + { + IsPriceVisible(Grid_V_TB_ASN_DETAIL, "价格"); + } + + public void SearchV_TB_ASN_DETAILData(Action> p_action) + { + V_TB_ASN_DETAIL _entity = new V_TB_ASN_DETAIL(); + _entity.AsnBillNum= Request["AsnBillNum"]; + SCP_ASN_CONTROLLER.Get_V_TB_ASN_DETAIL_List(_entity, (_ret) => + { + if (_ret.State == ReturnStatus.Succeed) + { + p_action(_ret.Result); + } + }); + + } + public void GetV_TB_ASNData() + { + V_TB_ASN _entity = new V_TB_ASN(); + _entity.AsnBillNum = Request["AsnBillNum"]; + _entity.UserInVendIds = CurrentUser.VenderList; + _entity.UserInAddress= CurrentUser.FactoryList; + SCP_ASN_CONTROLLER.Get_V_TB_ASN_List(_entity, (_ret) => + { + if (_ret.State == ReturnStatus.Succeed) + { + var _result = _ret.Result.FirstOrDefault(); + Session["Asn"] = _result; + TXT_AsnBillNum.Text = _result.AsnBillNum; + TXT_PlateNumber.Text = _result.PlateNumber; + TXT_ReceiveUser.Text = _result.ReceiveUser; + TXT_ShipUser.Text = _result.ShipUser; + TXT_Site.Text = _result.Site_Desc; + TXT_Remark.Text = _result.Remark; + TXT_VendName.Text = _result.VendName; + DP_ReceiveTime.SelectedDate = _result.ReceiveTime; + DP_ShipTime.SelectedDate = _result.ShipTime; + TXT_StateDesc.Text = _result.State_DESC; + } + SCP_BARCODE_CONTROLLER.Get_TS_BARCODE_List(new TS_BARCODE() { BillNum = TXT_AsnBillNum.Text.Trim() }, retobj => + { + if (retobj.State == ReturnStatus.Succeed) + { + if (retobj.Result.Count() > 0) + { + this.btnCreateBarCode.Enabled = false; + } + else + { + this.btnCreateBarCode.Enabled = true; + } + } + }); + }); + } + public void BindDetail() + { + SearchV_TB_ASN_DETAILData((ret) => + { + Grid_V_TB_ASN_DETAIL.RecordCount = ret.Count(); + var list = SortAndPage(ret, Grid_V_TB_ASN_DETAIL); + Grid_V_TB_ASN_DETAIL.DataSource = list; + Grid_V_TB_ASN_DETAIL.DataBind(); + }); + } + + protected void btnOutput_Click(object sender, EventArgs e) + { + List _ls = new List(); + for (int i = 0, count = Grid_V_TB_ASN_DETAIL.Rows.Count; i < count; i++) + { + V_TB_ASN_DETAIL inv = new V_TB_ASN_DETAIL(); + object[] rowDataKeys = Grid_V_TB_ASN_DETAIL.DataKeys[i]; + + if (rowDataKeys[24] != null) + { + inv.AsnBillNum = rowDataKeys[24].ToString();//发货单号 + } + if (rowDataKeys[8] != null) + { + inv.PackQty = decimal.Parse(rowDataKeys[8].ToString());//标包数量 + } + if (rowDataKeys[25] != null) + { + inv.Qty = decimal.Parse(rowDataKeys[25].ToString());//发货数量 + } + inv.PartCode = rowDataKeys[3].ToString();//零件编号 + if (rowDataKeys[19] != null) + { + inv.PartDesc1 = rowDataKeys[19].ToString();//零件名称 + } + if (rowDataKeys[20] != null) + { + inv.CurrencyDesc = rowDataKeys[20].ToString();//货种 + } + if (rowDataKeys[28] != null) + { + inv.Batch = rowDataKeys[28].ToString();//批次 + } + if (rowDataKeys[26] != null) + { + inv.VendBatch = rowDataKeys[26].ToString();//供应商批次 + } + if (rowDataKeys[27] != null) + { + inv.ProduceDate = DateTime.Parse(rowDataKeys[27].ToString());//生产日期 + } + //if (rowDataKeys[26] != null) + //{ + // inv.EndTime = DateTime.Parse(rowDataKeys[34].ToString());//到货截至日期 + //} + inv.PoUnit = rowDataKeys[4].ToString();//采购单位 + // if (rowDataKeys[6] != null) + // { + // inv.Price = decimal.Parse(rowDataKeys[6].ToString());//价格 + // } + // if (rowDataKeys[34] != null) + //{ + // inv.ReceivedPort_Desc = rowDataKeys[34].ToString();//收货口 + //} + _ls.Add(inv); + } + + + Dictionary cellheader = new Dictionary + { + { "AsnBillNum", "发货单号" }, + { "PackQty", "标包数量" }, + { "Qty", "发货数量" }, + { "PartCode", "零件编号" }, + { "PartDesc1", "零件名称" }, + { "Batch", "批次" }, + { "VendBatch", "供应商批次" }, + { "ProduceDate", "生产日期" }, + { "EndTime", "到货截至日期" }, + { "PoUnit", "单位" } + }; + + string url = EntityListToExcel2003(cellheader, _ls, "发货明细"); + } + + protected void btnCreate_Click(object sender, EventArgs e) + { + + + BindDetail(); + } + + protected void btnEdit_Click(object sender, EventArgs e) + { + var _asn=Session["Asn"] as V_TB_ASN; + if (_asn == null) + { + Alert.Show("发货订单信息不能为空!"); + } + List _list = new List(); + for (int i = 0, count = Grid_V_TB_ASN_DETAIL.Rows.Count; i < count; i++) + { + GridRow row = Grid_V_TB_ASN_DETAIL.Rows[i]; + V_TB_ASN_DETAIL _entity = new V_TB_ASN_DETAIL(); + object[] rowDataKeys = Grid_V_TB_ASN_DETAIL.DataKeys[i]; + _entity.UID = ConvertHelper.To(rowDataKeys[0]); + _entity.PoBillNum = rowDataKeys[1] as string; + _entity.PoLine = ConvertHelper.To(rowDataKeys[2]); + _entity.PartCode = rowDataKeys[3] as string; + _entity.PoUnit = rowDataKeys[4] as string; + _entity.LocUnit = rowDataKeys[5] as string; + _entity.Price = ConvertHelper.To(rowDataKeys[6]); + _entity.Currency = rowDataKeys[7] as string; + _entity.PackQty = ConvertHelper.To(rowDataKeys[8]); + _entity.UnConv = ConvertHelper.To(rowDataKeys[9]); + _entity.DockCode = rowDataKeys[10] as string; + _entity.State = ConvertHelper.To(rowDataKeys[11]); + _entity.Remark = rowDataKeys[12] as string; + _entity.CreateTime = ConvertHelper.To(rowDataKeys[13]); + _entity.CreateUser = rowDataKeys[14] as string; + _entity.UpdateTime = ConvertHelper.To(rowDataKeys[15]); + _entity.UpdateUser = rowDataKeys[16] as string; + _entity.UpdateInfo = rowDataKeys[17] as string; + _entity.IsDeleted = ConvertHelper.To(rowDataKeys[18]); + _entity.PartDesc1 = rowDataKeys[19] as string; + _entity.CurrencyDesc = rowDataKeys[20] as string; + _entity.Site = rowDataKeys[21] as string; + _entity.VendName = rowDataKeys[22] as string; + _entity.PartDesc2 = rowDataKeys[23] as string; + _entity.AsnBillNum = rowDataKeys[24] as string; + _entity.Qty = ConvertHelper.To(rowDataKeys[25]); + _entity.VendBatch = rowDataKeys[26] as string; + _entity.Batch = rowDataKeys[28] as string; + _entity.VendId = rowDataKeys[29] as string; + System.Web.UI.WebControls.TextBox TXT_VenBatch = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_VenBatch"); + System.Web.UI.WebControls.TextBox TXT_PackQty = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_PackQty"); + System.Web.UI.WebControls.TextBox TXT_Qty = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_Qty"); + System.Web.UI.WebControls.TextBox TXT_ProduceDate = (System.Web.UI.WebControls.TextBox)row.FindControl("TXT_ProduceDate"); + _entity.VendBatch= TXT_VenBatch.Text; + + + if (string.IsNullOrEmpty(TXT_ProduceDate.Text)) + { + Alert.Show("包装量填写错误!"); + return; + } + else + { + _entity.ProduceDate =DateTime.Parse(TXT_ProduceDate.Text); + } + _list.Add(_entity); + } + if (_list.Count > 0) + { + var _first = _list.FirstOrDefault(); + if (_first.State != (int)AsnState.New) + { + Alert.Show("不是新建状态,不能保存信息!"); + } + } + } + + + + protected void btnRefresh_Click(object sender, EventArgs e) + { + + } + private List GetSelectedList() + { + List _list = new List(); + int _flag = 0; + for (int i = 0, count = Grid_V_TB_ASN_DETAIL.Rows.Count; i < count; i++) + { + GridRow row = Grid_V_TB_ASN_DETAIL.Rows[i]; + V_TB_ASN_DETAIL _entity = new V_TB_ASN_DETAIL(); + object[] rowDataKeys = Grid_V_TB_ASN_DETAIL.DataKeys[i]; + _entity.UID = ConvertHelper.To(rowDataKeys[0]); + _entity.PoBillNum = rowDataKeys[1] as string; + _entity.PoLine = ConvertHelper.To(rowDataKeys[2]); + _entity.PartCode = rowDataKeys[3] as string; + _entity.PoUnit = rowDataKeys[4] as string; + _entity.LocUnit = rowDataKeys[5] as string; + _entity.Price = ConvertHelper.To(rowDataKeys[6]); + _entity.Currency = rowDataKeys[7] as string; + _entity.PackQty = ConvertHelper.To(rowDataKeys[8]); + _entity.UnConv = ConvertHelper.To(rowDataKeys[9]); + _entity.DockCode = rowDataKeys[10] as string; + _entity.State = ConvertHelper.To(rowDataKeys[11]); + _entity.Remark = rowDataKeys[12] as string; + _entity.CreateTime = ConvertHelper.To(rowDataKeys[13]); + _entity.CreateUser = rowDataKeys[14] as string; + _entity.UpdateTime = ConvertHelper.To(rowDataKeys[15]); + _entity.UpdateUser = rowDataKeys[16] as string; + _entity.UpdateInfo = rowDataKeys[17] as string; + _entity.IsDeleted = ConvertHelper.To(rowDataKeys[18]); + _entity.PartDesc1 = rowDataKeys[19] as string; + _entity.CurrencyDesc = rowDataKeys[20] as string; + _entity.Site = rowDataKeys[21] as string; + _entity.VendName = rowDataKeys[22] as string; + _entity.PartDesc2 = rowDataKeys[23] as string; + _entity.AsnBillNum = rowDataKeys[24] as string; + _entity.Qty = ConvertHelper.To(rowDataKeys[25]); + _entity.VendBatch = rowDataKeys[26] as string; + _entity.ProduceDate = ConvertHelper.To(rowDataKeys[27]); + _entity.Batch = rowDataKeys[28] as string; + _entity.VendId = rowDataKeys[29] as string; + _entity.Guid=ConvertHelper.To(rowDataKeys[29]); + + _list.Add(_entity); + } + if (_flag == 1) + { _list = new List(); } + return _list; + } + protected void btnSend_Click(object sender, EventArgs e) + { + var _asn = Session["Asn"] as V_TB_ASN; + if (_asn == null) + { + Alert.Show("发货订单信息不能为空!"); + } + var _list = GetSelectedList(); + if (_list.Count > 0) + { + var _first = _list.FirstOrDefault(); + if (_first.State != (int)AsnState.New) + { + Alert.Show("不是新建状态,不能保存信息!"); + } + else + { + var result=SCP_BARCODE_CONTROLLER.Get_TB_PRINT_COUNT_List(new TB_PRINT_COUNT() { BillNo=_asn.AsnBillNum }); + if (result.State == ReturnStatus.Succeed) + { + if (result.Result.Count(p => p.PrintType == (int)PrintType.ASN) == 0) + { + Alert.Show(_asn.AsnBillNum + "发货单未打印!"); + return; + } + if (result.Result.Count(p => p.PrintType == (int)PrintType.BAR_CODE) == 0) + { + Alert.Show(_asn.AsnBillNum + "标签未打印!"); + return; + } + } + var check = SCP_ASN_CONTROLLER.Get_TS_UNI_API(_asn); + if(check.State == ReturnStatus.Failed) + { + Alert.Show(_asn.AsnBillNum + "请勿重复提交数据!"); + return; + } + var ret = SCP_ASN_CONTROLLER.Save_TB_ASN_DETAIL(_asn, _list); + if (ret.State == ReturnStatus.Succeed) + { + SET_ASN_STATE("发货成功", AsnState.Ship); + GetV_TB_ASNData(); + BindDetail(); + } + else + { + Alert.Show(string.Join("\n\r", ret.MessageList.ToArray())); + } + } + } + + } + private void SET_ASN_STATE(string p_msg, AsnState p_state) + { + if (Session["Asn"] != null) + { + + if (CurrentUser.Name == "admin"|| CurrentUser.RoleList.Contains("分厂管理员")) + { + if (p_state == AsnState.Reject) + { + var _asn = Session["Asn"] as V_TB_ASN; + + + var asn = SCPDB.TB_ASN.Where(p => p.AsnBillNum == _asn.AsnBillNum).FirstOrDefault(); + var detail = SCPDB.TB_ASN_DETAIL.Where(p => p.AsnBillNum == _asn.AsnBillNum).ToArray(); + if (asn != null) + { + asn.State = -1; + asn.IsDeleted = true; + SCPDB.TB_ASN.AddOrUpdate(asn); + } + if (detail.Count() > 0) + { + foreach (var itm in detail) + { + itm.IsDeleted = true; + itm.State = -1; + + } + SCPDB.TB_ASN_DETAIL.AddOrUpdate(detail); + } + if (SCPDB.SaveChanges() != -1) + { + Alert.Show("发货单删除成功"); + } + } + + } + else + { + var _ask = Session["Asn"] as V_TB_ASN; + var ret = SCP_ASN_CONTROLLER.Save_TB_ASN_STATE(new List() { _ask.AsnBillNum }, p_state); + if (ret.State == ReturnStatus.Succeed) + { + Alert.Show(p_msg); + } + else + { + Alert.Show(ret.Message); + } + } + } + } + protected void btnCancel_Click(object sender, EventArgs e) + { + + SET_ASN_STATE("发货单作废成功", AsnState.Reject); + + } + + protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e) + { + Grid_V_TB_ASN_DETAIL.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue); + + BindDetail(); + } + + protected void Grid_V_TB_ASN_DETAIL_PageIndexChange(object sender, GridPageEventArgs e) + { + BindDetail(); + } + + protected void CreateBarCode_Click(object sender, EventArgs e) + { + + var _list=GetSelectedList(); + if (_list.Count > 0) + { + btnCreateBarCode.Enabled = false; + var ret=SCP_ASN_CONTROLLER.Save_TB_CREATE_BARCODE(_list); + if (ret.State == ReturnStatus.Succeed) + { + Alert.Show("条码创建成功!"); + } + else + { + btnCreateBarCode.Enabled = true; + Alert.Show(string.Join("", ret.MessageList.ToArray())); + } + } + } + + protected void btnBarCodeList_Click(object sender, EventArgs e) + { + try + { + string AsnBillNum = Request["AsnBillNum"]; + string script = Window1.GetShowReference("SCP_SHIP_DETAIL_BARCODE.aspx?BillNo=" + AsnBillNum, "条码列表"); + PageContext.RegisterStartupScript(script); + + } + catch (Exception ex) + { + Alert.Show(ex.Message); + } + } + + + protected void btnPrint_Click(object sender, EventArgs e) + { + string AsnBillNum = Request["AsnBillNum"]; + var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=SendBill&data=102&type=pdf&filename=SendBill.pdf&AsnBillNum={0}&open=\")", AsnBillNum); + PageContext.RegisterStartupScript(str); + SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = AsnBillNum, PrintType = (int)PrintType.ASN}); + } + + protected void btnSelectedBarCode_Click(object sender, EventArgs e) + { + string AsnBillNum = Request["AsnBillNum"]; + if (!string.IsNullOrEmpty(AsnBillNum)) + { + var str = string.Format("window.open(\"../../Handlers/GenerateReport.ashx?report=Material&data=101&type=pdf&filename=标签.pdf&AsnBillNum={0}&open=\")",AsnBillNum); + PageContext.RegisterStartupScript(str); + } + SCP_BARCODE_CONTROLLER.Save_TB_PRINT_COUNT(new TB_PRINT_COUNT() { BillNo = AsnBillNum, PrintType = (int)PrintType.BAR_CODE }); + + } + + protected void btnOutputPallet_Click(object sender, EventArgs e) + { + + #region 计算托盘数量和发货数量是否相等 + + SearchV_TB_ASN_DETAILData((ret) => { + + var _asn = Session["Asn"] as V_TB_ASN; + if (_asn == null) + { + Alert.Show("发货单不存在!"); + return; + } + + + var _ls=SCP_ASN_CONTROLLER.Get_CAN_PALLET_QTY(ret.ToList()); + var _errList = new List(); + _ls.ForEach(p => { + if(p.CanQty>0) + { + _errList.Add(string.Format("编号:{0}名称:{1},托盘数量总和小于发货单数量",p.PartCode,(p.PartDesc1+p.PartDesc2))); + } + }); + if (_errList.Count > 0) + { + Alert.Show(string.Join("", _errList.ToArray())); + return; + } + + + + List _list = new List(); + _list.Add(_asn.AsnBillNum); + DataSet ds = SCP_EXCEL_CONTROLLER.GET_PALLET_EXECEL(_list); + PageBase.DataSetToExcel(ds, "打印导出托盘!"); + + }); + + + + + + #endregion + + + } + + protected void btnPackage_Click(object sender, EventArgs e) + { + string AsnBillNum = Request["AsnBillNum"]; + PageContext.RegisterStartupScript(Window1.GetShowReference(string.Format("../SupplierData/SCP_MAKE_PAGE_BARCODE.aspx?AsnBillNum={0}",AsnBillNum))); + } + } +} \ No newline at end of file diff --git a/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.designer.cs b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.designer.cs new file mode 100644 index 0000000..7a4e41b --- /dev/null +++ b/SCP/Views/SupplierData/SupplierLogistics/SCP_ASN_DETAIL.aspx.designer.cs @@ -0,0 +1,314 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.SupplierData.SupplierLogistics +{ + + + public partial class SCP_ASN_DETAIL + { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// btnRefresh 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnRefresh; + + /// + /// btnSend 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnSend; + + /// + /// btnPrint 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnPrint; + + /// + /// btnPackage 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnPackage; + + /// + /// btnCancel 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnCancel; + + /// + /// FormRow_1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_1; + + /// + /// TXT_StateDesc 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_StateDesc; + + /// + /// TXT_AsnBillNum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_AsnBillNum; + + /// + /// TXT_VendName 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_VendName; + + /// + /// TXT_Site 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Site; + + /// + /// FormRow_2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_2; + + /// + /// DP_ShipTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_ShipTime; + + /// + /// TXT_ShipUser 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ShipUser; + + /// + /// DP_ReceiveTime 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DatePicker DP_ReceiveTime; + + /// + /// TXT_ReceiveUser 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_ReceiveUser; + + /// + /// FormRow_3 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.FormRow FormRow_3; + + /// + /// TXT_PlateNumber 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_PlateNumber; + + /// + /// TXT_Remark 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextBox TXT_Remark; + + /// + /// Toolbar1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar1; + + /// + /// btnCreateBarCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnCreateBarCode; + + /// + /// btnSelectedBarCode 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnSelectedBarCode; + + /// + /// btnOutputPallet 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnOutputPallet; + + /// + /// btnBarCodeList 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnBarCodeList; + + /// + /// btnOutPut 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button btnOutPut; + + /// + /// Grid_V_TB_ASN_DETAIL 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid_V_TB_ASN_DETAIL; + + /// + /// ToolbarSeparator1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarSeparator ToolbarSeparator1; + + /// + /// ToolbarText1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.ToolbarText ToolbarText1; + + /// + /// ddlGridPageSize 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList ddlGridPageSize; + + /// + /// Window1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window Window1; + + /// + /// WindowUpload 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Window WindowUpload; + } +} diff --git a/SCP/Web.config b/SCP/Web.config index d30352b..cad8159 100644 --- a/SCP/Web.config +++ b/SCP/Web.config @@ -28,12 +28,12 @@ --> - - - - - - + + + + + + From cc1b763fc8b4b3c5bb747c1ede583397fa40430b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Wed, 9 Sep 2020 16:56:25 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/UniApiController.cs | 50 ++++++++++++++++++++ SCP/Admin/UNIAPI.aspx | 54 +++++++++++++++++++++ SCP/Admin/UNIAPI.aspx.cs | 74 +++++++++++++++++++++++++++++ SCP/Admin/UNIAPI.aspx.designer.cs | 78 +++++++++++++++++++++++++++++++ SCP/SCP.csproj | 8 ++++ 5 files changed, 264 insertions(+) create mode 100644 SCP/Admin/UNIAPI.aspx create mode 100644 SCP/Admin/UNIAPI.aspx.cs create mode 100644 SCP/Admin/UNIAPI.aspx.designer.cs diff --git a/Controller/UniApiController.cs b/Controller/UniApiController.cs index 1aa15ee..cb42e69 100644 --- a/Controller/UniApiController.cs +++ b/Controller/UniApiController.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Data; using System.Data.Entity.Core; +using System.Data.SqlClient; using System.Linq; using System.Text; using CK.SCP.Models; @@ -218,6 +220,54 @@ namespace CK.SCP.Controller return asp; } + public static DataTable FindUniapi(string p_type, string p_billNum, string p_domain) + { + string sql = string.Empty; + switch (p_type) + { + case "xxqad_pod_det": + sql = + "SELECT * FROM[xxqad_pod_det] a inner join xxqad_ctrl b on a.xxqad_pod_seq = b.xxqad_seq where xxqad_domain = '{1}' and xxqad_pod_nbr in ({0}) order by xxqad_pod_nbr, b.xxqad_seq "; + break; + case "xxqad_prh_det": + sql = "SELECT * FROM[xxqad_prh_det] a inner join xxqad_ctrl b on a.xxqad_prh_seq = b.xxqad_seq where xxqad_domain = '{1}' and (xxqad_prh_psnbr in ({0}) or xxqad_prh_receiver in ({0})) order by xxqad_prh_psnbr, b.xxqad_seq "; + break; + case "xxwms_rc_det": + sql = "select * from xxwms_rc_det a inner join xxwms_ctrl b on a.xxwms_rc_seq = b.xxwms_seq where xxwms_domain = '{1}' and (xxwms_rc_nbr in ({0}) order by xxwms_rc_nbr, b.xxwms_seq"; + break; + case "xxscm_tx_mstr": + sql = "select * from xxscm_tx_mstr a inner join xxscm_ctrl b on a.xxscm_tx_seq = b.xxscm_seq where xxscm_domain = '{1}' and xxscm_tx_nbr in ({0}) order by xxscm_tx_nbr, b.xxscm_seq"; + break; + case "xxscm_inv_det": + sql = "select * from xxscm_inv_det a inner join xxscm_ctrl b on a.xxscm_inv_seq = b.xxscm_seq where xxscm_domain = '{1}' and xxscm_inv_nbr IN({0}) order by xxscm_inv_nbr,b.xxscm_seq"; + break; + } + DataTable _dt = new DataTable(); + var dbSetting = GlobalConfig.UniApiDatabase; + var strConn = EntitiesFactory.GetEfConnectionString(dbSetting); + SqlConnection conn = new System.Data.SqlClient.SqlConnection(); + try + { + + conn.ConnectionString = strConn; + if (conn.State != ConnectionState.Open) + { + conn.Open(); + } + SqlCommand cmd = new SqlCommand(); + cmd.Connection = conn; + cmd.CommandText = string.Format(sql, p_billNum, p_domain); + SqlDataAdapter adapter = new SqlDataAdapter(cmd); + adapter.Fill(_dt); + conn.Close(); + + } + catch (Exception e) + { + conn.Close(); + } + return _dt; + } //创建发货单 public static TS_UNI_API CreateBy(V_TB_ASN bill, V_TB_ASN_DETAIL detail, UniApiType uniApiType) diff --git a/SCP/Admin/UNIAPI.aspx b/SCP/Admin/UNIAPI.aspx new file mode 100644 index 0000000..ba98cb7 --- /dev/null +++ b/SCP/Admin/UNIAPI.aspx @@ -0,0 +1,54 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UNIAPI.aspx.cs" Inherits="SCP.Admin.UNIAPI" %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SCP/Admin/UNIAPI.aspx.cs b/SCP/Admin/UNIAPI.aspx.cs new file mode 100644 index 0000000..f30d2ef --- /dev/null +++ b/SCP/Admin/UNIAPI.aspx.cs @@ -0,0 +1,74 @@ +using CK.SCP.Controller; +using FineUI; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace SCP.Admin +{ + public partial class UNIAPI : PageBase + { + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + Bind(); + } + } + private void Bind() + { + var _domain = Request["Domain"]; + var _billNum =TXT_billnum.Text= Request.Params["BillNum"]; + var _tableName=DDL_State.SelectedValue= Request.Params["TableName"]; + if (!string.IsNullOrEmpty(_billNum) && !string.IsNullOrEmpty(_domain) && !string.IsNullOrEmpty(_tableName)) + { + var _ary = _billNum.Split(new char[] { ',' }).ToList(); + var sqlstr = string.Empty; + _ary.ForEach(p => + { + sqlstr += string.Format("'{0}',", p); + }); + sqlstr = sqlstr.Substring(0, sqlstr.Length - 1); + DataTable _dt = UniApiController.FindUniapi(_tableName, sqlstr, _domain); + foreach (DataColumn column in _dt.Columns) + { + FineUI.BoundField bf; + bf = new FineUI.BoundField(); + bf.DataField = column.ColumnName; + bf.SortField = column.ColumnName; + bf.HeaderText = column.ColumnName; + Grid.Columns.Add(bf); + } + Grid.DataSource = _dt; + Grid.DataBind(); + } + } + + protected void BtnSearch_Click(object sender, EventArgs e) + { + StringBuilder _buffer = new StringBuilder(); + if (!string.IsNullOrEmpty(DDL_State.SelectedValue)) + { + _buffer.AppendFormat("TableName={0}&&", DDL_State.SelectedValue); + } + if (!string.IsNullOrEmpty(TXT_billnum.Text)) + { + _buffer.AppendFormat("BillNum={0}&&", TXT_billnum.Text); + } + if (!string.IsNullOrEmpty(CurrentUser.UsedDomain)) + { + _buffer.AppendFormat("Domain={0}",CurrentUser.UsedDomain); + } + string s = _buffer.ToString(); + PageContext.Redirect(string.Format("UNIAPI.aspx?{0}", s)); + + } + } +} + + diff --git a/SCP/Admin/UNIAPI.aspx.designer.cs b/SCP/Admin/UNIAPI.aspx.designer.cs new file mode 100644 index 0000000..4d1f2fb --- /dev/null +++ b/SCP/Admin/UNIAPI.aspx.designer.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// <自动生成> +// 此代码由工具生成。 +// +// 对此文件的更改可能导致不正确的行为,如果 +// 重新生成代码,则所做更改将丢失。 +// 自动生成> +//------------------------------------------------------------------------------ + +namespace SCP.Admin { + + + public partial class UNIAPI { + + /// + /// form1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// Panel1 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Panel Panel1; + + /// + /// Toolbar2 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Toolbar Toolbar2; + + /// + /// DDL_State 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.DropDownList DDL_State; + + /// + /// TXT_billnum 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.TextArea TXT_billnum; + + /// + /// BtnSearch 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Button BtnSearch; + + /// + /// Grid 控件。 + /// + /// + /// 自动生成的字段。 + /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 + /// + protected global::FineUI.Grid Grid; + } +} diff --git a/SCP/SCP.csproj b/SCP/SCP.csproj index 9c91f6b..c75f6bb 100644 --- a/SCP/SCP.csproj +++ b/SCP/SCP.csproj @@ -197,6 +197,7 @@ + @@ -4802,6 +4803,13 @@ title_user_addnew.aspx + + UNIAPI.aspx + ASPXCodeBehind + + + UNIAPI.aspx + user.aspx ASPXCodeBehind From 106c31a7f0b9e6c284b905000e89ac42d9d75d4c Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Thu, 10 Sep 2020 08:35:14 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=B2=88=E9=98=B3=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/CK.SCP.Controller.csproj | 1 + Controller/SCP_ASK_CONTROLLER.cs | 739 ++++++++++-------- Controller/SCP_ASN_CONTROLLER.cs | 477 ++++++++++- Controller/SCP_BARCODE_CONTROLLER.cs | 7 +- Controller/SCP_BILLCODE_CONTROLLER.cs | 9 + Controller/SCP_EXCEL_CONTROLLER.cs | 84 +- Controller/SCP_FORECAST_CONTROLLER.cs | 164 +++- Controller/SCP_INVOICE_CONTROLLER.cs | 394 +++++++++- Controller/SCP_MoldSharing_Controller.cs | 524 +++++++++++++ Controller/SCP_PO_CONTROLLER.cs | 158 +--- Controller/SCP_RECEIVE_CONTROLLER.cs | 403 +++++++++- Controller/SCP_REJECT_CONTROLLER.cs | 117 +++ Controller/SCP_REPORT_CONTROLLER.cs | 236 +++--- Controller/SCP_TB_PRICE_CONTROLLER.cs | 3 +- Controller/SCP_TB_VENDER_CONTROLLER.cs | 82 ++ Controller/SCP_TS_BARCODE_CONTROLLER.cs | 105 ++- Controller/SCP_WMS_CONTROLLER.cs | 92 +++ Controller/UniApiController.cs | 49 ++ Models/CK.SCP.Models.csproj | 7 + Models/ScpEntities.cs | 20 +- .../ExcelExportEnttity/SCP_FORECAST_EXPORT.cs | 9 + .../SCP_MOLDSHARING_EXPORT.cs | 17 + .../SCP_OTD_VendId_REPORT_EXPORT.cs | 22 + .../ExcelImportEntity/SCP_ASN_EXCEL.cs | 23 + .../ExcelImportEntity/SCP_PO_EXCEL.cs | 10 +- Models/ScpEntity/TA_MOLDSHARING_INVOICE.cs | 31 + Models/ScpEntity/TA_MoldSharing.cs | 34 + Models/ScpEntity/TB_FORECAST.cs | 49 +- Models/ScpEntity/TB_INVOICE_DETAIL.cs | 2 + Models/ScpEntity/TS_BARCODE.cs | 5 + Models/ScpEntity/V_TB_ASK.cs | 4 + Models/ScpEntity/V_TB_ASN_DETAIL.cs | 5 + Models/ScpEntity/V_TB_FORECAST.cs | 32 +- Models/ScpEntity/V_TB_INCOMPLETE_ASK.cs | 1 - Models/ScpEntity/V_TB_INVOICE.cs | 2 + Models/ScpEntity/V_TB_INVOICE_DETAIL.cs | 2 + Models/ScpEntity/V_TB_RECEIVE.cs | 6 + Models/ScpEntity/V_TB_RECEIVE_DETAIL.cs | 2 - Models/ScpEntity/V_TB_RECEIVE_LIST.cs | 1 + Models/ScpEntity/V_TS_BARCODE.cs | 48 ++ Models/WmsEntity/VIEW_STOCK_REPORT.cs | 37 + Models/WmsEntity/WmsEntities.cs | 1 + SCP/Admin/UNIAPI.aspx | 54 ++ SCP/Admin/UNIAPI.aspx.cs | 88 +++ SCP/Admin/UNIAPI.aspx.designer.cs | 78 ++ SCP/Business/PageBase.cs | 15 +- SCP/Common/MailHelper.cs | 60 +- SCP/SCP.csproj | 140 ++-- .../BasicData/SCP_MOLDSHARING_DETAIL.aspx | 76 ++ .../BasicData/SCP_MOLDSHARING_DETAIL.aspx.cs | 88 +++ .../SCP_MOLDSHARING_DETAIL.aspx.designer.cs | 134 ++++ SCP/Views/BasicData/SCP_MoldSharing.aspx | 92 +++ SCP/Views/BasicData/SCP_MoldSharing.aspx.cs | 175 +++++ .../SCP_MoldSharing.aspx.designer.cs} | 111 +-- SCP/Views/BasicData/Supplier.aspx | 17 +- SCP/Views/BasicData/Supplier.aspx.cs | 44 +- SCP/Views/BasicData/Supplier.aspx.designer.cs | 71 +- SCP/Views/PlanData/SCP_ASN_DETAIL_View.aspx | 9 +- SCP/Views/PlanData/SCP_PO.aspx | 39 +- SCP/Views/PlanData/SCP_PO.aspx.cs | 2 + SCP/Views/PlanData/SCP_PO.aspx.designer.cs | 12 +- SCP/Views/PlanData/SCP_PO_CREATE_ASK.aspx | 1 - SCP/Views/PlanData/SCP_PO_DETAIL_OUT.aspx | 8 +- SCP/Views/SupplierData/SCP_INVOICE.aspx | 3 +- SCP/Views/SupplierData/SCP_INVOICE.aspx.cs | 18 +- .../SupplierData/SCP_INVOICE_CREATE.aspx.cs | 32 - .../SupplierData/SCP_INVOICE_EDIT.aspx.cs | 37 +- .../SupplierData/SCP_SHIP_DETAIL_BARCODE.aspx | 26 +- .../SCP_SHIP_DETAIL_BARCODE.aspx.cs | 19 +- .../SCP_SHIP_DETAIL_BARCODE.aspx.designer.cs | 90 ++- SCP/Views/SupplierData/SCP_TS_BARCODE.aspx | 35 +- SCP/Views/SupplierData/SCP_TS_BARCODE.aspx.cs | 63 +- .../SCP_TS_BARCODE.aspx.designer.cs | 70 +- SCP/Views/WarehouseData/SCP_INVOICE.aspx | 3 +- .../WarehouseData/SCP_INVOICE_CONFIRM.aspx | 2 +- .../WarehouseData/SCP_INVOICE_CONFIRM.aspx.cs | 4 - .../SCP_INVOICE_CONFIRM_DETAIL.aspx | 2 +- .../SCP_INVOICE_CONFIRM_DETAIL.aspx.cs | 9 - .../WarehouseData/SCP_INVOICE_DELTAIL.aspx | 4 +- SCP/Views/WarehouseData/SCP_RECEIVE.aspx | 25 +- SCP/Views/WarehouseData/SCP_RECEIVE.aspx.cs | 12 +- .../SCP_RECEIVE.aspx.designer.cs | 96 ++- .../WarehouseData/SCP_RECEIVE_DETAIL.aspx | 21 +- SCP/Views/沈阳金杯/PlanData/SCP_ASK.aspx | 63 +- .../沈阳金杯/PlanData/SCP_ASK.aspx.cs | 77 +- .../PlanData/SCP_ASK.aspx.designer.cs | 120 ++- .../沈阳金杯/PlanData/SCP_ASK_DETAIL.aspx | 61 +- .../PlanData/SCP_ASK_DETAIL.aspx.cs | 180 ++--- .../PlanData/SCP_ASK_DETAIL.aspx.designer.cs | 123 ++- .../PlanData/SCP_ASK_DETAIL_PARTCODE.aspx | 91 +++ .../PlanData/SCP_ASK_DETAIL_PARTCODE.aspx.cs | 244 ++++++ .../SCP_ASK_DETAIL_PARTCODE.aspx.designer.cs | 125 +++ SCP/Views/沈阳金杯/PlanData/SCP_ASN.aspx | 55 +- .../沈阳金杯/PlanData/SCP_ASN.aspx.cs | 48 +- .../PlanData/SCP_ASN.aspx.designer.cs | 78 +- .../沈阳金杯/PlanData/SCP_FORECAST.aspx | 101 +++ .../PlanData/SCP_FORECAST.aspx.cs | 245 ++++++ .../SCP_FORECAST.aspx.designer.cs} | 128 +-- .../PlanData/SCP_PRODUCT_DETAIL.aspx | 52 ++ .../PlanData/SCP_PRODUCT_DETAIL.aspx.cs | 102 +++ .../SCP_PRODUCT_DETAIL.aspx.designer.cs | 105 +++ .../Report/SCP_FORECAST_REPORT.aspx | 87 +++ .../Report/SCP_FORECAST_REPORT.aspx.cs | 112 +++ .../SCP_FORECAST_REPORT.aspx.designer.cs | 150 ++++ .../Report/SCP_INCOMPLETE_ASK.aspx | 39 +- .../Report/SCP_INCOMPLETE_ASK.aspx.cs | 32 +- .../SCP_INCOMPLETE_ASK.aspx.designer.cs | 67 +- .../沈阳金杯/Report/SCP_OTD_REPORT.aspx | 28 +- .../Report/SCP_OTD_REPORT.aspx.cs | 20 + .../Report/SCP_OTD_REPORT.aspx.designer.cs | 53 +- .../Report/SCP_OTD_REPORT_VendID.aspx | 14 +- .../Report/SCP_OTD_REPORT_VendID.aspx.cs | 18 +- SCP/Views/沈阳金杯/SCP_ARRIVE.aspx | 2 +- SCP/Views/沈阳金杯/SCP_ARRIVE.aspx.cs | 11 - SCP/Views/沈阳金杯/SCP_PO.aspx | 172 ---- SCP/Views/沈阳金杯/SCP_PO.aspx.cs | 186 ----- SCP/Views/沈阳金杯/SCP_PO_ARRIVE.aspx | 94 --- SCP/Views/沈阳金杯/SCP_PO_ARRIVE.aspx.cs | 125 --- SCP/Views/沈阳金杯/SCP_PO_DETAIL.aspx | 120 --- SCP/Views/沈阳金杯/SCP_PO_DETAIL.aspx.cs | 107 --- SCP/Views/沈阳金杯/SCP_PO_STATISTICS.aspx | 128 --- .../沈阳金杯/SCP_PO_STATISTICS.aspx.cs | 155 ---- .../沈阳金杯/SupplierData/SCP_ASK.aspx | 46 +- .../沈阳金杯/SupplierData/SCP_ASK.aspx.cs | 31 +- .../SupplierData/SCP_ASK.aspx.designer.cs | 73 +- .../SupplierData/SCP_ASK_DETAIL.aspx | 7 +- .../SupplierData/SCP_ASK_DETAIL.aspx.cs | 2 +- .../沈阳金杯/SupplierData/SCP_ASN.aspx | 55 +- .../沈阳金杯/SupplierData/SCP_ASN.aspx.cs | 66 +- .../SupplierData/SCP_ASN.aspx.designer.cs | 80 +- .../SupplierData/SCP_ASN_CREATE.aspx | 11 +- .../SupplierData/SCP_ASN_CREATE.aspx.cs | 20 +- .../SupplierData/SCP_ASN_DETAIL.aspx | 19 +- .../SupplierData/SCP_ASN_DETAIL.aspx.cs | 47 +- .../SCP_ASN_DETAIL.aspx.designer.cs | 82 +- .../SupplierData/SCP_ASN_DETAIL_Modify.aspx | 72 ++ .../SCP_ASN_DETAIL_Modify.aspx.cs | 112 +++ .../SCP_ASN_DETAIL_Modify.aspx.designer.cs} | 113 +-- .../SupplierData/SCP_FORECAST.aspx | 101 +++ .../SupplierData/SCP_FORECAST.aspx.cs | 239 ++++++ .../SCP_FORECAST.aspx.designer.cs} | 128 +-- .../SupplierData/SCP_INVOICE.aspx | 23 +- .../SupplierData/SCP_INVOICE.aspx.cs | 45 +- .../SupplierData/SCP_INVOICE.aspx.designer.cs | 111 ++- .../SupplierData/SCP_INVOICE_CREATE.aspx | 55 +- .../SupplierData/SCP_INVOICE_CREATE.aspx.cs | 88 +-- .../SCP_INVOICE_CREATE.aspx.designer.cs | 53 +- .../SupplierData/SCP_INVOICE_EDIT.aspx | 120 ++- .../SupplierData/SCP_INVOICE_EDIT.aspx.cs | 107 ++- .../SCP_INVOICE_EDIT.aspx.designer.cs | 198 +++-- .../SupplierData/SCP_RECEIVE_LIST.aspx | 101 ++- .../SupplierData/SCP_RECEIVE_LIST.aspx.cs | 150 +++- .../SCP_RECEIVE_LIST.aspx.designer.cs | 168 +++- .../SupplierData/SCP_TS_BARCODE.aspx | 75 ++ .../SupplierData/SCP_TS_BARCODE.aspx.cs | 123 +++ .../SCP_TS_BARCODE.aspx.designer.cs | 161 ++++ .../SupplierData/SCP_WMS_STOCK_REPORT.aspx | 62 ++ .../SupplierData/SCP_WMS_STOCK_REPORT.aspx.cs | 118 +++ .../SCP_WMS_STOCK_REPORT.aspx.designer.cs | 125 +++ .../WarehouseData/SCP_INVOICE.aspx | 47 +- .../WarehouseData/SCP_INVOICE.aspx.cs | 92 +-- .../WarehouseData/SCP_INVOICE_CONFIRM.aspx | 36 +- .../WarehouseData/SCP_INVOICE_CONFIRM.aspx.cs | 25 +- .../SCP_INVOICE_CONFIRM_DETAIL.aspx | 103 ++- .../SCP_INVOICE_CONFIRM_DETAIL.aspx.cs | 87 ++- ...CP_INVOICE_CONFIRM_DETAIL.aspx.designer.cs | 154 ++-- .../WarehouseData/SCP_INVOICE_DELTAIL.aspx | 137 +++- .../WarehouseData/SCP_INVOICE_DELTAIL.aspx.cs | 87 ++- .../SCP_INVOICE_DELTAIL.aspx.designer.cs | 152 ++-- .../SCP_INVOICE_DELTAIL_RED.aspx | 146 ---- .../SCP_INVOICE_DELTAIL_RED.aspx.cs | 495 ------------ .../SCP_INVOICE_DELTAIL_RED.aspx.designer.cs | 303 ------- .../WarehouseData/SCP_INVOICE_RED.aspx | 122 --- .../WarehouseData/SCP_INVOICE_RED.aspx.cs | 231 ------ .../SCP_INVOICE_RED.aspx.designer.cs | 231 ------ .../SCP_INVOICE_VIEW_DETAIL_RED.aspx | 110 --- .../SCP_INVOICE_VIEW_DETAIL_RED.aspx.cs | 291 ------- ...P_INVOICE_VIEW_DETAIL_RED.aspx.designer.cs | 222 ------ .../WarehouseData/SCP_INVOICE_VIEW_RED.aspx | 137 ---- .../SCP_INVOICE_VIEW_RED.aspx.cs | 191 ----- .../SCP_INVOICE_VIEW_RED.aspx.designer.cs | 276 ------- 181 files changed, 9933 insertions(+), 6546 deletions(-) create mode 100644 Controller/SCP_MoldSharing_Controller.cs create mode 100644 Models/ScpEntity/ExcelExportEnttity/SCP_MOLDSHARING_EXPORT.cs create mode 100644 Models/ScpEntity/ExcelExportEnttity/SCP_OTD_VendId_REPORT_EXPORT.cs create mode 100644 Models/ScpEntity/ExcelImportEntity/SCP_ASN_EXCEL.cs create mode 100644 Models/ScpEntity/TA_MOLDSHARING_INVOICE.cs create mode 100644 Models/ScpEntity/TA_MoldSharing.cs create mode 100644 Models/ScpEntity/V_TS_BARCODE.cs create mode 100644 Models/WmsEntity/VIEW_STOCK_REPORT.cs create mode 100644 SCP/Admin/UNIAPI.aspx create mode 100644 SCP/Admin/UNIAPI.aspx.cs create mode 100644 SCP/Admin/UNIAPI.aspx.designer.cs create mode 100644 SCP/Views/BasicData/SCP_MOLDSHARING_DETAIL.aspx create mode 100644 SCP/Views/BasicData/SCP_MOLDSHARING_DETAIL.aspx.cs create mode 100644 SCP/Views/BasicData/SCP_MOLDSHARING_DETAIL.aspx.designer.cs create mode 100644 SCP/Views/BasicData/SCP_MoldSharing.aspx create mode 100644 SCP/Views/BasicData/SCP_MoldSharing.aspx.cs rename SCP/Views/{沈阳金杯/SCP_PO_DETAIL.aspx.designer.cs => BasicData/SCP_MoldSharing.aspx.designer.cs} (79%) create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_ASK_DETAIL_PARTCODE.aspx create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_ASK_DETAIL_PARTCODE.aspx.cs create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_ASK_DETAIL_PARTCODE.aspx.designer.cs create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_FORECAST.aspx create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_FORECAST.aspx.cs rename SCP/Views/沈阳金杯/{SCP_PO_ARRIVE.aspx.designer.cs => PlanData/SCP_FORECAST.aspx.designer.cs} (76%) create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_PRODUCT_DETAIL.aspx create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_PRODUCT_DETAIL.aspx.cs create mode 100644 SCP/Views/沈阳金杯/PlanData/SCP_PRODUCT_DETAIL.aspx.designer.cs create mode 100644 SCP/Views/沈阳金杯/Report/SCP_FORECAST_REPORT.aspx create mode 100644 SCP/Views/沈阳金杯/Report/SCP_FORECAST_REPORT.aspx.cs create mode 100644 SCP/Views/沈阳金杯/Report/SCP_FORECAST_REPORT.aspx.designer.cs delete mode 100644 SCP/Views/沈阳金杯/SCP_PO.aspx delete mode 100644 SCP/Views/沈阳金杯/SCP_PO.aspx.cs delete mode 100644 SCP/Views/沈阳金杯/SCP_PO_ARRIVE.aspx delete mode 100644 SCP/Views/沈阳金杯/SCP_PO_ARRIVE.aspx.cs delete mode 100644 SCP/Views/沈阳金杯/SCP_PO_DETAIL.aspx delete mode 100644 SCP/Views/沈阳金杯/SCP_PO_DETAIL.aspx.cs delete mode 100644 SCP/Views/沈阳金杯/SCP_PO_STATISTICS.aspx delete mode 100644 SCP/Views/沈阳金杯/SCP_PO_STATISTICS.aspx.cs create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_ASN_DETAIL_Modify.aspx create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_ASN_DETAIL_Modify.aspx.cs rename SCP/Views/沈阳金杯/{SCP_PO.aspx.designer.cs => SupplierData/SCP_ASN_DETAIL_Modify.aspx.designer.cs} (62%) create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_FORECAST.aspx create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_FORECAST.aspx.cs rename SCP/Views/沈阳金杯/{SCP_PO_STATISTICS.aspx.designer.cs => SupplierData/SCP_FORECAST.aspx.designer.cs} (76%) create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_TS_BARCODE.aspx create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_TS_BARCODE.aspx.cs create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_TS_BARCODE.aspx.designer.cs create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_WMS_STOCK_REPORT.aspx create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_WMS_STOCK_REPORT.aspx.cs create mode 100644 SCP/Views/沈阳金杯/SupplierData/SCP_WMS_STOCK_REPORT.aspx.designer.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_DELTAIL_RED.aspx delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_DELTAIL_RED.aspx.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_DELTAIL_RED.aspx.designer.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_RED.aspx delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_RED.aspx.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_RED.aspx.designer.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_VIEW_DETAIL_RED.aspx delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_VIEW_DETAIL_RED.aspx.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_VIEW_DETAIL_RED.aspx.designer.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_VIEW_RED.aspx delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_VIEW_RED.aspx.cs delete mode 100644 SCP/Views/沈阳金杯/WarehouseData/SCP_INVOICE_VIEW_RED.aspx.designer.cs diff --git a/Controller/CK.SCP.Controller.csproj b/Controller/CK.SCP.Controller.csproj index 64d5a9a..b2f6237 100644 --- a/Controller/CK.SCP.Controller.csproj +++ b/Controller/CK.SCP.Controller.csproj @@ -59,6 +59,7 @@ + diff --git a/Controller/SCP_ASK_CONTROLLER.cs b/Controller/SCP_ASK_CONTROLLER.cs index a151d60..8ac1263 100644 --- a/Controller/SCP_ASK_CONTROLLER.cs +++ b/Controller/SCP_ASK_CONTROLLER.cs @@ -31,7 +31,7 @@ namespace CK.SCP.Controller } if (!string.IsNullOrEmpty(p_entity.ErpBillNum)) { - q = q.Where(p => p.ErpBillNum .Contains(p_entity.ErpBillNum)); + q = q.Where(p => p.ErpBillNum.Contains(p_entity.ErpBillNum)); } if (!string.IsNullOrEmpty(p_entity.AskBillNum)) { @@ -61,10 +61,18 @@ namespace CK.SCP.Controller { q = q.Where(p => p.BeginTime >= p_entity.BeginTime); } + if (p_entity.BeginTime_End != null) + { + q = q.Where(p => p.BeginTime <= p_entity.BeginTime_End); + } if (p_entity.EndTime != null) { q = q.Where(p => p.EndTime <= p_entity.EndTime); } + if (p_entity.EndTime_start != null) + { + q = q.Where(p => p.EndTime >= p_entity.EndTime_start); + } if (!string.IsNullOrEmpty(p_entity.VendName)) { q = q.Where(p => p.VendName.Contains(p_entity.VendName)); @@ -175,20 +183,20 @@ namespace CK.SCP.Controller using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { foreach (var itm in p_entitys) - { + { var _entity = db.TB_ASK_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault(); - _entity.ReduceQty= itm.ReduceQty; + _entity.ReduceQty = itm.ReduceQty; _entity.Remark = itm.Remark; - var asn = db.V_TB_ASN_DETAIL.Where(p => p.PoBillNum == itm.PoBillNum &&p.AskBillNum==itm.AskBillNum && p.IsDeleted == false ) - .GroupBy(p => new { p.PoBillNum,p.AskBillNum, p.PoLine, p.PartCode }) - .Select(p => new { AsSum = p.Sum(item => item.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode,AskBillNum=p.Key.AskBillNum }); + var asn = db.V_TB_ASN_DETAIL.Where(p => p.PoBillNum == itm.PoBillNum && p.AskBillNum == itm.AskBillNum && p.IsDeleted == false) + .GroupBy(p => new { p.PoBillNum, p.AskBillNum, p.PoLine, p.PartCode }) + .Select(p => new { AsSum = p.Sum(item => item.Qty), PoLine = p.Key.PoLine, PoBillNum = p.Key.PoBillNum, PartCode = p.Key.PartCode, AskBillNum = p.Key.AskBillNum }); asn.ToList().ForEach(itm1 => { - if (itm.PoBillNum == itm1.PoBillNum && itm.PoLine == itm1.PoLine && itm.PartCode == itm1.PartCode && itm.AskBillNum==itm1.AskBillNum) + if (itm.PoBillNum == itm1.PoBillNum && itm.PoLine == itm1.PoLine && itm.PartCode == itm1.PartCode && itm.AskBillNum == itm1.AskBillNum) { - if (itm.ReduceQty > itm.AskQty - itm1.AsSum ) + if (itm.ReduceQty > itm.AskQty - itm1.AsSum) { - _ret.MessageList.Add(string.Format("零件编号{0}零件名称{1}减产数量>要货数量-发货数量",itm.PartCode,itm.PartDesc1+itm.PartDesc2)); + _ret.MessageList.Add(string.Format("零件编号{0}零件名称{1}减产数量>要货数量-发货数量", itm.PartCode, itm.PartDesc1 + itm.PartDesc2)); } } }); @@ -273,7 +281,7 @@ namespace CK.SCP.Controller { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { - var _list=p_list.Select(itm => itm.UID).ToList(); + var _list = p_list.Select(itm => itm.UID).ToList(); var _ls = db.TB_ASK_DETAIL.Where(p => _list.Contains(p.UID)).ToList(); db.TB_ASK_DETAIL.RemoveRange(_ls); if (db.SaveChanges() != -1) @@ -486,15 +494,15 @@ namespace CK.SCP.Controller { //var _detail = p_list[0]; foreach (V_TB_INCOMPLETE_ASK _detail in p_list) - { - var reject = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK&&p.BillType==3).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { RejectSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); + { + var reject = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.BillType == 3).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { RejectSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); reject.ToList().ForEach(itm => { if (_detail.AskBillNum == itm.Remark && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode) { - _detail.Number = _detail.Number+Math.Abs( itm.RejectSum); + _detail.Number = _detail.Number + Math.Abs(itm.RejectSum); } - }); + }); } } } @@ -522,8 +530,8 @@ namespace CK.SCP.Controller //退货数量 var back = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.Qty < 0).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { ArriveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); //开票数量 - var invoice = db.V_TB_INVOICE_ASK.Where(p => p.Remark == _detail.AskBillNum && p.State == (int)ReceiveState.Check && p.BillType == 0) - .GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { InvoiceQty = p.Sum(itm => itm.InvoiceQty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); + var invoice = db.V_TB_INVOICE_DETAIL.Where(p => p.AskBillNum == _detail.AskBillNum) + .GroupBy(p => new { p.AskBillNum, p.PoLineNum, p.PartCode }).Select(p => new { InvoiceQty = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLineNum, AskBillNum = p.Key.AskBillNum, PartCode = p.Key.PartCode }); //寄售退货 var reject = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.BillType == 3).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { RejectSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); reject.ToList().ForEach(itm => @@ -535,7 +543,7 @@ namespace CK.SCP.Controller }); invoice.ToList().ForEach(itm => { - if (_detail.AskBillNum == itm.Remark && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode) + if (_detail.AskBillNum == itm.AskBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode) { _detail.InvoiceQty = itm.InvoiceQty; } @@ -583,20 +591,20 @@ namespace CK.SCP.Controller var rec = db.TB_RECEIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ReceiveState.Check && p.BillType == 0) .GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { ReceiveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); - // var reject = db.TB_RECEIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)RejectState.Check && p.BillType == 1).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { RejectSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark , PartCode = p.Key.PartCode }); - //发货 + // var reject = db.TB_RECEIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)RejectState.Check && p.BillType == 1).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { RejectSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark , PartCode = p.Key.PartCode }); + //发货 var asn = db.V_TB_ASN_DETAIL.Where(p => p.AskBillNum == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)AsnState.Ship) .GroupBy(p => new { p.AskBillNum, p.PoLine, p.PartCode }) .Select(p => new { AsSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, AskBillNum = p.Key.AskBillNum, PartCode = p.Key.PartCode }); //var arrive = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.BillType == (int)ArriveBillType.Receive).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { ArriveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); //到货 - var arrive = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK &&p.Qty>0 ).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { ArriveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); + var arrive = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.Qty > 0).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { ArriveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); //退货 var reject = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == _detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.Qty < 0).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { ArriveSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); - - var invoice = db.V_TB_INVOICE_ASK.Where(p => p.Remark == _detail.AskBillNum && p.State == (int)ReceiveState.Check && p.BillType == 0) - .GroupBy(p => new { p.Remark, p.PoLine, p.PartCode }).Select(p => new { InvoiceQty = p.Sum(itm => itm.InvoiceQty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode }); + //发票 + var invoice = db.V_TB_INVOICE_DETAIL.Where(p => p.AskBillNum == _detail.AskBillNum) + .GroupBy(p => new { p.AskBillNum, p.PoLineNum, p.PartCode }).Select(p => new { InvoiceQty = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLineNum, AskBillNum = p.Key.AskBillNum, PartCode = p.Key.PartCode }); _detail.PartDesc1 = _detail.PartDesc1 + _detail.PartDesc2; rec.ToList().ForEach(itm => @@ -640,13 +648,13 @@ namespace CK.SCP.Controller invoice.ToList().ForEach(itm => { - if (_detail.AskBillNum == itm.Remark && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode) + if (_detail.AskBillNum == itm.AskBillNum && _detail.PoLine == itm.PoLine && _detail.PartCode == itm.PartCode) { _detail.InvoiceQty = itm.InvoiceQty; } }); - _detail.OnRoadQty = Convert.ToDecimal( _detail.ShippedQty) - _detail.ArriveQty; + _detail.OnRoadQty = Convert.ToDecimal(_detail.ShippedQty) - _detail.ArriveQty; } } @@ -658,13 +666,13 @@ namespace CK.SCP.Controller { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { - + if (p_list.ToList().Count > 0) { foreach (V_TB_ASK _detail in p_list) { _detail.Month = Convert.ToDateTime(_detail.EndTime).Month.ToString() + "月订单"; - if (_detail.State==0|| _detail.State==1|| _detail.State == 2) + if (_detail.State == 0 || _detail.State == 1 || _detail.State == 2) { continue; @@ -674,7 +682,7 @@ namespace CK.SCP.Controller continue; } var _ask = db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == _detail.AskBillNum && p.IsDeleted == false).ToList(); - var _ask_can= Get_CAN_SHIPQTY(_ask.ToList()).Where(p=>p.CanQty>0).ToList(); + var _ask_can = Get_CAN_SHIPQTY(_ask.ToList()).Where(p => p.CanQty > 0).ToList(); if (_ask_can.Count != 0) { @@ -687,7 +695,7 @@ namespace CK.SCP.Controller //_detail.Flag = (_ask_can.Count).ToString()+ "/" +(_ask.Count).ToString(); //_detail.Month = _detail.CreateTime.Month.ToString() + "月订单"; } - + } } return p_list; @@ -703,10 +711,10 @@ namespace CK.SCP.Controller DateTime beginTime = DateTime.Now; DateTime endTime = DateTime.Now; foreach (var itm in p_entitys) - { + { var _entity = db.TB_ASK_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault(); - askBill=_entity.AskBillNum; - _entity.BeginTime =(DateTime) itm.BeginTime; + askBill = _entity.AskBillNum; + _entity.BeginTime = (DateTime)itm.BeginTime; beginTime = (DateTime)itm.BeginTime; _entity.EndTime = (DateTime)itm.EndTime; endTime = (DateTime)itm.EndTime; @@ -796,7 +804,7 @@ namespace CK.SCP.Controller } return _ret; } - public static ResultObject Save_TB_ASK_DETAIL(List p_entitys,AskState p_state) + public static ResultObject Save_TB_ASK_DETAIL(List p_entitys, AskState p_state) { ResultObject _ret = new ResultObject(); try @@ -808,6 +816,10 @@ namespace CK.SCP.Controller itm.State = (int)p_state; var _entity = db.TB_ASK_DETAIL.Where(p => p.UID == itm.UID).FirstOrDefault(); _entity.AskQty = itm.AskQty; + if (itm.EndTime != null) + { + _entity.EndTime = itm.EndTime; + } db.TB_ASK_DETAIL.AddOrUpdate(p => p.UID, _entity); } if (_ret.MessageList.Count > 0) @@ -827,14 +839,15 @@ namespace CK.SCP.Controller { var _entityList = db.V_TB_ASK_DETAIL.Where(p => _ls.Contains(p.UID)).ToList(); - var _item= _entityList.FirstOrDefault(); + var _item = _entityList.FirstOrDefault(); if (_item.AskBillNum.Contains("U")) { - var _planList = db1.TB_PO_PLAN_EXTEND.Where(p => p.Domain == _item.Site && p.EndTime == _item.EndTime && p.PoBillNum == _item.PoBillNum).ToList(); - _planList.ForEach(p => { + var _planList = db1.TB_PO_PLAN_EXTEND.Where(p => p.Domain == _item.Site && p.EndTime == _item.EndTime && p.PoBillNum == _item.PoBillNum).ToList(); + _planList.ForEach(p => + { - var _first = _entityList.Where(itm => itm.PoBillNum == p.PoBillNum && itm.PartCode == p.PartCode && itm.EndTime == p.EndTime).FirstOrDefault(); + var _first = _entityList.Where(itm => itm.PoBillNum == p.PoBillNum && itm.PartCode == p.PartCode && itm.EndTime == p.EndTime).FirstOrDefault(); if (_first != null) { p.PlanQty = _first.AskQty; @@ -872,7 +885,7 @@ namespace CK.SCP.Controller throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); } catch (OptimisticConcurrencyException ex)//并发冲突异常 - { + { _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.ErrorList.Add(ex); @@ -887,7 +900,7 @@ namespace CK.SCP.Controller LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_TB_ASK_DETAIL", ex.ToString()); if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) { - var inner = (UpdateException)ex.InnerException; + var inner = (UpdateException)ex.InnerException; throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); } else @@ -953,7 +966,7 @@ namespace CK.SCP.Controller } catch (OptimisticConcurrencyException ex)//并发冲突异常 { - + _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.ErrorList.Add(ex); @@ -962,7 +975,7 @@ namespace CK.SCP.Controller } catch (ScpException ex) { - + _ret.State = ReturnStatus.Failed; _ret.Result = false; @@ -973,7 +986,7 @@ namespace CK.SCP.Controller { var inner = (UpdateException)ex.InnerException; - + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); } else @@ -996,8 +1009,8 @@ namespace CK.SCP.Controller { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { - var _list=db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_askBillNum && p.IsDeleted==false).ToList(); - var _lst=Get_CAN_SHIPQTY(_list); + var _list = db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_askBillNum && p.IsDeleted == false).ToList(); + var _lst = Get_CAN_SHIPQTY(_list); if (_lst.Select(p => p.CanQty).Sum() <= 0) { @@ -1014,8 +1027,8 @@ namespace CK.SCP.Controller { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { - var _ask= db.TB_ASK.Where(p => p.AskBillNum == p_ask.AskBillNum).FirstOrDefault(); - _ask=ConvertHelper.GetObjectClone(_ask); + var _ask = db.TB_ASK.Where(p => p.AskBillNum == p_ask.AskBillNum).FirstOrDefault(); + _ask = ConvertHelper.GetObjectClone(_ask); _ask.AskBillNum = SCP_BILLCODE_CONTROLLER.MakeASKCode(); _ask.GUID = Guid.NewGuid(); @@ -1035,7 +1048,7 @@ namespace CK.SCP.Controller int state = db.SaveChanges(); if (state != -1) { - _ret.MessageList.Add("复制要货单号"+_ask.AskBillNum+",请去要货明细修改要货单订货日期和要货日期"); + _ret.MessageList.Add("复制要货单号" + _ask.AskBillNum + ",请去要货明细修改要货单订货日期和要货日期"); _ret.State = ReturnStatus.Succeed; _ret.Result = true; } @@ -1109,7 +1122,7 @@ namespace CK.SCP.Controller - public static ResultObject Save_ASK_TO_ASN(V_TB_ASK p_ask, List p_order_list,string p_PlateNumber + public static ResultObject Save_ASK_TO_ASN(V_TB_ASK p_ask, List p_order_list, string p_PlateNumber , string p_buyer, string p_buyerPhone) { ResultObject _ret = new ResultObject(); @@ -1121,7 +1134,7 @@ namespace CK.SCP.Controller _t.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode(); _t.AskBillNum = p_ask.AskBillNum; _t.PoBillNum = p_ask.PoBillNum; - _t.ReceivedPort = p_ask.ReceivedPort; + _t.ReceivedPort = p_ask.ReceivedPort; _t.CreateUser = p_buyer; _t.CreateTime = DateTime.Now; _t.UpdateUser = p_buyer; @@ -1129,7 +1142,7 @@ namespace CK.SCP.Controller _t.ReceiveUser = p_ask.Buyer; _t.ReceiveTime = p_ask.BeginTime; _t.VendId = p_ask.VendId; - _t.IsDeleted= false;//操作员 + _t.IsDeleted = false;//操作员 _t.CreateTime = DateTime.Now; _t.CreateUser = p_buyer; _t.Site = p_ask.Site; @@ -1142,7 +1155,7 @@ namespace CK.SCP.Controller _t.ShipTime = p_ask.ShipTime; _t.ReceiveTime = p_ask.ReceiveTime; db.TB_ASN.AddOrUpdate(p => p.AsnBillNum, _t); - List _list = new List(); + List _list = new List(); foreach (var itm in p_order_list) { TB_ASN_DETAIL _tDetail = new TB_ASN_DETAIL(); @@ -1158,21 +1171,21 @@ namespace CK.SCP.Controller else { _tDetail.VendBatch = itm.Batch; - } - _tDetail.PackQty = itm.PackQty==0?1:itm.PackQty; + } + _tDetail.PackQty = itm.PackQty == 0 ? 1 : itm.PackQty; _tDetail.PartCode = itm.PartCode; _tDetail.State = (int)AsnState.New; _tDetail.Qty = (decimal)itm.TempQty; _tDetail.Price = itm.Price; _tDetail.EndTime = itm.EndTime; - _tDetail.CreateTime =_t.CreateTime; - _tDetail.CreateUser =_t.CreateUser; + _tDetail.CreateTime = _t.CreateTime; + _tDetail.CreateUser = _t.CreateUser; _tDetail.ProduceDate = itm.ProduceDate; _tDetail.IsDeleted = false; _tDetail.DockCode = itm.ReceivedPort; _tDetail.LocUnit = itm.LocUnit; _tDetail.UnConv = itm.UnConv; - _tDetail.State =_t.State; + _tDetail.State = _t.State; _tDetail.UpdateInfo = itm.UpdateInfo; _tDetail.ReceivedPort = itm.ReceivedPort; _tDetail.GUID = Guid.NewGuid(); @@ -1184,11 +1197,11 @@ namespace CK.SCP.Controller int state = db.SaveChanges(); if (state != -1) { - var _askDetailList= db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted == false).ToList();//查询要货单明细 + var _askDetailList = db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted == false).ToList();//查询要货单明细 var _lst = Get_CAN_SHIPQTY(_askDetailList);//算出可发数量 if (_lst.Select(p => p.CanQty).Sum() <= 0)//可发数量为零时,修改状态 { - var _ary=db.TB_ASK.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted == false).ToList(); + var _ary = db.TB_ASK.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted == false).ToList(); _ary.ForEach(p => p.State = (int)AskState.Ship); if (_ary.Count() > 0) { @@ -1225,7 +1238,7 @@ namespace CK.SCP.Controller } catch (OptimisticConcurrencyException ex)//并发冲突异常 { - + _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.ErrorList.Add(ex); @@ -1265,7 +1278,7 @@ namespace CK.SCP.Controller { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { - var _ls = p_list.Select(p => p.AskBillNum); + var _ls = p_list.Select(p => p.AskBillNum); StringBuilder _buffer = new StringBuilder(); _buffer.Append(" select distinct (C.AskBillNum)from V_TB_ASK_DETAIL C"); _buffer.Append(" left JOIN "); @@ -1273,21 +1286,68 @@ namespace CK.SCP.Controller _buffer.Append(" group by a.PoLine, a.AskBillNum, a.PartCode) AS D "); _buffer.Append(" ON C.AskBillNum = D.AskBillNum AND C.PoLine = D.PoLine AND C.PartCode = D.PartCode "); _buffer.Append(" WHERE C.AskQty>isnull(D.Qty,0)"); - _buffer.Append(" and c.AskBillNum in ('{0}')"); + _buffer.Append(" and c.AskBillNum in ('{0}')"); var _str = string.Format(_buffer.ToString(), string.Join("','", _ls.ToArray())); - var _list= db.Database.SqlQuery(_str).ToList(); - - p_list.ForEach(p => { - p.IsComplete = true; - if (_list.Contains(p.AskBillNum)) - { - p.IsComplete = false; - } - }); + var _list = db.Database.SqlQuery(_str).ToList(); + + p_list.ForEach(p => + { + p.IsComplete = true; + if (_list.Contains(p.AskBillNum)) + { + p.IsComplete = false; + } + }); } return p_list; } + public static decimal Get_ASN_DETAIL_CAN(V_TB_ASK_DETAIL p_asn_detail) + { + decimal _canqty = 0; + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + if (p_asn_detail != null) + { + var ask = db.V_TB_ASK_DETAIL.FirstOrDefault(p => p.IsDeleted == false && p_asn_detail.AskBillNum == p.AskBillNum && p.PartCode == p_asn_detail.PartCode + && p.PoLine == p_asn_detail.PoLine && p.PoBillNum == p_asn_detail.PoBillNum); + if (ask != null) + { + p_asn_detail = ask; + var list = db.V_TB_ASN_DETAIL.Where(p => p.IsDeleted == false && p_asn_detail.AskBillNum == p.AskBillNum && p.PartCode == p_asn_detail.PartCode + && p.PoLine == p_asn_detail.PoLine && p.PoBillNum == p_asn_detail.PoBillNum).ToList(); + var list_back = db.TB_ARRIVE_DETAIL.Where(p => p.Remark == p_asn_detail.AskBillNum && p.IsDeleted == false && p.State == (int)ArriveState.OK && p.Qty < 0 && p.BillType == 3 + && p.PartCode == p_asn_detail.PartCode && p.PoLine == p_asn_detail.PoLine && p.PoBillNum == p_asn_detail.PoBillNum).GroupBy(p => new { p.Remark, p.PoLine, p.PartCode, p.PoBillNum }).Select(p => new { BackSum = p.Sum(itm => itm.Qty), PoLine = p.Key.PoLine, Remark = p.Key.Remark, PartCode = p.Key.PartCode, PoBillNum = p.Key.PoBillNum }).ToList(); + var groupList = list.GroupBy(p => new { p.PoBillNum, p.PoLine, p.PartCode, p.AskBillNum }).Select( + p => new + { + ShipSum = p.Sum(itm => itm.Qty), + PoLine = p.Key.PoLine, + PoBillNum = p.Key.PoBillNum, + PartCode = p.Key.PartCode, + AskBillNum = p.Key.AskBillNum + }).ToList(); + groupList.ForEach(p => + { + if (p.PoBillNum == p_asn_detail.PoBillNum && p.PoLine == p_asn_detail.PoLine && p.PartCode == p_asn_detail.PartCode) + { + p_asn_detail.ShippedQty = p.ShipSum; + } + }); + list_back.ForEach(p => + { + if (p.PoBillNum == p_asn_detail.PoBillNum && p.PoLine == p_asn_detail.PoLine && p.PartCode == p_asn_detail.PartCode) + { + p_asn_detail.RejectQty = Math.Abs(p.BackSum);//寄售退货数 + } + }); + decimal a = p_asn_detail.AskQty - (p_asn_detail.ShippedQty == null ? 0 : (decimal)p_asn_detail.ShippedQty) + p_asn_detail.RejectQty - (p_asn_detail.ReduceQty == null ? 0 : (decimal)p_asn_detail.ReduceQty); + _canqty = a; + } + } + } + return _canqty; + } public static List Get_CAN_SHIPQTY(List p_list) { using (ScpEntities db = EntitiesFactory.CreateScpInstance()) @@ -1323,7 +1383,7 @@ namespace CK.SCP.Controller if (p.PoBillNum == itm.PoBillNum && p.PoLine == itm.PoLine && p.PartCode == itm.PartCode) { itm.RejectQty = Math.Abs(p.BackSum);//寄售退货数 - } + } }); decimal a = itm.AskQty - (itm.ShippedQty == null ? 0 : (decimal)itm.ShippedQty) + itm.RejectQty - (itm.ReduceQty == null ? 0 : (decimal)itm.ReduceQty); itm.CanQty = a; @@ -1332,7 +1392,7 @@ namespace CK.SCP.Controller } } - if(p_list.Count>0) + if (p_list.Count > 0) { return p_list; } @@ -1355,7 +1415,7 @@ namespace CK.SCP.Controller } if (!string.IsNullOrEmpty(p_entity.PoBillNum)) { - q = q.Where(p => p.PoBillNum==p_entity.PoBillNum); + q = q.Where(p => p.PoBillNum == p_entity.PoBillNum); } if (p_entity.PoLine != 0) { @@ -1363,7 +1423,7 @@ namespace CK.SCP.Controller } if (!string.IsNullOrEmpty(p_entity.PartCode)) { - q = q.Where(p => p.PartCode==p_entity.PartCode); + q = q.Where(p => p.PartCode == p_entity.PartCode); } if (p_entity.ShippedQty != null && p_entity.ShippedQty != 0) { @@ -1378,9 +1438,9 @@ namespace CK.SCP.Controller q = q.Where(p => p.PoUnit.Contains(p_entity.PoUnit)); } - if (p_entity.EndTime!=null) + if (p_entity.EndTime != null) { - q = q.Where(p =>p_entity.EndTime< p.EndTime); + q = q.Where(p => p_entity.EndTime < p.EndTime); } if (!string.IsNullOrEmpty(p_entity.LocUnit)) { @@ -1421,7 +1481,7 @@ namespace CK.SCP.Controller if (!string.IsNullOrEmpty(p_entity.Site)) { - q = q.Where(p => p.Site==p_entity.Site); + q = q.Where(p => p.Site == p_entity.Site); } if (!string.IsNullOrEmpty(p_entity.VendName)) { @@ -1429,12 +1489,12 @@ namespace CK.SCP.Controller } if (!string.IsNullOrEmpty(p_entity.VendId)) { - q = q.Where(p => p.VendId==p_entity.VendId); + q = q.Where(p => p.VendId == p_entity.VendId); } if (!string.IsNullOrEmpty(p_entity.AskBillNum)) { - q = q.Where(p => p.AskBillNum==p_entity.AskBillNum); + q = q.Where(p => p.AskBillNum == p_entity.AskBillNum); } @@ -1498,9 +1558,9 @@ namespace CK.SCP.Controller } - public static void Get_V_TB_ASK_DETAIL_Sum(V_TB_ASK_DETAIL p_entity,Action>> p_action) + public static void Get_V_TB_ASK_DETAIL_Sum(V_TB_ASK_DETAIL p_entity, Action>> p_action) { - + ResultObject> _ret = new ResultObject>(); try { @@ -1509,7 +1569,7 @@ namespace CK.SCP.Controller IQueryable q = db.V_TB_ASK_DETAIL; if (p_entity.UID != 0) { - + q = q.Where(p => p.UID == p_entity.UID); } if (!string.IsNullOrEmpty(p_entity.PoBillNum)) @@ -1524,7 +1584,7 @@ namespace CK.SCP.Controller { q = q.Where(p => p.PartCode.Contains(p_entity.PartCode)); } - if (p_entity.ShippedQty!=null && p_entity.ShippedQty != 0) + if (p_entity.ShippedQty != null && p_entity.ShippedQty != 0) { q = q.Where(p => p.ShippedQty == p_entity.ShippedQty); } @@ -1564,15 +1624,15 @@ namespace CK.SCP.Controller { q = q.Where(p => p.State == p_entity.State); } - + if (!string.IsNullOrEmpty(p_entity.CreateUser)) { q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser)); } - + q = q.Where(p => p.IsDeleted == p_entity.IsDeleted); - - + + if (!string.IsNullOrEmpty(p_entity.Site)) { q = q.Where(p => p.Site.Contains(p_entity.Site)); @@ -1581,11 +1641,11 @@ namespace CK.SCP.Controller { q = q.Where(p => p.VendName.Contains(p_entity.VendName)); } - + if (!string.IsNullOrEmpty(p_entity.AskBillNum)) { q = q.Where(p => p.AskBillNum.Contains(p_entity.AskBillNum)); - } + } _ret.State = ReturnStatus.Succeed; _ret.Result = q; p_action(_ret); @@ -1610,7 +1670,7 @@ namespace CK.SCP.Controller } catch (OptimisticConcurrencyException ex)//并发冲突异常 { - + _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List", ex.ToString()); @@ -1618,7 +1678,7 @@ namespace CK.SCP.Controller } catch (ScpException ex) { - + _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(ex); @@ -1628,7 +1688,7 @@ namespace CK.SCP.Controller { var inner = (UpdateException)ex.InnerException; - + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); } else @@ -1639,16 +1699,106 @@ namespace CK.SCP.Controller catch (Exception e) { - + _ret.State = ReturnStatus.Failed; _ret.ErrorList.Add(e); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Get_V_TB_ASK_DETAIL_List", e.Message); throw e; - } + } } + /// + /// 沈阳金杯 + /// + /// + /// + /// + public static ResultObject Save_TB_ASK(string _num, string p_remark) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + var _ls = db.TB_ASK.FirstOrDefault(p => p.AskBillNum == _num); + if (_ls != null) + { + _ls.Remark = p_remark; + db.TB_ASK.AddOrUpdate(_ls); + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "无法找到看板!"; + } + if (string.IsNullOrEmpty(_ret.Message)) + { + if (db.SaveChanges() != -1) + { + _ret.State = ReturnStatus.Succeed; + _ret.Result = true; + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "数据更新失败!"; + } + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); - + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_TB_ASK_STATE", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_TB_ASK_STATE", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_TB_ASK_STATE", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_TB_ASK_STATE", e.Message); + _ret.Result = false; + _ret.ErrorList.Add(e); + throw e; + } + return _ret; + } public static ResultObject Save_TB_ASK_STATE(List p_list, AskState p_state) { @@ -1662,14 +1812,28 @@ namespace CK.SCP.Controller var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); if (_ls.Count > 0) { - _ls.ForEach(p => { - p.State = (int)AskState.Close; - var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); - _list.ForEach(itm => itm.State = (int)AskState.Close); - db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); + _ls.ForEach(p => + { + var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList(); + if (_asnlist.Count > 0) + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!"); + } + else + { + p.State = (int)AskState.Close; + var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); + _list.ForEach(itm => itm.State = (int)AskState.Close); + db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); + } } ); - db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); + if (_ret.MessageList.Count == 0) + { + db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); + } } else { @@ -1678,152 +1842,176 @@ namespace CK.SCP.Controller _ret.Message = "选择的记录,不能关闭!"; } } - if (p_state == AskState.Confirm) + if (p_state == AskState.Complete) + { + var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); + int count = _ls.Count(p => p.State == (int)AskState.Ship); + if (count == _ls.Count && _ls.Count > 0) { - var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); - int count = _ls.Count(p => p.State == (int)AskState.Release); - if (count == _ls.Count && _ls.Count > 0) + _ls.ForEach(p => { - _ls.ForEach(p => { - p.State = (int)AskState.Confirm; + var _asnlist = db.TB_ASN.Where(x => x.AskBillNum == p.AskBillNum && x.State == (int)AsnState.New).ToList(); + if (_asnlist.Count > 0) + { + _ret.MessageList.Add(p.AskBillNum + "存在未发货的发货单!"); + } + else + { + p.State = (int)AskState.Complete; var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); - _list.ForEach(itm => { - - itm.State = (int)AskState.Confirm; - - itm.UpdateTime = DateTime.Now; - } - - ); + _list.ForEach(itm => itm.State = (int)AskState.Complete); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); - #region 供应商确认要货状态完成 - //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList(); - //_pendingList.ForEach(itm => { - // itm.ITEM_STATE = (int)PENDING_STATE.COMPLETED; - // itm.ITEM_CONTENT = "要货看板已完成!"; - //} - //); - //db.TB_PENING_ITEMS.AddOrUpdate(itm => itm.GUID, _pendingList.ToArray()); - #endregion } - ); - db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); - } - else - { - _ret.State = ReturnStatus.Failed; - _ret.Result = false; - _ret.Message = "选择的记录,有不是发布状态记录!"; } + ); + db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); } - if (p_state == AskState.New) + else { - var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); - int count = _ls.Count(p => p.State == (int)AskState.Release); - if (count == _ls.Count && _ls.Count > 0) + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "选择的记录非已发货状态,不能关闭!"; + } + } + if (p_state == AskState.Confirm) + { + var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); + int count = _ls.Count(p => p.State == (int)AskState.Release); + if (count == _ls.Count && _ls.Count > 0) + { + _ls.ForEach(p => { - _ls.ForEach(p => { - p.State = (int)AskState.New; - var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); - _list.ForEach(itm => itm.State = (int)AskState.New); - db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); - + p.State = (int)AskState.Confirm; + var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); + _list.ForEach(itm => + { + itm.State = (int)AskState.Confirm; + + itm.UpdateTime = DateTime.Now; } - // #region 供应商要货代办取消 - // var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList(); - //if (_pendingList.Count > 0) - //{ - // db.TB_PENING_ITEMS.RemoveRange(_pendingList); - //} - // #endregion - ); - db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); + ); + db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); + #region 供应商确认要货状态完成 + //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList(); + //_pendingList.ForEach(itm => { + // itm.ITEM_STATE = (int)PENDING_STATE.COMPLETED; + // itm.ITEM_CONTENT = "要货看板已完成!"; + //} + //); + //db.TB_PENING_ITEMS.AddOrUpdate(itm => itm.GUID, _pendingList.ToArray()); + #endregion } - else + ); + db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "选择的记录,有不是发布状态记录!"; + } + } + if (p_state == AskState.New) + { + var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); + int count = _ls.Count(p => p.State == (int)AskState.Release); + if (count == _ls.Count && _ls.Count > 0) + { + _ls.ForEach(p => { - _ret.State = ReturnStatus.Failed; - _ret.Result = false; - _ret.Message = "选择的记录,有不是发布状态记录!"; + p.State = (int)AskState.New; + var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); + _list.ForEach(itm => itm.State = (int)AskState.New); + db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); } + ); + db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "选择的记录,有不是发布状态记录!"; } - if (p_state == AskState.Release) + } + if (p_state == AskState.Release) + { + var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); + int count = _ls.Count(p => p.State == (int)AskState.New); + if (count > 0) { - var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); - int count = _ls.Count(p => p.State == (int)AskState.New); - if (count > 0) + _ls.ForEach(p => { - _ls.ForEach(p => + p.State = (int)AskState.Release; + var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); + _list.ForEach(itm => { - p.State = (int)AskState.Release; - var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); - _list.ForEach(itm => - { - itm.State = (int)AskState.Release; - } - ); - db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); + itm.State = (int)AskState.Release; } ); - - db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); - } - else - { - _ret.State = ReturnStatus.Failed; - _ret.Result = false; - _ret.Message = "选择的记录,有不是新建状态记录!"; + db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); } + ); + + db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); } - if (p_state == AskState.Reject) + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "选择的记录,有不是新建状态记录!"; + } + } + if (p_state == AskState.Reject) + { + var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); + int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); + if (count == _ls.Count && _ls.Count > 0) { - var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); - int count = _ls.Count(p => p.State == (int)AskState.New || p.State == (int)AskState.Release); - if (count == _ls.Count && _ls.Count > 0) + _ls.ForEach(p => { - _ls.ForEach(p => + p.State = (int)AskState.Reject; + p.IsDeleted = true; + var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); + _list.ForEach(itm => { - p.State = (int)AskState.Reject; - p.IsDeleted = true; - var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); - _list.ForEach(itm => - { - itm.State = (int)AskState.Reject; - itm.IsDeleted = true; - } - ); - db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); + itm.State = (int)AskState.Reject; + itm.IsDeleted = true; + } + ); + db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); //#region 供应商要货代办作废 //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList(); //db.TB_PENING_ITEMS.RemoveRange(_pendingList); //#endregion } - ); - db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); - } - else - { - _ret.State = ReturnStatus.Failed; - _ret.Result = false; - _ret.Message = "选择的记录,有不是新建或发布状态记录!"; - } - + ); + db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "选择的记录,有不是新建或发布状态记录!"; } + + } if (p_state == AskState.CompleteForce) { var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted == false).ToList(); - int count = _ls.Count(p =>p.State == (int)AskState.Confirm || p.State == (int)AskState.Ship); + 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 => { - if(p.State==(int)AskState.Complete) + if (p.State == (int)AskState.Complete) { p.State = (int)AskState.Reject; p.IsDeleted = true; } - // p.State = (int)AskState.CompleteForce; + // p.State = (int)AskState.CompleteForce; #region 修改发货单 var _asnList = db.TB_ASN.Where(itm => itm.IsDeleted == false && itm.AskBillNum == p.AskBillNum && itm.State == 0).ToList(); _asnList.ForEach(itm => @@ -1848,7 +2036,7 @@ namespace CK.SCP.Controller var asn = db.V_TB_ASN_DETAIL.Where(ask => ask.AskBillNum == itm.AskBillNum && ask.IsDeleted == false && (ask.State == (int)AsnState.Ship || ask.State == (int)AsnState.Receive)) .GroupBy(ask => new { ask.AskBillNum, ask.PoLine, ask.PartCode }) .Select(ask => new { AsSum = ask.Sum(itm1 => itm1.Qty), PoLine = ask.Key.PoLine, AskBillNum = ask.Key.AskBillNum, PartCode = ask.Key.PartCode }).ToList(); - + asn.ForEach(itm1 => { if (itm1.AskBillNum == itm.AskBillNum && itm1.PoLine == itm.PoLine && itm1.PartCode == itm.PartCode) @@ -1901,9 +2089,9 @@ namespace CK.SCP.Controller } } - if(p_state == AskState.NoConfirm) + if (p_state == AskState.NoConfirm) { - var _ls = db.TB_ASN.Where(p => p_list.Contains(p.AskBillNum) && p.IsDeleted==false ).ToList(); + 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(); @@ -1926,39 +2114,14 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.Message = "选择的记录已经有发货单据不能取消!"; - } - - //if (count > 0) - //{ - // _ls.ForEach(p => - // { - // p.State = (int)AskState.Receive; - // var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); - // _list.ForEach(itm => - // { - // itm.State = (int)AskState.Receive; - - // } - // ); - // db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); - // } - // ); - // db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); - //} - //else - //{ - // _ret.State = ReturnStatus.Failed; - // _ret.Result = false; - // _ret.Message = "选择的记录,有不是新建或发布状态记录!"; - //} - } if (string.IsNullOrEmpty(_ret.Message)) { if (db.SaveChanges() != -1) { - if (p_state == AskState.CompleteForce) { + if (p_state == AskState.CompleteForce) + { using (ScpEntities db1 = EntitiesFactory.CreateScpInstance()) { @@ -1994,7 +2157,7 @@ namespace CK.SCP.Controller _ret.Result = false; _ret.Message = "数据更新失败!"; } - } + } } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 @@ -2017,7 +2180,7 @@ namespace CK.SCP.Controller } catch (OptimisticConcurrencyException ex)//并发冲突异常 { - + _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.ErrorList.Add(ex); @@ -2026,7 +2189,7 @@ namespace CK.SCP.Controller } catch (ScpException ex) { - + _ret.State = ReturnStatus.Failed; _ret.Result = false; @@ -2037,7 +2200,7 @@ namespace CK.SCP.Controller { var inner = (UpdateException)ex.InnerException; - + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); } else @@ -2055,13 +2218,6 @@ namespace CK.SCP.Controller } return _ret; } - - - - - - - public static ResultObject Save_ASK_MODIF_QTY(V_TB_ASK p_ask, List p_list) { ResultObject _ret = new ResultObject(); @@ -2070,16 +2226,17 @@ namespace CK.SCP.Controller using (ScpEntities db = EntitiesFactory.CreateScpInstance()) { - var _list= db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted==false).ToList(); - var _ls = Get_CAN_SHIPQTY(_list); - _ls.ForEach(p => { + var _list = db.V_TB_ASK_DETAIL.Where(p => p.AskBillNum == p_ask.AskBillNum && p.IsDeleted == false).ToList(); + var _ls = Get_CAN_SHIPQTY(_list); + _ls.ForEach(p => + { var _entity = p_list.Where(itm => itm.AskBillNum == p.AskBillNum && itm.PoLine == p.PoLine && itm.PartCode == p.PartCode && itm.PoBillNum == p.PoBillNum).FirstOrDefault(); if (_entity != null) { p.AskQty = _entity.AskQty; - if(_entity.AskQty p.Domain == p_ask.Site && p.EndTime == p_ask.EndTime && p.PoBillNum == p_ask.PoBillNum).ToList(); - _planList.ForEach(p =>{ + _planList.ForEach(p => + { - var _first=_ls.Where(itm => itm.PoBillNum==p.PoBillNum && itm.PartCode==p.PartCode && itm.EndTime==p.EndTime).FirstOrDefault(); + var _first = _ls.Where(itm => itm.PoBillNum == p.PoBillNum && itm.PartCode == p.PartCode && itm.EndTime == p.EndTime).FirstOrDefault(); if (_first != null) { p.PlanQty = _first.AskQty; @@ -2179,7 +2337,8 @@ namespace CK.SCP.Controller } return _ret; } - public static ResultObject Save_TB_ASK_STATE_CC(List p_list, AskState p_state, User p_user,string p_fail=null) + + public static ResultObject Save_TB_ASK_STATE_CC(List p_list, AskState p_state, User p_user, string p_fail = null) { ResultObject _ret = new ResultObject(); try @@ -2192,22 +2351,14 @@ namespace CK.SCP.Controller int count = _ls.Count(p => p.State == (int)AskState.Release); if (count == _ls.Count && _ls.Count > 0) { - _ls.ForEach(p => { + _ls.ForEach(p => + { p.UpdateUser = p_user.ChineseName; p.UpdateTime = DateTime.Now; p.State = (int)AskState.Confirm; var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); _list.ForEach(itm => itm.State = (int)AskState.Confirm); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); - #region 供应商确认要货状态完成 - //var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList(); - //_pendingList.ForEach(itm => { - // itm.ITEM_STATE = (int)PENDING_STATE.COMPLETED; - // itm.ITEM_CONTENT = "要货看板已完成!"; - //} - //); - //db.TB_PENING_ITEMS.AddOrUpdate(itm => itm.GUID, _pendingList.ToArray()); - #endregion } ); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); @@ -2225,25 +2376,16 @@ namespace CK.SCP.Controller int count = _ls.Count(p => p.State == (int)AskState.Release); if (count == _ls.Count && _ls.Count > 0) { - _ls.ForEach(p => { + _ls.ForEach(p => + { p.UpdateUser = p_user.ChineseName; p.UpdateTime = DateTime.Now; p.State = (int)AskState.New; var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); _list.ForEach(itm => itm.State = (int)AskState.New); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); - - } - // #region 供应商要货代办取消 - // var _pendingList = db.TB_PENING_ITEMS.Where(itm => itm.ITEM_NO == p.AskBillNum).ToList(); - //if (_pendingList.Count > 0) - //{ - // db.TB_PENING_ITEMS.RemoveRange(_pendingList); - //} - // #endregion - - ); + ); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); } else @@ -2253,8 +2395,6 @@ namespace CK.SCP.Controller _ret.Message = "选择的记录,有不是发布状态记录!"; } } - - if (p_state == AskState.Back) { var _ls = db.TB_ASK.Where(p => p_list.Contains(p.AskBillNum)).ToList(); @@ -2277,8 +2417,6 @@ namespace CK.SCP.Controller } ); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); - - } ); db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); @@ -2322,10 +2460,8 @@ namespace CK.SCP.Controller _item.GUID = Guid.NewGuid(); db.TB_PENING_ITEMS.Add(_item); #endregion - } ); - db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); } else @@ -2367,7 +2503,6 @@ namespace CK.SCP.Controller _ret.Result = false; _ret.Message = "选择的记录,有不是新建或发布状态记录!"; } - } if (p_state == AskState.CompleteForce) { @@ -2407,7 +2542,6 @@ namespace CK.SCP.Controller var asn = db.V_TB_ASN_DETAIL.Where(ask => ask.AskBillNum == itm.AskBillNum && ask.IsDeleted == false && (ask.State == (int)AsnState.Ship || ask.State == (int)AsnState.Receive)) .GroupBy(ask => new { ask.AskBillNum, ask.PoLine, ask.PartCode }) .Select(ask => new { AsSum = ask.Sum(itm1 => itm1.Qty), PoLine = ask.Key.PoLine, AskBillNum = ask.Key.AskBillNum, PartCode = ask.Key.PartCode }).ToList(); - asn.ForEach(itm1 => { if (itm1.AskBillNum == itm.AskBillNum && itm1.PoLine == itm.PoLine && itm1.PartCode == itm.PartCode) @@ -2429,7 +2563,6 @@ namespace CK.SCP.Controller _ret.Result = false; _ret.Message = "选择的记录,有不是【已确认】或【已发货】状态,【发布状态】请用取消发布或看板作废!"; } - } if (p_state == AskState.Receive) { @@ -2444,7 +2577,6 @@ namespace CK.SCP.Controller _list.ForEach(itm => { itm.State = (int)AskState.Receive; - } ); db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); @@ -2458,7 +2590,6 @@ namespace CK.SCP.Controller _ret.Result = false; _ret.Message = "选择的记录,有不是新建或发布状态记录!"; } - } if (p_state == AskState.NoConfirm) { @@ -2485,33 +2616,7 @@ namespace CK.SCP.Controller _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.Message = "选择的记录已经有发货单据不能取消!"; - } - - //if (count > 0) - //{ - // _ls.ForEach(p => - // { - // p.State = (int)AskState.Receive; - // var _list = db.TB_ASK_DETAIL.Where(itm => itm.AskBillNum == p.AskBillNum).ToList(); - // _list.ForEach(itm => - // { - // itm.State = (int)AskState.Receive; - - // } - // ); - // db.TB_ASK_DETAIL.AddOrUpdate(itm => itm.UID, _list.ToArray()); - // } - // ); - // db.TB_ASK.AddOrUpdate(p => p.AskBillNum, _ls.ToArray()); - //} - //else - //{ - // _ret.State = ReturnStatus.Failed; - // _ret.Result = false; - // _ret.Message = "选择的记录,有不是新建或发布状态记录!"; - //} - } if (string.IsNullOrEmpty(_ret.Message)) { @@ -2527,16 +2632,13 @@ namespace CK.SCP.Controller _ret.Message = "数据更新失败!"; } } - } } catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 { var sb = new StringBuilder(); - foreach (var error in dbEx.EntityValidationErrors.ToList()) { - error.ValidationErrors.ToList().ForEach(i => { sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); @@ -2550,7 +2652,6 @@ namespace CK.SCP.Controller } catch (OptimisticConcurrencyException ex)//并发冲突异常 { - _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.ErrorList.Add(ex); @@ -2559,18 +2660,13 @@ namespace CK.SCP.Controller } catch (ScpException ex) { - - _ret.State = ReturnStatus.Failed; _ret.Result = false; _ret.ErrorList.Add(ex); LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASK_CONTROLLER), "Save_TB_ASK_STATE", ex.ToString()); - if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) { var inner = (UpdateException)ex.InnerException; - - throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); } else @@ -2591,6 +2687,5 @@ namespace CK.SCP.Controller - } } diff --git a/Controller/SCP_ASN_CONTROLLER.cs b/Controller/SCP_ASN_CONTROLLER.cs index c2ae84f..a9b0bdd 100644 --- a/Controller/SCP_ASN_CONTROLLER.cs +++ b/Controller/SCP_ASN_CONTROLLER.cs @@ -14,6 +14,7 @@ using System.Data.Entity.Core; using CK.SCP.Models.AppBoxEntity; using CK.SCP.Models.ScpEntity.ExcelExportEnttity; using System.Data.SqlClient; +using CK.SCP.Models.ScpEntity.ExcelImportEntity; namespace CK.SCP.Controller { @@ -308,6 +309,72 @@ namespace CK.SCP.Controller throw e; } } + public static void Get_V_TB_ASN_DETAIL_MODIFY(V_TB_ASN_DETAIL p_entity, Action>> p_action) + { + ResultObject> _ret = new ResultObject>(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + IQueryable q = db.V_TB_ASN_DETAIL; + if (p_entity.UID!=0) + { + q = q.Where(p => p.UID==p_entity.UID); + } + if (p_entity.IsDeleted != false) + { + q = q.Where(p => p.IsDeleted == p_entity.IsDeleted); + } + _ret.State = ReturnStatus.Succeed; + _ret.Result = q; + p_action(_ret); + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_DETAIL_List", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_DETAIL_List", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_DETAIL_List", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + _ret.ErrorList.Add(e); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Get_V_TB_ASN_DETAIL_List", e.Message); + throw e; + } + } public static void Get_V_TB_ASN_DETAIL_List(V_TB_ASN_DETAIL p_entity, Action>> p_action) { ResultObject> _ret = new ResultObject>(); @@ -471,6 +538,112 @@ namespace CK.SCP.Controller } + public static ResultObject Save_TB_ASN_DETAIL_MODIFY(V_TB_ASN_DETAIL p_asn,string p_state) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + var _ls = db.TB_ASN_DETAIL.FirstOrDefault(p => p.UID==p_asn.UID); + if (p_state == "Modify") + { + if (_ls != null) + { + _ls.ProduceDate = p_asn.ProduceDate; + _ls.PackQty = p_asn.PackQty; + _ls.Qty = p_asn.Qty; + _ls.VendBatch = p_asn.VendBatch; + db.TB_ASN_DETAIL.AddOrUpdate(_ls); + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "数据不存在!"; + } + } + if (p_state == "Delete") + { + if (_ls != null) + { + _ls.State =(int)AsnState.Reject; + _ls.IsDeleted = true; + db.TB_ASN_DETAIL.AddOrUpdate(_ls); + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "数据不存在!"; + } + } + if (string.IsNullOrEmpty(_ret.Message)) + { + if (db.SaveChanges() != -1) + { + _ret.State = ReturnStatus.Succeed; + _ret.Result = true; + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.Message = "数据更新失败!"; + } + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_ASN_STATE", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_ASN_STATE", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_ASN_STATE", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "Save_TB_ASN_STATE", e.Message); + _ret.Result = false; + _ret.ErrorList.Add(e); + throw e; + } + return _ret; + } public static ResultObject Save_TB_ASN_STATE(List p_list, AsnState p_state) { ResultObject _ret = new ResultObject(); @@ -817,7 +990,8 @@ namespace CK.SCP.Controller List _lsDetail = new List(); var _ls = retobj.Result.ToList(); _ls.ForEach(p => { - + if (p.Qty > 0) + { V_ARRIVE_PRINT_DETAIL _detail = new V_ARRIVE_PRINT_DETAIL(); _detail.PartNo = p.PartCode; _detail.PartDesc = p.PartDesc1; @@ -826,7 +1000,14 @@ namespace CK.SCP.Controller _detail.Boxes = (Math.Truncate((p.Qty / p.PackQty)) + (((p.Qty % p.PackQty) > 0) ? 1 : 0)).ToString(); _detail.DeliverQty = p.Qty.ToString(); _detail.ReceiveQty = p.Qty.ToString(); - _detail.PoNo = _print.DeliveryNo+"("+p.PoBillNum+")"; + if (p.Site == "0210") + { + _detail.PoNo = p.AskBillNum + "(" + p.PoBillNum + ")"; + } + else + { + _detail.PoNo = _print.DeliveryNo + "(" + p.PoBillNum + ")"; + } _detail.LineNO = p.PoLine.ToString(); _detail.Memo = p.Remark; _detail.DockCode = p.DockCode; @@ -844,6 +1025,7 @@ namespace CK.SCP.Controller // stdtemp +=_detail.Boxes; stdtemp += Convert.ToDecimal( _detail.Boxes); _lsDetail.Add(_detail); + } }); ds.Tables[0].Rows[0]["STDCOUNT"] = stdtemp.ToString(); var tb = ConvertHelper.ToDataTable(_lsDetail); @@ -2589,10 +2771,293 @@ namespace CK.SCP.Controller } return _ret; } - - - - + /// + /// 数据导入 + /// + /// + /// + /// + /// + /// + /// + public static ResultObject EXCEL_ASN(List p_order_list, string p_creator, string p_buyer, string p_site, DateTime p_time) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + int number = 1; + List lineError = new List(); + List ErrorList = new List(); + p_order_list.ForEach + (p => + { + var _ls = CheckExcel(db, p); + if (_ls.Count > 0) + { + lineError.Add(number.ToString()); + ErrorList.Add(string.Join("", _ls.ToArray())); + } + number++; + }); + if (lineError.Count > 0) + { + _ret.State = ReturnStatus.Failed; + _ret.MessageList.AddRange(ErrorList); + _ret.Result = false; + } + else + { + var GroupList = p_order_list.GroupBy(p => new { p.采购订单号, p.行号, p.零件编号, p.价格, p.供应商编码, p.单位 }).Select(p => new { 数量 = p.Sum(itm => decimal.Parse(itm.数量)), 行号 = p.Key.行号, 采购订单号 = p.Key.采购订单号, p.Key.零件编号, p.Key.价格, p.Key.供应商编码, p.Key.单位 }).ToList(); + var OrderList = GroupList.GroupBy(p => p.采购订单号).ToList(); + OrderList.ForEach((p) => + { + var list_distinct = p.GroupBy(t => new { t.零件编号, t.行号 }).ToList(); + var list = p.ToList(); + if (list_distinct.Count < list.Count) + { + _ret.MessageList.Add("相同组号,存在同一编号、行号的数据"); + return; + } + if (list.Count > 0) + { + var _entity = list.FirstOrDefault(); + TB_ASK _ask = new TB_ASK(); + _ask.AskBillNum = SCP_BILLCODE_CONTROLLER.MakeASKCode(); + _ask.State = (int)AskState.Receive; + _ask.PoBillNum = _entity.采购订单号.ToUpper(); + _ask.ModType = (int)BillModType.Contract; + _ask.Site = p_site; + _ask.BeginTime = p_time; + _ask.Buyer = p_creator; + _ask.BuyerPhone = ""; + _ask.ErpBillNum = _entity.采购订单号.ToUpper(); + _ask.EndTime = p_time; + _ask.CreateTime = p_time; + _ask.CreateUser = p_creator; + _ask.VendId = _entity.供应商编码.ToUpper(); + _ask.GUID = Guid.NewGuid(); + _ask.IsDeleted = false; + db.TB_ASK.Add(_ask); + + TB_ASN _asn = new TB_ASN(); + _asn.AsnBillNum = SCP_BILLCODE_CONTROLLER.MakeASNCode(); + _asn.AskBillNum = _ask.AskBillNum; + _asn.VendId = _entity.供应商编码.ToUpper(); ; + _asn.State = (int)AsnState.Receive; + _asn.PoBillNum = _entity.采购订单号.ToUpper(); + _asn.Site = p_site; + _asn.CreateTime = p_time; + _asn.CreateUser = p_creator; + _asn.UpdateTime = p_time; + _asn.UpdateUser = p_creator; + _asn.ShipTime = p_time; + _asn.ShipUser = p_creator; + _asn.ReceiveTime = p_time; + _asn.ReceiveUser = p_creator; + _asn.GUID = Guid.NewGuid(); + _asn.IsDeleted = false; + db.TB_ASN.Add(_asn); + + list.ForEach((itm) => + { + TB_ASK_DETAIL _t_ASK_Detail = new TB_ASK_DETAIL(); + _t_ASK_Detail.PoLine = Int32.Parse(itm.行号); + _t_ASK_Detail.Currency = ""; + _t_ASK_Detail.AskBillNum = _ask.AskBillNum; + _t_ASK_Detail.PoBillNum = _ask.PoBillNum; + _t_ASK_Detail.PoUnit = itm.单位; + _t_ASK_Detail.CreateTime = DateTime.Now; + _t_ASK_Detail.CreateUser = _ask.CreateUser; + _t_ASK_Detail.PartCode = itm.零件编号.ToUpper(); + _t_ASK_Detail.BeginTime = p_time; + _t_ASK_Detail.EndTime = p_time; + _t_ASK_Detail.TempQty = itm.数量; + _t_ASK_Detail.AskQty = itm.数量; + _t_ASK_Detail.IsDeleted = false; + _t_ASK_Detail.LocUnit = itm.单位; + _t_ASK_Detail.UnConv = 1; + _t_ASK_Detail.State = _ask.State; + _t_ASK_Detail.Price = string.IsNullOrEmpty(itm.价格) ? 0 : decimal.Parse(itm.价格); + _t_ASK_Detail.GUID = Guid.NewGuid(); + db.TB_ASK_DETAIL.Add(_t_ASK_Detail); + + TB_ASN_DETAIL _t_ASN_Detail = new TB_ASN_DETAIL(); + _t_ASN_Detail.AsnBillNum = _asn.AsnBillNum; + _t_ASN_Detail.PoLine = Int32.Parse(itm.行号); + _t_ASN_Detail.Currency = ""; + _t_ASN_Detail.PoBillNum = _asn.PoBillNum; + _t_ASN_Detail.PoUnit = itm.单位; + _t_ASN_Detail.CreateTime = DateTime.Now; + _t_ASN_Detail.CreateUser = _asn.CreateUser; + _t_ASN_Detail.PartCode = itm.零件编号.ToUpper(); + _t_ASN_Detail.Batch = p_time.ToString("yyyyMMdd"); + _t_ASN_Detail.VendBatch = p_time.ToString("yyyyMMdd"); + _t_ASN_Detail.Qty = itm.数量; + _t_ASN_Detail.State = (int)AsnState.Receive; + _t_ASN_Detail.CreateTime = p_time; + _t_ASN_Detail.CreateUser = p_creator; + _t_ASN_Detail.IsDeleted = false; + _t_ASN_Detail.GUID = Guid.NewGuid(); + _t_ASN_Detail.PoUnit = itm.单位; + _t_ASN_Detail.ProduceDate = p_time; + db.TB_ASN_DETAIL.Add(_t_ASN_Detail); + + var _reclist = p_order_list.Where(t => t.零件编号 == itm.零件编号 && t.采购订单号 == itm.采购订单号 && t.行号 == itm.行号).GroupBy(t => t.收货单号).ToList(); + _reclist.ForEach((q) => + { + var reclist = q.FirstOrDefault(); + TB_RECEIVE _rec = new TB_RECEIVE(); + _rec.RecvBillNum = reclist.收货单号; + _rec.State = (int)FormState.开放; + _rec.Remark = _ask.AskBillNum; + _rec.CreateTime = p_time; + _rec.CreateUser = p_creator; + _rec.IsDeleted = false; + _rec.GUID = System.Guid.NewGuid(); + _rec.BillType = 0; + _rec.PoBillNum = reclist.采购订单号.ToUpper(); + _rec.AsnBillNum = reclist.采购订单号.ToUpper(); + _rec.Site = p_site; + _rec.VendId = reclist.供应商编码.ToUpper(); + _rec.ShipTime = p_time; + db.TB_RECEIVE.Add(_rec); + var _recdetaillist = p_order_list.Where(f => f.收货单号 == reclist.收货单号).ToList(); + _recdetaillist.ForEach((n) => + { + TB_RECEIVE_DETAIL _t_RECEIVE_Detail = new TB_RECEIVE_DETAIL(); + _t_RECEIVE_Detail.RecvBillNum = n.收货单号; + _t_RECEIVE_Detail.PoBillNum = n.采购订单号.ToUpper(); + _t_RECEIVE_Detail.PoLine = Int32.Parse(n.行号); + _t_RECEIVE_Detail.PartCode = n.零件编号.ToUpper(); + _t_RECEIVE_Detail.Batch = n.批次; + _t_RECEIVE_Detail.VendBatch = n.供应商批次; + _t_RECEIVE_Detail.PoUnit = n.单位; + _t_RECEIVE_Detail.LocUnit = ""; + _t_RECEIVE_Detail.Qty = decimal.Parse(n.数量); + _t_RECEIVE_Detail.State = (int)FormState.开放; + _t_RECEIVE_Detail.Remark = _ask.AskBillNum; + _t_RECEIVE_Detail.CreateTime = p_time; + _t_RECEIVE_Detail.CreateUser = p_creator; + _t_RECEIVE_Detail.IsDeleted = false; + _t_RECEIVE_Detail.GUID = System.Guid.NewGuid(); + _t_RECEIVE_Detail.BillType = 0; + db.TB_RECEIVE_DETAIL.Add(_t_RECEIVE_Detail); + }); + }); + }); } + else + { + _ret.MessageList.Add("请检查数据后,重新导入!"); + return; + } + if (_ret.MessageList.Count == 0) + { + int state = db.SaveChanges(); + if (state != -1) + { + _ret.State = ReturnStatus.Succeed; + _ret.Result = true; + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + } + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + } + } + ); + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "EXCEL_ASN", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "EXCEL_ASN", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "EXCEL_ASN", ex.ToString()); + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_ASN_CONTROLLER), "EXCEL_ASN", e.Message); + _ret.Result = false; + _ret.ErrorList.Add(e); + throw e; + } + return _ret; + } + private static List CheckExcel(ScpEntities db, SCP_ASN_EXCEL p_excel) + { + List ErrorList = new List(); + if (!string.IsNullOrEmpty(p_excel.采购订单号)) + { + int count = db.TB_PO_DETAIL.Count(p => p.PoBillNum == p_excel.采购订单号&&p.PartCode== p_excel.零件编号&&p.PoLine== Int32.Parse( p_excel.行号)); + if (count == 0) + { + ErrorList.Add(string.Format("订单编号{0}零件号{1}行号{2}不存在!", p_excel.采购订单号,p_excel.零件编号, p_excel.行号)); + } + } + else + { + ErrorList.Add(string.Format("订单编号为空!")); + } + if ( + string.IsNullOrEmpty(p_excel.收货单号) || + string.IsNullOrEmpty(p_excel.采购订单号) || + string.IsNullOrEmpty(p_excel.供应商编码) || + string.IsNullOrEmpty(p_excel.价格) || + string.IsNullOrEmpty(p_excel.零件编号) || + string.IsNullOrEmpty(p_excel.行号) || + string.IsNullOrEmpty(p_excel.批次) || + string.IsNullOrEmpty(p_excel.数量) || + string.IsNullOrEmpty(p_excel.单位) || + string.IsNullOrEmpty(p_excel.价格)) + { + ErrorList.Add(string.Format("收货单号【{1}】零件号【{0}】有填写为空!", p_excel.零件编号, p_excel.收货单号)); + } + return ErrorList; + } + } } diff --git a/Controller/SCP_BARCODE_CONTROLLER.cs b/Controller/SCP_BARCODE_CONTROLLER.cs index 5ba7830..5f3544b 100644 --- a/Controller/SCP_BARCODE_CONTROLLER.cs +++ b/Controller/SCP_BARCODE_CONTROLLER.cs @@ -267,6 +267,10 @@ namespace CK.SCP.Controller { q = q.Where(p => p.LocUnit.Contains(p_entity.LocUnit)); } + if (p_entity.IsScanned) + { + q = q.Where(p => p.IsScanned==false); + } //if (!string.IsNullOrEmpty(p_entity.PartName)) //{ // q = q.Where(p => p.PartName.Contains(p_entity.PartName)); @@ -648,7 +652,8 @@ namespace CK.SCP.Controller State = 0, Remark = p_entity.UpdateInfo, PackQty = p_entity.PackQty, - Site = p_entity.Site + Site = p_entity.Site, + IsScanned = false }; diff --git a/Controller/SCP_BILLCODE_CONTROLLER.cs b/Controller/SCP_BILLCODE_CONTROLLER.cs index dd31204..bfe208d 100644 --- a/Controller/SCP_BILLCODE_CONTROLLER.cs +++ b/Controller/SCP_BILLCODE_CONTROLLER.cs @@ -66,7 +66,16 @@ namespace CK.SCP.Controller return GetTablePK("E", "TB_ASK", "AskBillNum", "yyMMdd", 4); } + /// + /// 生成收货单码 + /// + /// + public static string MakeReviceCode_ASN() + { + return GetTablePK("C", "TB_RECEIVE", "RecvBillNum", "yyMMdd", 4); + + } public static string MakePLAN_EXTEND_ASKCode() { diff --git a/Controller/SCP_EXCEL_CONTROLLER.cs b/Controller/SCP_EXCEL_CONTROLLER.cs index cece739..dc2ae14 100644 --- a/Controller/SCP_EXCEL_CONTROLLER.cs +++ b/Controller/SCP_EXCEL_CONTROLLER.cs @@ -161,8 +161,62 @@ namespace CK.SCP.Controller } + public static DataSet GET_OTD_VendId_REPORT_EXECEL(List p_lst) + { + DataSet _ds = new DataSet(); + var _exportList = new List(); + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + p_lst.ForEach(itm => + { + SCP_OTD_VendId_REPORT_EXPORT _entity = new SCP_OTD_VendId_REPORT_EXPORT(); + _entity.要货看板号 = itm.AskBillNum; + _entity.供应商编号 = itm.VendId; + _entity.供应商名称 = itm.VendName; + _entity.要求到货时间 = Convert.ToDateTime(itm.EndTime).ToString("yyyy/MM/dd"); + _entity.订单要货数量 = itm.AskQty.ToString(); + _entity.到货数量 = itm.ArriveQty.ToString(); + _entity.差额 = itm.Qty.ToString(); + _entity.及时数量 = itm.NntimelyQty.ToString(); + _entity.及时率 = itm.OTD.ToString(); + _entity.到货率 = itm.ArriveOTD.ToString(); + _exportList.Add(_entity); + }); + var _dt = ConvertHelper.ToDataTable(_exportList); + _ds.Tables.Add(_dt); + } + return _ds; + } + public static DataSet GET_OTD_REPORT_EXECEL(List p_lst) + { + DataSet _ds = new DataSet(); + var _exportList = new List(); + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + p_lst.ForEach(itm => + { + SCP_OTD_REPORT_EXPORT _entity = new SCP_OTD_REPORT_EXPORT(); + _entity.供应商编号 = itm.VendId; + _entity.供应商名称 = itm.VendName; + _entity.要货看板号 = itm.AskBillNum; + _entity.零件号 = itm.PartCode; + _entity.零件名称 = itm.PartName; + _entity.要求到货时间 = Convert.ToDateTime(itm.EndTime).ToString("yyyy/MM/dd"); + _entity.订单要货数量 = itm.AskQty.ToString(); + _entity.到货数量 = itm.ArriveQty.ToString(); + _entity.差额 = itm.Qty.ToString(); + _entity.及时数量 = itm.NntimelyQty.ToString(); + _entity.及时率 = itm.OTD.ToString(); + _entity.到货率 = itm.ArriveOTD.ToString(); + _exportList.Add(_entity); + }); + var _dt = ConvertHelper.ToDataTable(_exportList); + _ds.Tables.Add(_dt); + } + return _ds; + } public static DataSet GET_ASK_EXECEL(List p_lst) { @@ -327,35 +381,5 @@ namespace CK.SCP.Controller } return _ds; } - - public static DataSet GET_OTD_REPORT_EXECEL(List p_lst) - { - DataSet _ds = new DataSet(); - var _exportList = new List(); - using (ScpEntities db = EntitiesFactory.CreateScpInstance()) - { - p_lst.ForEach(itm => - { - SCP_OTD_REPORT_EXPORT _entity = new SCP_OTD_REPORT_EXPORT(); - - _entity.供应商编号 = itm.VendId; - _entity.供应商名称 = itm.VendName; - _entity.要货看板号 = itm.AskBillNum; - _entity.零件号 = itm.PartCode; - _entity.零件名称 = itm.PartName; - _entity.要求到货时间 = Convert.ToDateTime(itm.EndTime).ToString("yyyy/MM/dd"); - _entity.订单要货数量 = itm.AskQty.ToString(); - _entity.到货数量 = itm.ArriveQty.ToString(); - _entity.差额 = itm.Qty.ToString(); - _entity.及时数量 = itm.NntimelyQty.ToString(); - _entity.及时率 = itm.OTD.ToString(); - _entity.到货率 = itm.ArriveOTD.ToString(); - _exportList.Add(_entity); - }); - var _dt = ConvertHelper.ToDataTable(_exportList); - _ds.Tables.Add(_dt); - } - return _ds; - } } } diff --git a/Controller/SCP_FORECAST_CONTROLLER.cs b/Controller/SCP_FORECAST_CONTROLLER.cs index 12b2110..39c37e1 100644 --- a/Controller/SCP_FORECAST_CONTROLLER.cs +++ b/Controller/SCP_FORECAST_CONTROLLER.cs @@ -45,10 +45,10 @@ namespace CK.SCP.Controller { q = q.Where(p => p.State_DESC.Contains(p_entity.State_DESC)); } - //if (!string.IsNullOrEmpty(p_entity.Month)) - //{ - // q = q.Where(p => p.Month == p_entity.Month); - //} + if (!string.IsNullOrEmpty(p_entity.Month)) + { + q = q.Where(p => p.Month == p_entity.Month); + } q = q.Where(p => p.IsDeleted == p_entity.IsDeleted); if (p_entity.UserInAddress != null && p_entity.UserInAddress.Count > 0) { @@ -288,7 +288,163 @@ namespace CK.SCP.Controller } return ErrorList; } + /// + /// EXCEL导入(沈阳金杯) + /// + /// + /// + /// + public static ResultObject EXCEL_FORECAST_MOD_SYJB(List p_order_list, string p_creator, string site) + { + ResultObject _ret = new ResultObject(); + try + { + using (ScpEntities db = EntitiesFactory.CreateScpInstance()) + { + int number = 1; + List lineError = new List(); + List ErrorList = new List(); + var _lst = p_order_list; + _lst.ForEach + (p => + { + var _ls = CheckExcelMode_Forecast_SYJB(db, p); + if (_ls.Count > 0) + { + lineError.Add(number.ToString()); + ErrorList.Add(string.Join("", _ls.ToArray())); + } + number++; + }); + if (lineError.Count > 0) + { + _ret.State = ReturnStatus.Failed; + _ret.MessageList.AddRange(ErrorList); + _ret.Result = false; + } + else + { + _lst.ForEach(p => + { + var _item = db.TB_FORECAST.SingleOrDefault(t => t.PartCode == p.零件编号.ToUpper() && t.VendId == p.供应商编码 && t.Month == p.月份&&t.State!=(int)ForecastState.Reject) ?? + new TB_FORECAST { PartCode = p.零件编号.ToUpper(), VendId = p.供应商编码, Month = p.月份, GUID = System.Guid.NewGuid() }; + _item.MonthQty1 = decimal.Parse(p.预测1); + _item.MonthQty2 = decimal.Parse(p.预测2); + _item.MonthQty3 = decimal.Parse(p.预测3); + _item.IsDeleted = false; + _item.CreateUser = p_creator; + _item.CreateTime = DateTime.Now; + _item.State = (int)ForecastState.New; + _item.UpdateInfo = ""; + _item.Site = site; + db.TB_FORECAST.AddOrUpdate(_item); + }); + if (_ret.MessageList.Count == 0) + { + int state = db.SaveChanges(); + if (state != -1) + { + _ret.State = ReturnStatus.Succeed; + _ret.Result = true; + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + } + } + else + { + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + } + } + } + } + catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)//捕获实体验证异常 + { + var sb = new StringBuilder(); + + foreach (var error in dbEx.EntityValidationErrors.ToList()) + { + error.ValidationErrors.ToList().ForEach(i => + { + sb.AppendFormat("表:{0},字段:{1},信息:{2}\r\n", error.Entry.Entity.GetType().Name, i.PropertyName, i.ErrorMessage); + }); + } + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(dbEx); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_FORECAST_CONTROLLER), "EXCEL_FORECAST_MOD", sb.ToString()); + throw new ScpException(ResultCode.DbEntityValidationException, sb.ToString(), "字段验证失败" + sb.ToString()); + } + catch (OptimisticConcurrencyException ex)//并发冲突异常 + { + + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_FORECAST_CONTROLLER), "EXCEL_FORECAST_MOD", ex.ToString()); + throw new ScpException(ResultCode.Exception, "9999", ex.ToString()); + } + catch (ScpException ex) + { + + + _ret.State = ReturnStatus.Failed; + _ret.Result = false; + _ret.ErrorList.Add(ex); + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_FORECAST_CONTROLLER), "EXCEL_FORECAST_MOD", ex.ToString()); + + if (ex.InnerException != null && ex.InnerException.GetType() == typeof(UpdateException)) + { + var inner = (UpdateException)ex.InnerException; + + + throw new ScpException(ResultCode.Exception, "0000", ex.ToString()); + } + else + { + if (ex.InnerException != null) throw ex.InnerException; + } + } + catch (Exception e) + { + _ret.State = ReturnStatus.Failed; + LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_FORECAST_CONTROLLER), "EXCEL_FORECAST_MOD", e.Message); + _ret.Result = false; + _ret.ErrorList.Add(e); + throw e; + } + return _ret; + } + /// + /// 导入验证(沈阳金杯) + /// + /// + /// + /// + private static List CheckExcelMode_Forecast_SYJB(ScpEntities db, SCP_FORECAST_EXPORT_SYJB p_excel) + { + List ErrorList = new List(); + var _item = db.TB_FORECAST.SingleOrDefault(t => t.PartCode == p_excel.零件编号.ToUpper() && t.VendId == p_excel.供应商编码 && t.Month == p_excel.月份 && t.State == (int)ForecastState.Confirm); + if (_item != null) + { + ErrorList.Add(string.Format("零件编号【{0}】,月份【{1}】,供应商【{2}】的数据供应商已确认无法修改", p_excel.零件编号, p_excel.月份, p_excel.供应商编码)); + } + if ( + string.IsNullOrEmpty(p_excel.零件编号) || + string.IsNullOrEmpty(p_excel.供应商编码) || + string.IsNullOrEmpty((p_excel.月份).ToString()) || + string.IsNullOrEmpty(p_excel.预测1) || + string.IsNullOrEmpty(p_excel.预测2) || + string.IsNullOrEmpty(p_excel.预测3)) + { + ErrorList.Add(string.Format("零件编号【{0}】有填写为空!", p_excel.零件编号)); + } + return ErrorList; + } public static ResultObject Save_TB_FORECAST_STATE(List p_list, string p_user, ForecastState State) { ResultObject _ret = new ResultObject(); diff --git a/Controller/SCP_INVOICE_CONTROLLER.cs b/Controller/SCP_INVOICE_CONTROLLER.cs index 981ea96..2afc114 100644 --- a/Controller/SCP_INVOICE_CONTROLLER.cs +++ b/Controller/SCP_INVOICE_CONTROLLER.cs @@ -167,9 +167,6 @@ namespace CK.SCP.Controller } - - - public static List Get_V_TB_INVOICE_BY_TIME(string p_begin,string p_end,string p_po,string p_asn) { List _list = new List(); @@ -201,7 +198,6 @@ namespace CK.SCP.Controller return _list; } - public static void Get_V_TB_INVOICE_List(V_TB_INVOICE p_entity, Action>> p_action) { ResultObject> _ret = new ResultObject>(); @@ -272,6 +268,10 @@ namespace CK.SCP.Controller { q = q.Where(p => p.CreateUser.Contains(p_entity.CreateUser)); } + if (!string.IsNullOrEmpty(p_entity.AskCreateUser)) + { + q = q.Where(p => p.AskCreateUser==p_entity.AskCreateUser); + } if (p_entity.InvoiceList!=null && p_entity.InvoiceList.Count>0) { q = q.Where(p => p_entity.InvoiceList.Contains(p.InvcBillNum)); @@ -335,11 +335,8 @@ namespace CK.SCP.Controller LogHelper.Writlog(LogHelper.LogType.Error, typeof(SCP_INVOICE_CONTROLLER), "Get_V_TB_INVOICE_List", e.Message); throw e; } - } - - public static void Get_V_TB_INVOICE_ERP_List(V_TB_INVOICE p_entity, Action>> p_action) { ResultObject> _ret = new ResultObject>(); @@ -940,7 +937,6 @@ namespace CK.SCP.Controller } - public static ResultObject CREATE_TB_INVOICE(V_TB_INVOICE p_entity,List p_list) { ResultObject _ret = new ResultObject