using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using DSWeb.Areas.OA.DAL.Baoxiao2; using DSWeb.Areas.OA.Models.Baoxiao; using DSWeb.Areas.OA.Models.Jiekuan; using DSWeb.Areas.OA.Models.Comm; using DSWeb.TruckMng.Comm.Cookie; using DSWeb.TruckMng.Helper; using DSWeb.TruckMng.Helper.Repository; using DSWeb.Areas.CommMng.DAL; using HcUtility.Comm; using HcUtility.Core; using Microsoft.Practices.EnterpriseLibrary.Data; using System.Text; using System.Data; using DSWeb.Areas.Import.Models.CwVouitems; using DSWeb.Areas.Import.Models.CwDesign; using DSWeb.Areas.Import.DAL.CwVouchersDAL; using DSWeb.Areas.Import.Models.CwVouchers; using DSWeb.EntityDA; using WebSqlHelper; using DSWeb.Areas.Account.Models.MsCwVouchersGl3; namespace DSWeb.MvcShipping.Controllers { [JsonRequestBehavior] public class MsCwVouchersGlBaoxiao2Controller : Controller { public ActionResult Index() { return View(); } public ActionResult Edit() { return View(); } public ContentResult GetDataList(int start, int limit, string sort, string condition) { var dataList = BaoxiaoDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetData(string handle, string condition) { Baoxiaomb head = null; if (handle == "edit") { var list = BaoxiaoDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); if (list.Count > 0) head = list[0]; } if (head == null) { head = new Baoxiaomb(); } var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } public ContentResult GetFeeList(string BXGID) { var dataList = BaoxiaoDAL.GetFeeList("BXGID='" + BXGID + "'"); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetPayList(string BXGID) { var dataList = BaoxiaoDAL.GetPayList(BXGID, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetThisFee(string MBLNO) { var dataList = BaoxiaoDAL.GetAmountList(" C.BSNO=(select bsno from vw_settlement where mblno='" + MBLNO + "') and c.feetype=2 and c.feestatus=1 and (BXGID is null or BXGID='')"); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetBSNO(string COMPANYID) { var dataList = BaoxiaoDAL.GetBSNO(COMPANYID); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetAllBSNO ( string condition ) { var dataList = BaoxiaoDAL.GetAllBSNO( condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetTruckMBLNO ( string COMPANYID ) { var dataList = BaoxiaoDAL.GetTruckMBLNO(""); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetTruckBSNO ( string MBLNO ) { var dataList = BaoxiaoDAL.GetTruckBSNO(" where MBLNO='" + MBLNO + "'"); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetBaoXiao2Body ( string condition ) { var dataList = BaoxiaoDAL.GetBaoXiao2Body(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public static int p_op_gain(string bxgid) { Database db = DatabaseFactory.CreateDatabase(); var cmd = db.GetStoredProcCommand("p_op_gain_bybxgid"); db.AddInParameter(cmd, "@bxgid", DbType.String, bxgid); db.ExecuteNonQuery(cmd); return 0; } public int SetGZ(string BXGID) {//设置挂账信息 //var _count = 0; var strSql = new StringBuilder(); //foreach (var BX in BaoxiaoList) //{ //var BXGID = BX.BXGID; strSql.Append( " update ch_fee set feestatus=0 where "); strSql.Append( " CHEQUENUM in( select TICKETNO from OA_Baoxiao_Pay where SETTLEMENTTYPE=4 and bxgid='" + BXGID + "') "); strSql.Append( " and bxgid='" + BXGID + "' "); strSql.Append( " update ch_fee set feestatus=9 where "); strSql.Append( " CHEQUENUM in( select TICKETNO from OA_Baoxiao_Pay where SETTLEMENTTYPE<>4 and bxgid='" + BXGID + "') "); strSql.Append( " and bxgid='" + BXGID + "' "); //} return BaoxiaoDAL.SetFee(strSql); } #region 生成总账凭证 public ContentResult GetCodeCurrencyList(string strGids) { var dataList = BaoxiaoDAL.GetCodeCurrencyList(strGids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult onAddCwVouchers(string strGids, string dataDiv, string jsonBody) { var headData = JsonConvert.Deserialize(dataDiv); List bodyList = new List(); if (jsonBody != null) { bodyList = JsonConvert.Deserialize>(jsonBody); } if (bodyList == null && headData.ISRATE == false) { headData.ISRATE = true; } // DBResult result2 = BaoxiaoDAL.GetIsVoucher(strGids, Convert.ToString(Session["USERID"])); if (!result2.Success) { var jsonRespose2 = new JsonResponse { Success = result2.Success, Message = result2.Message, Data = "" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) }; } // DBResult result = BaoxiaoDAL.onAddCwVouchers(strGids, headData, bodyList, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"])); // string sGids = "'" + strGids.Trim().Replace(",", "','") + "'"; T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA(); string sVOUCHERNO = T_ALL_DA.GetStrSQL("VOUCHERNO", "select top 1 VOUCHERNO from ch_fee_settlement where gid in (" + sGids + ")"); // var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = sVOUCHERNO }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult GetIsVoucher(string strGids) { DBResult result = BaoxiaoDAL.GetIsVoucher(strGids, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } /// /// 是否自动弹出结算总账凭证 /// /// public ContentResult onIsSettlementsopen() { DBResult result = BaoxiaoDAL.onIsSettlementsopen(Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion // } }