|
|
@ -14,61 +14,17 @@ using SCP.Code; |
|
|
|
using System.Drawing; |
|
|
|
using CK.SCP.Models.Enums; |
|
|
|
|
|
|
|
namespace SCP.SupplierData |
|
|
|
namespace SCP.WarehouseData |
|
|
|
{ |
|
|
|
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() |
|
|
|
{ |
|
|
|
// 每页记录数
|
|
|
@ -79,80 +35,7 @@ namespace SCP.SupplierData |
|
|
|
private void SearchData(Action<IQueryable<V_TB_RECEIVE_LIST>> 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; |
|
|
|
} |
|
|
|
_ls.VendId = Request.Params["VendId"]; |
|
|
|
SCP_RECIVECE_CONTROLLER.Get_V_TB_RECEIVE_LIST_List(_ls, (ret) => |
|
|
|
{ |
|
|
|
if (ret.State == ReturnStatus.Succeed) |
|
|
@ -160,37 +43,16 @@ namespace SCP.SupplierData |
|
|
|
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<V_TB_RECEIVE_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"); |
|
|
|
ret = SortAndPage(ret, Grid_V_TB_RECEIVE_LIST, "DESC"); |
|
|
|
List<V_TB_RECEIVE_LIST> temp = ret.ToList(); |
|
|
|
|
|
|
|
Grid_V_TB_RECEIVE_LIST.DataSource = temp; |
|
|
|
Grid_V_TB_RECEIVE_LIST.DataSource= temp; |
|
|
|
Grid_V_TB_RECEIVE_LIST.DataBind(); |
|
|
|
} |
|
|
|
}); |
|
|
|
// 排列和数据库分页
|
|
|
|
} |
|
|
@ -206,175 +68,6 @@ namespace SCP.SupplierData |
|
|
|
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; |
|
|
|
SearchData((rs) => |
|
|
|
{ |
|
|
|
string IsCreate = "0"; |
|
|
|
|
|
|
|
if (Grid_V_TB_RECEIVE_LIST.SelectedRowIndexArray.Length == 0) |
|
|
|
{ |
|
|
|
Alert.Show("请选择要创建发票的记录!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
string IDS = ""; |
|
|
|
List<string> _list = new List<string>(); |
|
|
|
List<string> _projectList = new List<string>(); |
|
|
|
List<string> _rejList = new List<string>(); |
|
|
|
string _projectId = string.Empty; |
|
|
|
List<string> _recList = new List<string>(); |
|
|
|
|
|
|
|
|
|
|
|
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]); |
|
|
|
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); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (CurrentUser.FactoryList.FirstOrDefault() == "CNS")
|
|
|
|
//{
|
|
|
|
// if (_projectList.Distinct().Count() > 1)
|
|
|
|
// {
|
|
|
|
// Alert.Show("请选择同一项目编号零件生成发票(可以到【查询面板】填写查询)</br>有退货必须选择否则影响财务收票!");
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// //var _ls = rs.Where(p => p.State==(int)ReceiveState.Check && p.RecvBillNum.Contains("R.") && p.VendId==vender && p.IsDeleted == false && p.ProjectId==_projectId && p.Site==CurrentUser.FactoryList.FirstOrDefault());
|
|
|
|
// //if (_ls.Count() > 0)
|
|
|
|
// //{
|
|
|
|
// // var _count=_rejList.Count(p => p == _projectId);
|
|
|
|
// // if (_count != _ls.Count())
|
|
|
|
// // {
|
|
|
|
// // Alert.Show(_projectId+"项目还存在退货数量!");
|
|
|
|
// // 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; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
MyQueryStringEnCode me = new MyQueryStringEnCode("ReceiveID=" + IDS + "&VendId=" + vender + "&Modify=" + IsCreate + "&IsAll=" + p_all + "&Tax=" + _tax + "&CJ=" + _cj + "&TZ=" + _tz); |
|
|
|
if (me.QueryString.Length > 2000) |
|
|
|
{ |
|
|
|
Alert.Show("选择零件记录超过,发票允许条数!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
string ret = Window1.GetShowReference("../../Views/SupplierData/SCP_INVOICE_CREATE.aspx?" + me.QueryString, "生成发票"); |
|
|
|
PageContext.RegisterStartupScript(ret); |
|
|
|
}); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
Alert.Show(ex.Message); |
|
|
|
} |
|
|
|
} |
|
|
|
private List<string> GetIsAllChecked(string p_VendId,string p_VendIds) |
|
|
|
{ |
|
|
|
|
|
|
|
List<string> unSelected = new List<string>(); |
|
|
|
|
|
|
|
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) |
|
|
@ -383,92 +76,7 @@ namespace SCP.SupplierData |
|
|
|
} |
|
|
|
|
|
|
|
//导出
|
|
|
|
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<string, string> cellheader = new Dictionary<string, string> |
|
|
|
{ |
|
|
|
{ "ProjectId", "项目编号" }, |
|
|
|
{ "BillType_DESC", "单据类型" }, |
|
|
|
{ "RecvBillNum", "单据编号" }, |
|
|
|
{ "AsnBillNum", "发货单号" }, |
|
|
|
{ "VendName", "供应商" }, |
|
|
|
{ "VendId", "供应商编码" }, |
|
|
|
{ "PoBillNum", "订单号" }, |
|
|
|
{ "PoLine", "订单行" }, |
|
|
|
{ "PartCode", "零件号" }, |
|
|
|
{ "PartDesc1", "零件名称" }, |
|
|
|
{ "LocUnit", "单位" }, |
|
|
|
{ "Currency", "币种" }, |
|
|
|
{ "Qty", "可开票数量" }, |
|
|
|
{ "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(); |
|
|
@ -476,6 +84,7 @@ namespace SCP.SupplierData |
|
|
|
|
|
|
|
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)) |
|
|
|
{ |
|
|
@ -486,12 +95,6 @@ namespace SCP.SupplierData |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected void btnCanIn_Click(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void BTN_INV_Click(object sender, EventArgs e) |
|
|
|
{ |
|
|
@ -502,12 +105,5 @@ namespace SCP.SupplierData |
|
|
|
{ |
|
|
|
BindData(); |
|
|
|
} |
|
|
|
|
|
|
|
protected void btnCreateAll_Click(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
CreateInvoice("1"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |