You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcContainer/Controllers/MsOpCtnApplyController.cs

1623 lines
71 KiB
C#

2 years ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcContainer.Models.MsOpCtnApply;
using DSWeb.MvcContainer.DAL.MsOpCtnApply;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.RptMng.Comm;
using System.Text;
using DSWeb.Areas.CommMng.Models;
using System.Data;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
using DSWeb.MvcContainer.Models.MsOpCtnBsCard;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.EntityDA;
using DSWeb.TruckMng.Helper.Repository;
namespace DSWeb.MvcContainer.Controllers
{
[JsonRequestBehavior]
public class MsOpCtnApplyController : Controller
{
//
// GET:
public ActionResult SalesIndex()
{
return View();
}
//
// GET: /
public ActionResult SalesEdit()
{
return View();
}
public ActionResult SalesAudit()
{
return View();
}
public ActionResult GoodsAudit()
{
return View();
}
public ActionResult GoodsAuditEdit()
{
return View();
}
public ActionResult CostIndex()
{
return View();
}
public ActionResult CostEdit()
{
return View();
}
public ActionResult CostAudit()
{
return View();
}
public ActionResult CostMdAudit()
{
return View();
}
public ActionResult CostAuditEdit()
{
return View();
}
public ActionResult AddCtn()
{
return View();
}
public ActionResult AddCtnEdit()
{
return View();
}
//
// GET
public ContentResult GetDataList(int start, int limit, string sort, string condition, string pricetype)
{
var dataList = MsOpCtnApplyDAL.GetDataList(start, limit,condition, pricetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), sort);
int count = MsOpCtnApplyDAL.getTotalCount(condition, pricetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetDataListStr(string sort, string condition, string pricetype)
{
var dataListStr = MsOpCtnApplyDAL.GetDataListStr(condition, pricetype, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
public ContentResult GetData(string handle, string condition)
{
OpCtnApply head = null;
if (handle == "edit")
{
head = MsOpCtnApplyDAL.GetData(condition, Convert.ToString(Session["SHOWNAME"]));
}
if (head == null)
{
head = new OpCtnApply();
head.COMPANYID = Convert.ToString(Session["COMPANYID"]);
head.SALE = Convert.ToString(Session["SHOWNAME"]);
head.OP = Convert.ToString(Session["SHOWNAME"]);
head.INPUTBYREF = Convert.ToString(Session["SHOWNAME"]);
head.INPUTBY = Convert.ToString(Session["USERID"]);
head.CURRENCY = "USD";
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data, string body)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data);
var bodyList = JsonConvert.Deserialize<List<OpCtnApplySaleitems>>(body);
var errorstr = "";
var isPost = true;
1 year ago
var ct = MsOpCtnApplyDAL.GetRdCount("GID<>'" + headData.GID + "' AND BSNO='" + headData.BSNO + "'");
if (ct != 0)
{
isPost = false;
errorstr = "业务编号重复!";
}
2 years ago
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
headData.INPUTBY = Convert.ToString(Session["USERID"]);
headData.INPUTTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.BSDATE = DateTime.Now.ToString("yyyy-MM-dd");
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='放箱审批'", Convert.ToString(Session["COMPANYID"]));
if (billnoset.BILLTYPE != "")
headData.BSNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.BSDATE.ToString().Trim(), headData.BSDATE.ToString().Trim());
else
{
errorstr = "放箱审批的申请编号规则未设置,请先设置编号生成规则!";
isPost = false;
}
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
if (headData.PLANCTNDATE == "") headData.PLANCTNDATE = null;
var GID = headData.GID;
if (isPost)
{
var modb = new ModelObjectDB();
var result = modb.Save(headData);
if (result.Success == true)
{
MsOpCtnApplyDAL.SaveCtnApplySaleItems(bodyList, GID, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else {
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<List<OpCtnApply>>(data);
DBResult result = MsOpCtnApplyDAL.DeleteOpCtnApply(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult GetModifyData(string handle, string condition)
{
OpCtnApplyModify head = null;
if (handle == "edit")
{
head = MsOpCtnApplyDAL.GetModifyData(condition, Convert.ToString(Session["SHOWNAME"]));
}
if (head == null)
{
head = new OpCtnApplyModify();
head.INPUTBYREF = Convert.ToString(Session["SHOWNAME"]);
head.INPUTBY = Convert.ToString(Session["USERID"]);
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult ShenModifyDel(string data,string type)
{
var headData = JsonConvert.Deserialize<OpCtnApplyModify>(data);
var errorstr = "";
var isPost = true;
var GID = headData.GID;
headData.DbOperationType = DbOperationType.DbotIns;
headData.GID = Guid.NewGuid().ToString();
headData.APPLYID = GID;
headData.INPUTBY = Convert.ToString(Session["USERID"]);
headData.INPUTTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.BSDATE = DateTime.Now.ToString("yyyy-MM-dd");
if (headData.PLANCTNDATE == "") headData.PLANCTNDATE = null;
headData.MODIFYTYPE = type;
headData.MDSTATUS = "1";
var msgstr = "";
if (isPost)
{
var modb = new ModelObjectDB();
var result = modb.Save(headData);
if (result.Success == true) {
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
if (type == "4")
{
msgstr = "放箱申请-驳回申请删除";
string blUpSQL = "update op_ctnapply set AUDITSTATUS='申请删除',BSSTATUS='销售申请删除' where GID='" + GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
else
{
msgstr = "放箱申请-驳回申请修改";
string blUpSQL = "update op_ctnapply set AUDITSTATUS='申请修改',BSSTATUS='销售申请修改' where GID='" + GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modOpCtnApplySaleAudit') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLYMODIFY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT =msgstr+" 单号:" + headData.BSNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult ShenModifyAudit(string data, string type, string reasean="")
{
var headData = JsonConvert.Deserialize<List<OpCtnApply>>(data);
var errorstr = "";
var isPost = true;
var result = new DBResult();
result.Success = true;
result.Message = "审核成功!";
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
if (headData != null)
{
foreach (var enumValue in headData)
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLYMODIFY";
Msgdata.RECEIVER = enumValue.INPUTBY;
if (type == "0")
{
if (enumValue.AUDITSTATUS == "申请删除") {
Msgdata.NAME = "放箱申请-驳回申请删除";
Msgdata.MESSAGECONTENT = "放箱申请-驳回申请删除 单号:"+enumValue.BSNO;
string blUpSQL = "update op_ctnapply_modify set MDSTATUS='3' where MDSTATUS='1' and MODIFYTYPE='4' AND APPLYID='" + enumValue.GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "update op_ctnapply set AUDITSTATUS='驳回申请删除',BSSTATUS='驳回销售申请删除',AUDITRESULT='"+reasean+"' where GID='" + enumValue.GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
if (enumValue.AUDITSTATUS == "申请修改")
{
Msgdata.NAME = "放箱申请-驳回申请修改";
Msgdata.MESSAGECONTENT = "放箱申请-驳回申请修改 单号:" + enumValue.BSNO;
string blUpSQL = "update op_ctnapply_modify set MDSTATUS='3' where MDSTATUS='1' and MODIFYTYPE='1' AND APPLYID='" + enumValue.GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "update op_ctnapply set AUDITSTATUS='审核通过',BSSTATUS='驳回销售申请修改',AUDITRESULT='" + reasean + "' where GID='" + enumValue.GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
}
else if (type == "1")
{
if (enumValue.AUDITSTATUS == "申请删除") {
Msgdata.NAME = "放箱申请-批准申请删除";
Msgdata.MESSAGECONTENT = "放箱申请-批准申请删除 单号:" + enumValue.BSNO;
string blUpSQL = "delete from op_ctnapply where GID='" + enumValue.GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "delete from op_ctnapply_modify where APPLYID='" + enumValue.GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
if (enumValue.AUDITSTATUS == "申请修改")
{
Msgdata.NAME = "放箱申请-批准申请修改";
Msgdata.MESSAGECONTENT = "放箱申请-批准申请修改 单号:" + enumValue.BSNO;
var head = MsOpCtnApplyDAL.GetModifyData("APPLYID='" + enumValue.GID + "' AND MDSTATUS='1' AND MODIFYTYPE='1' ", Convert.ToString(Session["SHOWNAME"]));
if (head.BSNO != "")
{
enumValue.SALE = head.SALE;
enumValue.OP = head.OP;
enumValue.CUSTOMERNAME = head.CUSTOMERNAME;
enumValue.GOODSNAME = head.GOODSNAME;
enumValue.GOODTYPE = head.GOODTYPE;
enumValue.PORTLOAD = head.PORTLOAD;
enumValue.PORTDISCHARGE = head.PORTDISCHARGE;
enumValue.ISOWNERBOOKING = head.ISOWNERBOOKING;
enumValue.CTNALL = head.CTNALL;
enumValue.CTNNUM = head.CTNNUM;
enumValue.PLANCTNDATE = head.PLANCTNDATE;
enumValue.FACTORYNAME = head.FACTORYNAME;
enumValue.FACTORYADDR = head.FACTORYADDR;
enumValue.SLOAD_FREE_USECTNE_DAY = head.SLOAD_FREE_USECTNE_DAY;
enumValue.SLOAD_OVER_USECTNE_RATE = head.SLOAD_OVER_USECTNE_RATE;
enumValue.SDEST_FREE_USECTNE_DAY = head.SDEST_FREE_USECTNE_DAY;
enumValue.SDEST_OVER_USECTNE_RATE = head.SDEST_OVER_USECTNE_RATE;
enumValue.AGENTNAME = head.AGENTNAME;
enumValue.REMARKS = head.REMARKS;
enumValue.ISPORTLOADDATE = head.ISPORTLOADDATE;
if (enumValue.PLANCTNDATE == "") enumValue.PLANCTNDATE = null;
enumValue.SERVICE = head.SERVICE;
enumValue.NEEDBEHEATED = head.NEEDBEHEATED;
enumValue.WEIGHT = head.WEIGHT;
enumValue.EMPTYCTNALLOCATION = head.EMPTYCTNALLOCATION;
enumValue.PREI_ETD = head.PREI_ETD;
enumValue.DbOperationType = DbOperationType.DbotUpd;
enumValue.ModelUIStatus = "E";
var modb = new ModelObjectDB();
result = modb.Save(enumValue);
if (result.Success == true)
{
string blUpSQL = "update op_ctnapply_modify set MDSTATUS='2' where MDSTATUS='1' and MODIFYTYPE='1' AND APPLYID='" + enumValue.GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "update op_ctnbscard set AGENTNAME='" + head.AGENTNAME + "',PORTLOAD='" + head.PORTLOAD + "',DESTPORT='"+head.PORTDISCHARGE+"' where APPLYNO='" + enumValue.BSNO + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "update op_ctnapply set AUDITSTATUS='审核通过',BSSTATUS='批准销售修改' where GID='" + enumValue.GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
}
}
}
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD ="0";
Msgdata.READCOUNT ="0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = enumValue.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data =""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult ShenModifyCost(string data, string type)
{
var headData = JsonConvert.Deserialize<OpCtnApplyModify>(data);
var errorstr = "";
var isPost = true;
var GID = headData.GID;
headData.DbOperationType = DbOperationType.DbotIns;
headData.GID = Guid.NewGuid().ToString();
headData.APPLYID = GID;
headData.INPUTBY = Convert.ToString(Session["USERID"]);
headData.INPUTTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
headData.BSDATE = DateTime.Now.ToString("yyyy-MM-dd");
if (headData.PLANCTNDATE == "") headData.PLANCTNDATE = null;
headData.MODIFYTYPE = type;
headData.MDSTATUS = "1";
var msgstr = "";
if (isPost)
{
var modb = new ModelObjectDB();
var result = modb.Save(headData);
if (result.Success == true)
{
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
string blUpSQL = "update op_ctnapply set COSTAUDITSTATUS='申请修改',BSSTATUS='成本申请修改' where GID='" + GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
msgstr = "放箱申请-成本核算申请修改";
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modOpCtnApplyCostMdAudit') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLYMODIFY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult ShenModifyCostAudit(string data, string type, string reasean = "")
{
var headData = JsonConvert.Deserialize<List<OpCtnApply>>(data);
var result = new DBResult();
result.Success = true;
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
if (headData != null)
{
foreach (var enumValue in headData)
{
if (type == "0")
{
if (enumValue.COSTAUDITSTATUS == "申请修改")
{
string blUpSQL = "update op_ctnapply_modify set MDSTATUS='3' where MDSTATUS='1' and MODIFYTYPE='5' AND APPLYID='" + enumValue.GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "update op_ctnapply set COSTAUDITSTATUS='驳回申请修改',BSSTATUS='驳回成本申请修改',COSTAUDITRESULT='" + reasean + "' where GID='" + enumValue.GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
result.Message = "驳回成功!";
}
}
else if (type == "1")
{
if (enumValue.COSTAUDITSTATUS == "申请修改")
{
var head = MsOpCtnApplyDAL.GetModifyData("APPLYID='" + enumValue.GID + "' AND MDSTATUS='1' AND MODIFYTYPE='5' ", Convert.ToString(Session["SHOWNAME"]));
if (head.BSNO != "")
{
enumValue.AGENTINPUTBY = head.AGENTINPUTBY;
enumValue.CYCLEDAYS = head.CYCLEDAYS;
enumValue.CHANGERATE = head.CHANGERATE;
enumValue.FULL_CTN_FREE_STORAGE_DAY = head.FULL_CTN_FREE_STORAGE_DAY;
enumValue.FULL_CTN_OVER_STORAGE_RATE = head.FULL_CTN_OVER_STORAGE_RATE;
enumValue.CLEAR_CTN_FREE_STORAGE_DAY = head.CLEAR_CTN_FREE_STORAGE_DAY;
enumValue.CLEAR_CTN_OVER_STORAGE_RATE = head.CLEAR_CTN_OVER_STORAGE_RATE;
enumValue.NO_CLEAR_CTN_FREE_STORAGE_DAY = head.NO_CLEAR_CTN_FREE_STORAGE_DAY;
enumValue.NO_CLEAR_CTN_OVER_STORAGE_RATE = head.NO_CLEAR_CTN_OVER_STORAGE_RATE;
enumValue.CTN_PRICE = head.CTN_PRICE;
enumValue.CURRENCY = head.CURRENCY;
enumValue.AGENTNAME = head.AGENTNAME;
enumValue.LOAD_FREE_USECTNE_DAY = head.LOAD_FREE_USECTNE_DAY;
enumValue.LOAD_OVER_USECTNE_RATE = head.LOAD_OVER_USECTNE_RATE;
enumValue.DEST_FREE_USECTNE_DAY = head.DEST_FREE_USECTNE_DAY;
enumValue.DEST_OVER_USECTNE_RATE = head.DEST_OVER_USECTNE_RATE;
enumValue.DESTPORT_STATOIN = head.DESTPORT_STATOIN;
enumValue.COSTAUDITSTATUS ="审核通过";
enumValue.BSSTATUS = "批准成本修改";
result = MsOpCtnApplyDAL.SaveCost(enumValue);
result.Message = "审核成功!";
if (result.Success == true)
{
string blUpSQL = "update op_ctnapply_modify set MDSTATUS='2' where MDSTATUS='1' and MODIFYTYPE='5' AND APPLYID='" + enumValue.GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "update op_ctnbscard set DESTPORT='" + head.PORTDISCHARGE + "',PORTLOAD_FREE_DAYS=" + head.LOAD_FREE_USECTNE_DAY + ",PORTLOAD_OVER_DAYS_FEE=" + head.LOAD_OVER_USECTNE_RATE + ",DESTPORT_FREE_DAYS=" + head.DEST_FREE_USECTNE_DAY + ",DESTPORT_OVER_DAYS_FEE=" + head.DEST_OVER_USECTNE_RATE + " where APPLYNO='" + enumValue.BSNO + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "update ch_fee set UNITPRICE=" + head.CTN_PRICE + ",AMOUNT=" + head.CTN_PRICE + ",NOTAXAMOUNT=" + head.CTN_PRICE + ",PREAMOUNT=" + head.CTN_PRICE + ",CURRENCY='"+head.CURRENCY+"' where FEENAME='罐箱费' AND FEETYPE=1 AND BSNO IN (SELECT GID FROM OP_CTNBSCARD WHERE APPLYNO='" + enumValue.BSNO + "')";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
}
}
}
}
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = ""
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult ShenModifyDelCancel(string GID,string type)
{
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
if (type == "0")
{
string blUpSQL = "update op_ctnapply set AUDITSTATUS='审核通过',BSSTATUS='销售撤销申请修改' where GID='" + GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "delete from op_ctnapply_modify where MDSTATUS='1' and MODIFYTYPE='1' AND APPLYID='" + GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
if (type == "3")
{
string blUpSQL = "update op_ctnapply set AUDITSTATUS='审核通过',BSSTATUS='销售撤销申请删除' where GID='" + GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "delete from op_ctnapply_modify where MDSTATUS='1' and MODIFYTYPE='4' AND APPLYID='" + GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
var jsonRespose = new JsonResponse
{
Success =true,
Message ="提交成功!",
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult ShenModifyCostCancel(string GID, string type)
{
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
if (type == "6")
{
string blUpSQL = "update op_ctnapply set COSTAUDITSTATUS='审核通过',BSSTATUS='成本撤销申请修改' where GID='" + GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
blUpSQL = "delete from op_ctnapply_modify where MDSTATUS='1' and MODIFYTYPE='5' AND APPLYID='" + GID + "'";
bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
var jsonRespose = new JsonResponse
{
Success = true,
Message = "提交成功!",
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SubmitGoodsAudit(string bill)
{
DBResult result = MsOpCtnApplyDAL.SubmitGoodsAudit(bill, Convert.ToString(Session["USERID"]));
if (result.Success) {
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var strBSNO = T_ALL_DA.GetStrSQL("BSNO", "select top 1 BSNO from op_ctnapply where GID='" + bill + "'");
var msgstr = "放箱申请-提交适货审核";
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modCtnApplyGoodsAudit') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + strBSNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = strBSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitGoodsAuditBack(string bill)
{
DBResult result = MsOpCtnApplyDAL.SubmitGoodsAuditBack(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SaveAuditGoods(string data, string data2)
{
var billData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", ""));
DBResult result = MsOpCtnApplyDAL.AuditGoods(billData, Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditGoodsPass(string data, string data2)
{
var billData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", ""));
billData.AUDITSTATUS = "审核通过";
billData.BSSTATUS = "适货审核通过";
DBResult result = MsOpCtnApplyDAL.AuditGoods(billData, Convert.ToString(Session["USERID"]));
if (result.Success)
{
var msgstr = "放箱申请-适货审核通过";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + billData.BSNO;
Msgdata.RECEIVER = billData.INPUTBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = billData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditGoodsBack(string data, string data2)
{
var billData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", ""));
billData.AUDITSTATUS = "驳回提交";
billData.BSSTATUS = "适货审核驳回";
DBResult result = MsOpCtnApplyDAL.AuditGoods(billData, Convert.ToString(Session["USERID"]));
if (result.Success)
{
var msgstr = "放箱申请-适货审核驳回";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + billData.BSNO;
Msgdata.RECEIVER = billData.INPUTBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = billData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SaveCost(string data, string data2, string data3, string body)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<OpCtnApplyCostitems>>(body);
var errorstr = "";
var isPost = true;
var GID = headData.GID;
if (isPost)
{
var modb = new ModelObjectDB();
var result = MsOpCtnApplyDAL.SaveCost(headData);
if (result.Success == true)
{
MsOpCtnApplyDAL.SaveCtnApplyCostItems(bodyList, GID, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult SubmitCostAudit(string data, string data2, string data3, string body, bool Audit)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<OpCtnApplyCostitems>>(body);
var errorstr = "";
var isPost = true;
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
var GID = headData.GID;
if (Audit)
{
headData.COSTAUDITSTATUS = "提交审核";
headData.BSSTATUS = "提交成本审核";
string blUpSQL = "update op_ctnapply set COSTSUBMITBY='" + Convert.ToString(Session["USERID"]) + "',COSTSUBMITTIME='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where GID='" + headData.GID + "'";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
var msgstr = "放箱申请-提交成本审核";
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='modCtnApplyCostAudit') ");
strSql.Append(" and USERID not in (SELECT USERID FROM user_action where ACTIONID in (select GID from action where [NAME]='APPLYMNGAUDIT')) ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
reader.Close();
}
}
else
{
headData.COSTAUDITSTATUS = "未提交";
string blUpSQL2 = "update op_ctnapply set COSTSUBMITBY='',COSTSUBMITTIME=null where GID='" + headData.GID + "'";
bool bl2 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL2);
}
if (isPost)
{
var modb = new ModelObjectDB();
var result = MsOpCtnApplyDAL.SaveCost(headData);
if (result.Success == true)
{
MsOpCtnApplyDAL.SaveCtnApplyCostItems(bodyList, GID, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult SubmitOpAudit(string data, string data2, string data3, string body)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
var bodyList = JsonConvert.Deserialize<List<OpCtnApplyCostitems>>(body);
var errorstr = "";
var isPost = true;
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
var GID = headData.GID;
headData.BSSTATUS = "操作录入完成";
if (isPost)
{
var modb = new ModelObjectDB();
var result = MsOpCtnApplyDAL.SaveCost(headData);
if (result.Success == true)
{
MsOpCtnApplyDAL.SaveCtnApplyCostItems(bodyList, GID, Convert.ToString(Session["USERID"]));
}
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsOpCtnApplyDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["USERID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var jsonRespose = new JsonResponse { Success = false, Message = errorstr };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
public ContentResult SubmitCostAuditBack(string bill)
{
DBResult result = MsOpCtnApplyDAL.SubmitCostAuditBack(bill);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SaveAuditCost(string data, string data2, string data3)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
DBResult result = MsOpCtnApplyDAL.AuditCost(headData, Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AccAudit(string data, string data2, string data3,string type)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
if (type == "1")
{
headData.ACCAUDITSTATUS = "审核通过";
headData.BSSTATUS = "操作审核通过";
headData.ACCAUDITBY = Convert.ToString(Session["USERID"]);
headData.ACCAUDITTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
else {
headData.ACCAUDITSTATUS = "未审核";
headData.BSSTATUS = "操作审核驳回";
headData.ACCAUDITBY ="";
headData.ACCAUDITTIME =null;
}
DBResult result = MsOpCtnApplyDAL.AccAudit(headData);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult BsAudit(string data, string data2, string data3, string type)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
if (type == "1")
{
headData.BSAUDITSTATUS = "审核通过";
headData.BSSTATUS = "业务审核通过";
headData.BSAUDITBY = Convert.ToString(Session["USERID"]);
headData.BSAUDITTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
else
{
headData.BSAUDITSTATUS = "未审核";
headData.BSSTATUS = "业务审核驳回";
headData.BSAUDITBY = "";
headData.BSAUDITTIME = null;
}
DBResult result = MsOpCtnApplyDAL.BsAudit(headData);
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditCostPass(string data, string data2, string data3)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
headData.COSTAUDITSTATUS = "审核通过";
headData.BSSTATUS = "成本审核通过";
headData.MNGAUDITSTATUS = "提交审核";
DBResult result = MsOpCtnApplyDAL.AuditCost(headData, Convert.ToString(Session["USERID"]));
if (result.Success)
{
var msgstr = "放箱申请-成本(方案)审核通过";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = headData.COSTSUBMITBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
var strSql = new StringBuilder();
strSql.Append("SELECT USERID FROM ");
strSql.Append(" user_action WHERE ACTIONID in (select GID from action where [NAME]='APPLYMNGAUDIT') ");
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = Convert.ToString(reader["USERID"]);
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb2 = new ModelObjectRepository();
Msgmodb2.Save(Msgdata);
}
reader.Close();
}
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult AuditCostBack(string data, string data2, string data3)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
headData.COSTAUDITSTATUS = "驳回提交";
headData.BSSTATUS = "成本审核驳回";
headData.MNGAUDITSTATUS = "未提交";
DBResult result = MsOpCtnApplyDAL.AuditCost(headData, Convert.ToString(Session["USERID"]));
if (result.Success)
{
var msgstr = "放箱申请-方案审批驳回";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = headData.COSTSUBMITBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = headData.INPUTBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult MNGAuditPass(string data, string data2, string data3)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
headData.MNGAUDITSTATUS = "审核通过";
headData.BSSTATUS = "总经理审核通过";
DBResult result = MsOpCtnApplyDAL.MNGAudit(headData, Convert.ToString(Session["USERID"]));
if (result.Success)
{
var msgstr = "放箱申请-总经理审核通过";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = headData.COSTSUBMITBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = headData.INPUTBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult MNGAuditBack(string data, string data2, string data3)
{
var headData = JsonConvert.Deserialize<OpCtnApply>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
headData.BSSTATUS = "总经理审核驳回";
headData.MNGAUDITSTATUS = "驳回提交";
headData.ACCAUDITSTATUS = "驳回提交";
DBResult result = MsOpCtnApplyDAL.MNGAudit(headData, Convert.ToString(Session["USERID"]));
if (result.Success)
{
var msgstr = "放箱申请-总经理审核驳回";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + headData.BSNO;
Msgdata.RECEIVER = headData.COSTSUBMITBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = headData.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitAddCtn(string bill)
{
DBResult result = MsOpCtnApplyDAL.SubmitAddCtn(bill,"配箱完成");
if (result.Success)
{
var head = MsOpCtnApplyDAL.GetData("GID='"+bill+"'", Convert.ToString(Session["SHOWNAME"]));
var msgstr = "放箱申请-配箱完成";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + head.BSNO;
Msgdata.RECEIVER = head.INPUTBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = head.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult SubmitBackAddCtn(string bill)
{
DBResult result = MsOpCtnApplyDAL.SubmitAddCtn(bill, "总经理审核通过");
if (result.Success)
{
var head = MsOpCtnApplyDAL.GetData("GID='" + bill + "'", Convert.ToString(Session["SHOWNAME"]));
var msgstr = "放箱申请-撤销配箱完成";
var Msgdata = new SYSMessagemb();
Msgdata.GID = Guid.NewGuid().ToString();
Msgdata.NAME = "CTNAPPLY";
Msgdata.DESCRIPTION = msgstr;
Msgdata.MESSAGECONTENT = Convert.ToString(Session["SHOWNAME"]) + " " + msgstr + " 单号:" + head.BSNO;
Msgdata.RECEIVER = head.INPUTBY;
Msgdata.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
Msgdata.ISREAD = "0";
Msgdata.READCOUNT = "0";
Msgdata.TYPE = "0";
Msgdata.TASKURL = "";
Msgdata.TASKID = head.BSNO;
Msgdata.NUMBER = "0";
Msgdata.RECVTYPE = "2";
Msgdata.DbOperationType = DbOperationType.DbotIns;
Msgdata.ModelUIStatus = "I";
var Msgmodb = new ModelObjectRepository();
Msgmodb.Save(Msgdata);
}
var json = JsonConvert.Serialize(result);
return new ContentResult() { Content = json };
}
public ContentResult GetCtnApplySaleItemsList(string condition, string sort)
{
var dataList = MsOpCtnApplyDAL.GetCtnApplySaleItemsList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetCtnApplyCostItemsList(string condition, string sort)
{
var dataList = MsOpCtnApplyDAL.GetCtnApplyCostItemsList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult GetCtnApplyCostSum(string condition, string sort, string printstr = "false")
{
var strSql = new StringBuilder();
strSql.Append("select CURRENCY,sum(AMOUNT) AMOUNT from op_ctnapplycostitems");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" Where " + condition);
}
strSql.Append(" group by CURRENCY");
var sortstring = DatasetSort.Getsortstring(sort);
if (!string.IsNullOrEmpty(sortstring))
{
strSql.Append(" order by " + sortstring + " '");
}
if ((!string.IsNullOrEmpty(printstr)) && (printstr == "true"))
{
var jsonRespose = new JsonResponse
{
Success = true,
Message = "完成",
Data = strSql.ToString()
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else
{
var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(0, 100, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
}
public ContentResult GetCtnApplyCtnItemsList(string condition, string sort)
{
var dataList = MsOpCtnApplyDAL.GetCtnApplyCtnItemsList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult SaveCtnApplyCostItems(string body, string PID)
{
//
var bodyList = JsonConvert.Deserialize<List<OpCtnApplyCostitems>>(body);
DBResult result = MsOpCtnApplyDAL.SaveCtnApplyCostItems(bodyList, PID, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveCtnApplyCtnItems(string body, string PID)
{
//
var bodyList = JsonConvert.Deserialize<List<OpCtnApplyCtnitems>>(body);
DBResult result = MsOpCtnApplyDAL.SaveCtnApplyCtnItems(bodyList, PID, Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteOpCtnApplySaleItems(string data)
{
var headData = JsonConvert.Deserialize<List<OpCtnApplySaleitems>>(data);
DBResult result = MsOpCtnApplyDAL.DeleteOpCtnApplySaleItems(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteOpCtnApplyCostItems(string data)
{
var headData = JsonConvert.Deserialize<List<OpCtnApplyCostitems>>(data);
DBResult result = MsOpCtnApplyDAL.DeleteOpCtnApplyCostItems(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult DeleteOpCtnApplyCtnItems(string data)
{
var headData = JsonConvert.Deserialize<List<OpCtnApplyCtnitems>>(data);
DBResult result = MsOpCtnApplyDAL.DeleteOpCtnApplyCtnItems(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult CtnCreateBill(string data, string PID)
{
var headData = MsOpCtnApplyDAL.GetData("GID='" + PID + "'", Convert.ToString(Session["USERID"]));
var BodyData = JsonConvert.Deserialize<List<OpCtnApplyCtnitems>>(data);
1 year ago
MsOpCtnApplyDAL.SaveCtnApplyCtnItems(BodyData, PID, Convert.ToString(Session["USERID"]));
2 years ago
var SaleData = MsOpCtnApplyDAL.GetCtnApplySaleItemsList("LINKGID='" + PID + "'");
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var strYARDNAME = T_ALL_DA.GetStrSQL("CUSTOMERNAME", "select top 1 CUSTOMERNAME from op_ctnapplycostitems where FEENAME='清洗费' and LINKGID='" + PID.Trim() + "'");
var iscr = true;
if (headData != null && BodyData != null)
{
foreach (var enumValue in BodyData)
{
var head = new OpCtnBsCard();
var GID=Guid.NewGuid().ToString();
head.GID=GID;
head.COMPANYID = Convert.ToString(Session["COMPANYID"]);
head.OP =headData.OP;
head.INPUTBYREF = Convert.ToString(Session["SHOWNAME"]);
head.INPUTBY = Convert.ToString(Session["USERID"]);
head.CTNNO = enumValue.CTNNO;
head.CTNPROP = enumValue.CTNPROP;
head.GOODSNAME = headData.GOODSNAME;
head.PREGOODSNAME = headData.PREGOODSNAME;
head.PORTLOAD = headData.PORTLOAD;
head.DESTPORT = headData.PORTDISCHARGE;
head.INPUTTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
head.CUSTOMERNAME = headData.CUSTOMERNAME;
head.AGENTNAME = headData.AGENTNAME;
head.LOADFACTORY = headData.FACTORYNAME;
head.PRE_CNT_TIME = headData.PLANCTNDATE;
string lsSQL = "SELECT TOP 1 VDESTPORT_STATOIN FROM v_top_opctnbscard WHERE CTNNO='" + enumValue.CTNNO + "' ";
DataSet dsHSCODE = T_ALL_DA.GetAllSQL(lsSQL);
if (dsHSCODE != null)
{
if (dsHSCODE.Tables[0].Rows.Count > 0)
{
head.PORTLOAD_STATOIN = dsHSCODE.Tables[0].Rows[0]["VDESTPORT_STATOIN"].ToString();
}
}
head.DESTPORT_STATOIN = strYARDNAME;
//var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='罐箱业务卡'", Convert.ToString(Session["COMPANYID"]));
//if (billnoset.BILLTYPE != "")
// head.BSNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.INPUTTIME.ToString().Trim(), headData.INPUTTIME.ToString().Trim());
head.APPLYNO = headData.BSNO;
head.BSNO = MsOpCtnApplyDAL.GetBillBsNo(headData.BSNO + "-" + headData.CTNNUM + "-");
head.DbOperationType = DbOperationType.DbotIns;
head.PORTLOAD_FREE_DAYS = headData.LOAD_FREE_USECTNE_DAY;
head.PORTLOAD_OVER_DAYS_FEE = headData.LOAD_OVER_USECTNE_RATE;
head.DESTPORT_FREE_DAYS = headData.DEST_FREE_USECTNE_DAY;
head.DESTPORT_OVER_DAYS_FEE = headData.DEST_OVER_USECTNE_RATE;
if (head.ETD == "") head.ETD = null;
if (head.ETA == "") head.ETA = null;
if (head.PREETA == "") head.PREETA = null;
if (head.I_ETD == "") head.I_ETD = null;
if (head.I_ETA == "") head.I_ETA = null;
if (head.PREI_ETA == "") head.PREI_ETA = null;
if (head.PORTLOADDATE == "") head.PORTLOADDATE = null;
if (head.I_ARRIVALDATE == "") head.I_ARRIVALDATE = null;
if (head.I_DEST_CNT_TIME == "") head.I_DEST_CNT_TIME = null;
if (head.I_DEST_RTCNT_TIME == "") head.I_DEST_RTCNT_TIME = null;
if (head.I_PORTLOAD_CNT_TIME == "") head.I_PORTLOAD_CNT_TIME = null;
if (head.PORTLOAD_CNT_TIME == "") head.PORTLOAD_CNT_TIME = null;
if (head.ARRIVALDATE == "") head.ARRIVALDATE = null;
if (head.DEST_CNT_TIME == "") head.DEST_CNT_TIME = null;
if (head.DEST_RTCNT_TIME == "") head.DEST_RTCNT_TIME = null;
if (head.PRE_CNT_TIME == "") head.PRE_CNT_TIME = null;
head.DESTPORT_STATOIN = headData.DESTPORT_STATOIN;
head.SERVICE = headData.SERVICE;
head.NEEDBEHEATED = headData.NEEDBEHEATED;
head.AGENTINPUTBY = headData.AGENTINPUTBY;
head.EMPTYCTNALLOCATION = headData.EMPTYCTNALLOCATION;
var modb = new ModelObjectDB();
DBResult result = modb.Save(head);
if (result.Success == true)
{
MsOpCtnApplyDAL.SaveSaleToOpCtnRepair(SaleData, GID, Convert.ToString(Session["USERID"]));
MsOpCtnApplyDAL.UpOpCtnApplyCtnItems(enumValue.GID, Convert.ToString(Session["USERID"]));
var CostData = MsOpCtnApplyDAL.GetCtnApplyCostItemsList("LINKGID='" + PID + "'");
MsOpCtnApplyDAL.SaveFeeDR(headData.CTN_PRICE,headData.CURRENCY, GID, Convert.ToString(Session["USERID"]), Convert.ToInt16(headData.CTNNUM),headData.CUSTOMERNAME);
MsOpCtnApplyDAL.SaveFee(CostData, GID, Convert.ToString(Session["USERID"]), Convert.ToInt16(headData.CTNNUM));
}
else iscr = false;
}
}
if (iscr)
{
var jsonRespose = new JsonResponse { Success =true, Message ="生成成功!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
else {
var jsonRespose = new JsonResponse { Success = false, Message = "生成过程中出现错误!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
#region 参照部分
#endregion
}
}