发票管理增加打印,和推送oa
This commit is contained in:
@@ -17,6 +17,8 @@ namespace BLL
|
||||
public const string SetSubReview = "SetSubReview";
|
||||
public const string ContractReview = "ContractReview";
|
||||
public const string ContractReview_Countersign = "ContractReview_Countersign";
|
||||
public const string Invoice_Input = "Invoice_Input";
|
||||
public const string Invoice_Output = "Invoice_Output";
|
||||
|
||||
public static Model.PHTGL_Approve GetPHTGL_ApproveById(string ApproveId)
|
||||
{
|
||||
@@ -170,7 +172,7 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static List<Model.PHTGL_Approve> GetApproves_NopushOa()
|
||||
{
|
||||
var q = (from x in Funs.DB.PHTGL_Approve where x.IsPushOa == 0 && x.ApproveMan != "" select x).ToList();
|
||||
var q = (from x in Funs.DB.PHTGL_Approve where x.IsPushOa == 0 && x.ApproveMan != "" && x.State==0 select x).ToList();
|
||||
return q;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -3,13 +3,16 @@ using FineUIPro;
|
||||
using MiniExcelLibs;
|
||||
using MiniExcelLibs.Attributes;
|
||||
using Model;
|
||||
using NPOI.SS.Formula.Eval;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Org.BouncyCastle.Security;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using WIA;
|
||||
|
||||
@@ -108,7 +111,7 @@ namespace BLL
|
||||
where
|
||||
(string.IsNullOrEmpty(table.InvoiceId) || x.InvoiceId.Contains(table.InvoiceId)) &&
|
||||
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
|
||||
(string.IsNullOrEmpty(table.ContractId) || x.ProjectId.Contains(table.ContractId)) &&
|
||||
(string.IsNullOrEmpty(table.ContractId) || x.ContractId.Contains(table.ContractId)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceCode) || x.InvoiceCode.Contains(table.InvoiceCode)) &&
|
||||
(string.IsNullOrEmpty(table.InvoiceNumber) || x.InvoiceNumber.Contains(table.InvoiceNumber)) &&
|
||||
(string.IsNullOrEmpty(table.SellerName) || x.SellerName.Contains(table.SellerName)) &&
|
||||
@@ -174,9 +177,29 @@ namespace BLL
|
||||
});
|
||||
}
|
||||
|
||||
public static IEnumerable GetOrderInListData(Model.PHTGL_Invoice table, Grid grid1)
|
||||
|
||||
public static IEnumerable GetOrderInListData(Model.PHTGL_Invoice table, Grid grid1,string state)
|
||||
{
|
||||
var q = GetPHTGL_InvoiceByModle(table);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case "0": q = q.Where(x => x.State > StateDataIn); //全部
|
||||
break;
|
||||
case "1":
|
||||
q = q.Where(x => x.State > StateDataIn &&x.State< StateInPutApproveSuccess); //未入库
|
||||
break;
|
||||
case "2":
|
||||
q = q.Where(x => x.State >= StateInPutApproveSuccess ); //已入库
|
||||
break;
|
||||
case "3":
|
||||
q = q.Where(x => x.State >=StateInPutApproveSuccess && x.State < StateOutPutApproveSuccess);//未出库
|
||||
break;
|
||||
case "4":
|
||||
q = q.Where(x => x.State == StateOutPutApproveSuccess);//已出库
|
||||
break;
|
||||
|
||||
}
|
||||
Count = q.Count();
|
||||
if (Count == 0)
|
||||
{
|
||||
@@ -224,6 +247,60 @@ namespace BLL
|
||||
return Funs.DB.PHTGL_Invoice.FirstOrDefault(x => x.InvoiceId == InvoiceId);
|
||||
}
|
||||
|
||||
public static PHTGL_InvoicePrintModel GetPHTGL_InvoicePrintModel(string InvoiceId)
|
||||
{
|
||||
var result = new PHTGL_InvoicePrintModel();
|
||||
Order order = new Order();
|
||||
List<OrderDetail> orderDetails = new List<OrderDetail>();
|
||||
OrderApproveIn orderApproveIn = new OrderApproveIn();
|
||||
OrderApproveOut orderApproveOut = new OrderApproveOut();
|
||||
|
||||
var invoiceModel = GetPHTGL_InvoiceById(InvoiceId);
|
||||
var invoiceDetail = PhtglInvoicedetailService.GetPHTGL_InvoiceDetailByInvoiceId(InvoiceId);
|
||||
var approveManModels = GetInvoiceApproveManEntity(InvoiceId);
|
||||
//将invoiceModel 映射到order
|
||||
var mapper = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<PHTGL_Invoice, Order>();
|
||||
order=mapper.Map(invoiceModel);
|
||||
order.ProjectName=ProjectService.GetProjectNameByProjectId(invoiceModel.ProjectId);
|
||||
order.ContractCode=ContractService.GetContractById(invoiceModel.ContractId)?.ContractNum;
|
||||
//invoiceDetail 映射到orderDetails
|
||||
var mapper2 = EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<List<PHTGL_InvoiceDetail>, List<OrderDetail>>();
|
||||
orderDetails = mapper2.Map(invoiceDetail);
|
||||
orderDetails= orderDetails.Select(x => new OrderDetail
|
||||
{
|
||||
GoodsOrServicesName = x.GoodsOrServicesName,
|
||||
SpecificationModel = x.SpecificationModel,
|
||||
Unit = x.Unit,
|
||||
Quantity = x.Quantity,
|
||||
UnitPrice = x.UnitPrice,
|
||||
NoTaxPrice = x.Amount - x.Tax,
|
||||
TaxRate = string.Format("{0:P0}", Convert.ToDecimal(x.TaxRate) ),
|
||||
Tax =x.Tax ,
|
||||
Amount = x.Amount,
|
||||
}).ToList();
|
||||
if (approveManModels!=null)
|
||||
{
|
||||
orderApproveIn.ProjectManager = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ProjectManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ProjectManager) : "";
|
||||
orderApproveIn.ControlManager = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ControlManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ControlManager) : "";
|
||||
orderApproveIn.ConstructionManager = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ConstructionManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ConstructionManager) : "";
|
||||
orderApproveIn.ProfessionalEngineer = !string.IsNullOrEmpty(approveManModels.InputApproveMan.ProfessionalEngineer) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.InputApproveMan.ProfessionalEngineer) : "";
|
||||
|
||||
orderApproveOut.ProjectManager = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ProjectManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ProjectManager) : "";
|
||||
orderApproveOut.ControlManager = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ControlManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ControlManager) : "";
|
||||
orderApproveOut.PurchasingMan = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.PurchasingMan) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.PurchasingMan) : "";
|
||||
orderApproveOut.ConUnitMaterialOfficer = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ConUnitMaterialOfficer) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ConUnitMaterialOfficer) : "";
|
||||
orderApproveOut.ConUnitProjectManager = !string.IsNullOrEmpty(approveManModels.OutputApproveMan.ConUnitProjectManager) ? BLL.Person_PersonsService.getSignatureUrl(approveManModels.OutputApproveMan.ConUnitProjectManager) : "";
|
||||
|
||||
}
|
||||
|
||||
|
||||
result.Order = order;
|
||||
result.Data = orderDetails;
|
||||
result.ApproveIn = orderApproveIn;
|
||||
result.ApproveOut = orderApproveOut;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加实体
|
||||
/// </summary>
|
||||
@@ -518,6 +595,7 @@ namespace BLL
|
||||
_Approve.State = 0;
|
||||
_Approve.IsAgree = 0;
|
||||
_Approve.ApproveIdea = "";
|
||||
_Approve.IsPushOa = 0;
|
||||
_Approve.ApproveType = approveManModels.Rolename;
|
||||
_Approve.ApproveForm =(type==0? "Invoice_Input": "Invoice_Output");
|
||||
BLL.PHTGL_ApproveService.AddPHTGL_Approve(_Approve);
|
||||
@@ -580,6 +658,8 @@ namespace BLL
|
||||
model.State = (type == 0 ? StateInPutApproveRefuse : StateOutPutApproveRefuse);
|
||||
UpdatePHTGL_Invoice(model);
|
||||
}
|
||||
OAWebSevice.Pushoa();
|
||||
OAWebSevice.DoneRequest(thisApprovemodel.ApproveId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,14 @@ namespace BLL
|
||||
{
|
||||
public static class OAWebSevice
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取推送OA的PCurl
|
||||
/// </summary>
|
||||
/// <param name="projectid"></param>
|
||||
/// <param name="formname"></param>
|
||||
/// <param name="ID"></param>
|
||||
/// <param name="personId"></param>
|
||||
/// <returns></returns>
|
||||
public static string geturl(string projectid, string formname, string ID, string personId)
|
||||
{
|
||||
//string SGGLUrl = Funs.SGGLUrl.Substring(Funs.SGGLUrl.IndexOf("//")+2);
|
||||
@@ -37,12 +44,26 @@ namespace BLL
|
||||
case ActionPlanListApproveService.ActionPlanListEdit:
|
||||
PHTUrl = string.Format("PHTUrl=ZHGL/Plan/ActionPlanListEdit.aspx?ActionPlanListId={0}", ID);
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Input:
|
||||
PHTUrl = string.Format("PHTUrl=PHTGL/InvoiceManage/InvoiceOrderDetail.aspx?InvoiceId={0}&Type=0", ID);
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Output:
|
||||
PHTUrl = string.Format("PHTUrl=PHTGL/InvoiceManage/InvoiceOrderDetail.aspx?InvoiceId={0}&Type=1", ID);
|
||||
break;
|
||||
|
||||
}
|
||||
url = url + PHTUrl;
|
||||
//LogService.AddSys_Log(Person_PersonsService.GetPerson_PersonsById(personId),"", ID, "ActionPlanListEdit",url);
|
||||
return url;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取推送OA的Appurl
|
||||
/// </summary>
|
||||
/// <param name="projectid"></param>
|
||||
/// <param name="formname"></param>
|
||||
/// <param name="ID"></param>
|
||||
/// <param name="userid"></param>
|
||||
/// <returns></returns>
|
||||
public static string getAppurl(string projectid, string formname, string ID, string userid)
|
||||
{
|
||||
string mobileWebUrl = Funs.MobileWebUrl;
|
||||
@@ -65,12 +86,18 @@ namespace BLL
|
||||
case PHTGL_ApproveService.ContractReview:
|
||||
PHTUrl = string.Format("PHTGL/ContractCompile/{0}Detail.aspx?ContractReviewId={1}&PersonId={2}", formname, ID, userid);
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Input:
|
||||
PHTUrl = string.Format("PHTGL/InvoiceManage/InvoiceOrderDetail.aspx?InvoiceId={0}&Type=0&PersonId={1}", ID, userid);
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Output:
|
||||
PHTUrl = string.Format("PHTGL/InvoiceManage/InvoiceOrderDetail.aspx?InvoiceId={0}&Type=1&PersonId={1}", ID, userid);
|
||||
break;
|
||||
}
|
||||
url = url + PHTUrl;
|
||||
return url;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取审批表单主界面
|
||||
/// 获取审批表单主界面(用于推送给创建者)
|
||||
/// </summary>
|
||||
/// <param name="projectid"></param>
|
||||
/// <param name="formname"></param>
|
||||
@@ -103,6 +130,12 @@ namespace BLL
|
||||
case PHTGL_ApproveService.ContractReview_Countersign:
|
||||
PHTUrl = string.Format("PHTUrl=PHTGL/ContractCompile/{0}.aspx", formname);
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Input:
|
||||
PHTUrl = string.Format("PHTUrl=PHTGL/InvoiceManage/InvoiceOrder.aspx");
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Output:
|
||||
PHTUrl = string.Format("PHTUrl=PHTGL/InvoiceManage/InvoiceOrder.aspx");
|
||||
break;
|
||||
}
|
||||
url = url + PHTUrl;
|
||||
return url;
|
||||
@@ -226,6 +259,38 @@ namespace BLL
|
||||
|
||||
}
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Input:
|
||||
var invoice = BLL.PhtglInvoiceService.GetPHTGL_InvoiceById(users.ContractId);
|
||||
if (invoice != null)
|
||||
{
|
||||
var gereceiver = BLL.Person_PersonsService.GetPerson_PersonsById(invoice.CreateUser);
|
||||
var geCreatUser = BLL.Person_PersonsService.GetPerson_PersonsById(users.ApproveMan);
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(invoice.ProjectId);
|
||||
webJson.flowid = users.ApproveId;
|
||||
webJson.requestname = "入库单审批(被拒) " + project.ProjectName;
|
||||
webJson.nodename = users.ApproveType;
|
||||
webJson.creator = geCreatUser.JobNum;
|
||||
webJson.receiver = gereceiver.JobNum;
|
||||
webJson.pcurl = geturl_Form(invoice.ProjectId, PHTGL_ApproveService.Invoice_Input, gereceiver.PersonId);
|
||||
webJson.appurl = getAppurl(invoice.ProjectId, PHTGL_ApproveService.Invoice_Input, invoice.InvoiceId, gereceiver.PersonId);
|
||||
}
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Output:
|
||||
var invoice_output = BLL.PhtglInvoiceService.GetPHTGL_InvoiceById(users.ContractId);
|
||||
if (invoice_output != null)
|
||||
{
|
||||
var gereceiver = BLL.Person_PersonsService.GetPerson_PersonsById(invoice_output.CreateUser);
|
||||
var geCreatUser = BLL.Person_PersonsService.GetPerson_PersonsById(users.ApproveMan);
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(invoice_output.ProjectId);
|
||||
webJson.flowid = users.ApproveId;
|
||||
webJson.requestname = "出库单审批(被拒) " + project.ProjectName;
|
||||
webJson.nodename = users.ApproveType;
|
||||
webJson.creator = geCreatUser.JobNum;
|
||||
webJson.receiver = gereceiver.JobNum;
|
||||
webJson.pcurl = geturl_Form(invoice_output.ProjectId, PHTGL_ApproveService.Invoice_Output, gereceiver.PersonId);
|
||||
webJson.appurl = getAppurl(invoice_output.ProjectId, PHTGL_ApproveService.Invoice_Output, invoice_output.InvoiceId, gereceiver.PersonId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
strjson = JsonConvert.SerializeObject(webJson);
|
||||
returnjson = OAWeb.receiveTodoRequestByJson(strjson);
|
||||
@@ -368,6 +433,38 @@ namespace BLL
|
||||
webJson.appurl = getAppurl(Con_Co.ProjectId, PHTGL_ApproveService.ContractReview, Ctr_Co.ContractReviewId, users[i].ApproveMan);
|
||||
}
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Input:
|
||||
var invoice = BLL.PhtglInvoiceService.GetPHTGL_InvoiceById(users[i].ContractId);
|
||||
if (invoice != null)
|
||||
{
|
||||
var geCreatUser = BLL.Person_PersonsService.GetPerson_PersonsById(invoice.CreateUser);
|
||||
var gereceiver = BLL.Person_PersonsService.GetPerson_PersonsById(users[i].ApproveMan);
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(invoice.ProjectId);
|
||||
webJson.flowid = users[i].ApproveId;
|
||||
webJson.requestname = "入库单审批 " + project.ProjectName;
|
||||
webJson.nodename = users[i].ApproveType;
|
||||
webJson.creator = geCreatUser.JobNum;
|
||||
webJson.receiver = gereceiver.JobNum;
|
||||
webJson.pcurl = geturl(invoice.ProjectId, PHTGL_ApproveService.Invoice_Input, invoice.InvoiceId, users[i].ApproveMan);
|
||||
webJson.appurl = getAppurl(invoice.ProjectId, PHTGL_ApproveService.Invoice_Input, invoice.InvoiceId, users[i].ApproveMan);
|
||||
}
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Output:
|
||||
var invoice_output = BLL.PhtglInvoiceService.GetPHTGL_InvoiceById(users[i].ContractId);
|
||||
if (invoice_output != null)
|
||||
{
|
||||
var geCreatUser = BLL.Person_PersonsService.GetPerson_PersonsById(invoice_output.CreateUser);
|
||||
var gereceiver = BLL.Person_PersonsService.GetPerson_PersonsById(users[i].ApproveMan);
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(invoice_output.ProjectId);
|
||||
webJson.flowid = users[i].ApproveId;
|
||||
webJson.requestname = "出库单审批 " + project.ProjectName;
|
||||
webJson.nodename = users[i].ApproveType;
|
||||
webJson.creator = geCreatUser.JobNum;
|
||||
webJson.receiver = gereceiver.JobNum;
|
||||
webJson.pcurl = geturl(invoice_output.ProjectId, PHTGL_ApproveService.Invoice_Output, invoice_output.InvoiceId, users[i].ApproveMan);
|
||||
webJson.appurl = getAppurl(invoice_output.ProjectId, PHTGL_ApproveService.Invoice_Output, invoice_output.InvoiceId, users[i].ApproveMan);
|
||||
}
|
||||
break;
|
||||
}
|
||||
strjson = JsonConvert.SerializeObject(webJson);
|
||||
returnjson = OAWeb.receiveTodoRequestByJson(strjson);
|
||||
@@ -497,6 +594,12 @@ namespace BLL
|
||||
case PHTGL_ApproveService.ContractReview:
|
||||
webJson.requestname = "合同审批";
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Input:
|
||||
webJson.requestname = "入库单审批";
|
||||
break;
|
||||
case PHTGL_ApproveService.Invoice_Output:
|
||||
webJson.requestname = "出库单审批";
|
||||
break;
|
||||
}
|
||||
string strjson = JsonConvert.SerializeObject(webJson);
|
||||
var returnjson = OAWeb.processDoneRequestByJson(strjson);
|
||||
|
||||
Reference in New Issue
Block a user