|
|
using System;
|
|
|
using System.Linq;
|
|
|
using System.Web.Mvc;
|
|
|
using DSWeb.MvcShipping.DAL.MsOpSeaiDAL;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeai;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Comm.Cookie;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using System.Collections.Generic;
|
|
|
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
|
|
|
using DSWeb.EntityDA;
|
|
|
using System.IO;
|
|
|
using System.Text;
|
|
|
using System.Data;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using DSWeb.Areas.CommMng.DAL;
|
|
|
using DSWeb.Areas.RptMng.Comm;
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeFtpSet;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysBillNoSet;
|
|
|
using DSWeb.MvcShipping.Models.MsSysBillNoSet;
|
|
|
using DSWeb.MvcShipping.Models.MsOpApply;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using DSWeb.MvcShipping.Models.MsOpSeaeToSeai;
|
|
|
using DSWeb.SoftMng.DAL.SoftSysTable;
|
|
|
using DSWeb.MvcShipping.Models.MsChFee;
|
|
|
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
using Microsoft.Office.Interop.Excel;
|
|
|
|
|
|
|
|
|
using DSWeb.MvcShipping.Models.WMSNew;
|
|
|
using DSWeb.MvcShipping.Helper.Repository;
|
|
|
using Type = System.Type;
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Controllers
|
|
|
{
|
|
|
[JsonRequestBehavior]
|
|
|
public class MsOpSeaiController : Controller
|
|
|
{
|
|
|
#region 窗口页面
|
|
|
public ActionResult Index()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult HistryFeeIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult Edit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult FeeEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult SeaiFeeView()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult FeeAmendEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult ReceiptEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult WMSIN()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult WMSINEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult WMSOUT()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult WMSOUTEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult PiLiangFeeEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult EditView()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult SaleIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult Seae2SeaiIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult SaleEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
public ActionResult AmendIndex()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
public ActionResult AmendFeeEdit()
|
|
|
{
|
|
|
return View();
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 基本函数
|
|
|
public ContentResult GetDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
var dataList = MsOpSeaiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
int count = MsOpSeaiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetSaleDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
var dataList = MsOpSeaiDAL.GetSaleDataList(condition, Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort, Convert.ToString(Session["USERID"]));
|
|
|
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 GetAmendDataList(int start, int limit, string sort, string condition, string load)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
|
|
|
var dataList = MsOpSeaiDAL.GetAmendDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
int count = MsOpSeaiDAL.getAmendTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetAmendDataListStr(string sort, string condition)
|
|
|
{
|
|
|
var dataListStr = MsOpSeaiDAL.GetAmendDataStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = dataListStr.Message, data = dataListStr.Data });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetFenList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaiDAL.GetFenList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
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 GetDataListStr(string sort, string condition)
|
|
|
{
|
|
|
var dataListStr = MsOpSeaiDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetData(string handle, string condition)
|
|
|
{
|
|
|
string userid = Convert.ToString(Session["USERID"]);
|
|
|
if (userid == "" || userid == null)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
MsOpSeai head = null;
|
|
|
if (handle == "edit" || handle == "copyadd")
|
|
|
{
|
|
|
head = MsOpSeaiDAL.GetData(condition);
|
|
|
}
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new MsOpSeai();
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.BSTYPE = "2";
|
|
|
var SALEORDERDEPTBYOP = MsSysParamSetDAL.GetData("PARAMNAME='SALEORDERDEPTBYOP'");
|
|
|
if (SALEORDERDEPTBYOP.PARAMVALUE == "1")
|
|
|
{
|
|
|
head.SALEDEPT = Convert.ToString(Session["DEPTNAME"]);
|
|
|
}
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetAmendData(string condition)
|
|
|
{
|
|
|
MsOpSeai head = null;
|
|
|
|
|
|
var headlist = MsOpSeaiDAL.GetAmendDataList(0, 1, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (headlist.Count > 0)
|
|
|
head = headlist[0];
|
|
|
else
|
|
|
head = new MsOpSeai();
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetBodyList(string condition)
|
|
|
{
|
|
|
var dataList = MsOpSeaiDAL.GetBodyList(condition);
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
#region 保存
|
|
|
public ContentResult Save(string opstatus, string data, string data2, string data3, string body, string goodsbody)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var headData = JsonConvert.Deserialize<MsOpSeai>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaiDetail>>(body);
|
|
|
var goodsbodyList = JsonConvert.Deserialize<List<MsOpApplyDetail>>(goodsbody);
|
|
|
|
|
|
var isPost = true;
|
|
|
var errorstr = "";
|
|
|
var iscreatecustno = false;
|
|
|
#region 默认值
|
|
|
T_ALL_DA T_ALL_DA = new EntityDA.T_ALL_DA();
|
|
|
string rq = T_ALL_DA.GetStrSQL("rq", "select getdate() as rq");
|
|
|
if (headData.INPUTBY.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
}
|
|
|
if (headData.CORPID == "" || headData.CORPID ==null)
|
|
|
{
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
}
|
|
|
var isuse = false;
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='海运进口'", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
isuse = true;
|
|
|
else
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "2");
|
|
|
if (headData.CUSTNO.Trim() == "" || headData.CUSTNO ==null)
|
|
|
{
|
|
|
|
|
|
if (isuse)
|
|
|
{
|
|
|
if (billnoset.BILLTYPE != "")
|
|
|
{
|
|
|
var FENCUSTNOE = MsSysParamSetDAL.GetData("PARAMNAME='FENCUSTNOE'");
|
|
|
if (FENCUSTNOE.PARAMVALUE == "1" && headData.MASTERNO != "" && headData.BSNO != headData.MASTERNO)
|
|
|
{
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetFenCustNo(headData.MASTERNO, "op_seai");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
|
|
|
iscreatecustno = true;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
headData.CUSTNO = MsOpSeaiDAL.getCodeRule("委托编号", "CUSTNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND CUSTNO='" + headData.CUSTNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号重复";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (headData.CUSTNO == "")
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "委托编号为空";
|
|
|
}
|
|
|
|
|
|
//
|
|
|
if (headData.MBLNO != "" && headData.MBLNO != null && headData.BLTYPE != "拼箱分票")
|
|
|
{
|
|
|
var mblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='SeaiMblrepeat'");
|
|
|
if (mblreapeat.PARAMVALUE != "1")
|
|
|
{
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND MBLNO='" + headData.MBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "主提单号重复";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
isuse = MsBaseInfoDAL.GetRuleUse("主提单号", "2");
|
|
|
if (isuse)
|
|
|
{
|
|
|
headData.CUSTNO = MsOpSeaiDAL.getCodeRule("主提单号", "MBLNO", headData.BSDATE.ToString().Trim(), headData.ACCDATE.ToString().Trim(), Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (headData.HBLNO != "" && headData.HBLNO != null)
|
|
|
{
|
|
|
var mblreapeat = MsSysParamSetDAL.GetData("PARAMNAME='SeaiHblrepeat'");
|
|
|
if (mblreapeat.PARAMVALUE != "1")
|
|
|
{
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND HBLNO='" + headData.HBLNO + "' and CORPID='" + Convert.ToString(Session["COMPANYID"]) + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "分提单号重复";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var billnosethblno = MsSysBillNoSetDAL.GetData("OPLBNAME='海运进口' AND RULEBLNO='分提单号' ", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (billnosethblno.BILLTYPE != "" && billnosethblno.ISAUTO == "1")
|
|
|
{
|
|
|
var hblno = MsSysBillNoSetDAL.GetBillNo(billnosethblno, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID);
|
|
|
headData.HBLNO = hblno;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (headData.ORDERNO != "" && headData.ORDERNO != null)
|
|
|
{
|
|
|
var ct = MsOpSeaiDAL.GetRdCount("BSNO<>'" + headData.BSNO + "' AND ORDERNO='" + headData.ORDERNO + "'");
|
|
|
if (ct != 0)
|
|
|
{
|
|
|
isPost = false;
|
|
|
errorstr = "订舱编号重复";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//
|
|
|
if (headData.ACCDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.ACCDATE = DateTime.Parse(rq).ToString("yyyy-MM");
|
|
|
}
|
|
|
if (headData.BSDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.BSDATE = rq;
|
|
|
}
|
|
|
//
|
|
|
if (headData.ETD != null)
|
|
|
{
|
|
|
if (headData.ETD.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.ETD = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.ETA != null)
|
|
|
{
|
|
|
if (headData.ETA.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.ETA = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.CUSTOMDATE != null)
|
|
|
{
|
|
|
if (headData.CUSTOMDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.CUSTOMDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.INSPECTIONDATE != null)
|
|
|
{
|
|
|
if (headData.INSPECTIONDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.INSPECTIONDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.BMDDATE != null)
|
|
|
{
|
|
|
if (headData.BMDDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.BMDDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.MDTDATE != null)
|
|
|
{
|
|
|
if (headData.MDTDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.MDTDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.UPDATETIME != null)
|
|
|
{
|
|
|
if (headData.UPDATETIME.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.UPDATETIME = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.CLOSINGDATE != null)
|
|
|
{
|
|
|
if (headData.CLOSINGDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.CLOSINGDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.ISSUEDATE != null)
|
|
|
{
|
|
|
if (headData.ISSUEDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.ISSUEDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.CLOSEDOCDATE != null)
|
|
|
{
|
|
|
if (headData.CLOSEDOCDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.CLOSEDOCDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.INTOPORTDATE != null)
|
|
|
{
|
|
|
if (headData.INTOPORTDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.INTOPORTDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.TARRIFSPAIEDTIEM != null)
|
|
|
{
|
|
|
if (headData.TARRIFSPAIEDTIEM.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.TARRIFSPAIEDTIEM = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.NOR != null)
|
|
|
{
|
|
|
if (headData.NOR.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.NOR = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.STLDATE != null)
|
|
|
{
|
|
|
if (headData.STLDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.STLDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.PORTLOAD == null)
|
|
|
{
|
|
|
headData.PORTLOAD = "";
|
|
|
}
|
|
|
if (headData.PORTDISCHARGE == null)
|
|
|
{
|
|
|
headData.PORTDISCHARGE = "";
|
|
|
}
|
|
|
if (headData.GOODSNAME == null)
|
|
|
{
|
|
|
headData.GOODSNAME = "";
|
|
|
}
|
|
|
if (headData.CUSTOMSER == null)
|
|
|
{
|
|
|
headData.CUSTOMSER = "";
|
|
|
}
|
|
|
if (headData.INSPECTION == null)
|
|
|
{
|
|
|
headData.INSPECTION = "";
|
|
|
}
|
|
|
if (headData.KINDPKGS == null)
|
|
|
{
|
|
|
headData.KINDPKGS = "";
|
|
|
}
|
|
|
if (headData.CARRIER == null)
|
|
|
{
|
|
|
headData.CARRIER = "";
|
|
|
}
|
|
|
if (headData.TRUCKER == null)
|
|
|
{
|
|
|
headData.TRUCKER = "";
|
|
|
}
|
|
|
if (headData.GOODSTYPENAME == null)
|
|
|
{
|
|
|
headData.GOODSTYPENAME = "";
|
|
|
}
|
|
|
if (headData.CURRENCY == null)
|
|
|
{
|
|
|
headData.CURRENCY = "";
|
|
|
}
|
|
|
if (headData.WMSTYPE == null)
|
|
|
{
|
|
|
headData.WMSTYPE = "";
|
|
|
}
|
|
|
if (headData.CHANGEDOCDATE == "") headData.CHANGEDOCDATE = null;
|
|
|
|
|
|
//需求编号:SR2017071700004
|
|
|
if (headData.SJYHDATE != null)
|
|
|
{
|
|
|
if (headData.SJYHDATE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.SJYHDATE = null;
|
|
|
}
|
|
|
}
|
|
|
if (headData.YaXiangDate != null)
|
|
|
{
|
|
|
if (headData.YaXiangDate.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.YaXiangDate = null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
//
|
|
|
if (opstatus == "add")
|
|
|
{
|
|
|
#region 默认值
|
|
|
headData.ORDERTYPE = "操作录入";
|
|
|
headData.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
if (headData.BSTYPE == null)
|
|
|
{
|
|
|
headData.BSTYPE = "普通货";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (headData.BSTYPE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.BSTYPE = "普通货";
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (headData.BLTYPE == null)
|
|
|
{
|
|
|
headData.BLTYPE = "整箱";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (headData.BLTYPE.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.BLTYPE = "整箱";
|
|
|
}
|
|
|
}
|
|
|
//
|
|
|
if (headData.MASTERNO == null)
|
|
|
{
|
|
|
headData.MASTERNO = headData.BSNO;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (headData.MASTERNO.ToString().Trim() == "")
|
|
|
{
|
|
|
headData.MASTERNO = headData.BSNO;
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
//
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
|
|
|
if (headData.ETD != "" && headData.CUSTOMERNAME != "")// headData.STLDATE == "" &&
|
|
|
{
|
|
|
//根据客户、开船日计算账期
|
|
|
|
|
|
var _dmb = MsInfoClientDAL.GetSTLDATE(headData.CUSTOMERNAME, "海运出口", headData.ETD, headData.SALE);
|
|
|
headData.STLNAME = _dmb.STLNAME;
|
|
|
headData.STLDATE = _dmb.STLDATE;
|
|
|
|
|
|
if (_dmb.STLNAME == "")
|
|
|
{
|
|
|
headData.STLNAME = "现结买单";
|
|
|
headData.STLDATE = headData.ETD;
|
|
|
}
|
|
|
if (_dmb.BSSOURCE != "") headData.BSSOURCE = _dmb.BSSOURCE;
|
|
|
}
|
|
|
|
|
|
if (headData.MASTERNO == null) { headData.MASTERNO = headData.BSNO; }
|
|
|
if (headData.ETA == "") headData.ETA = null;
|
|
|
if (headData.ETD == "") headData.ETD = null;
|
|
|
if (headData.STLDATE == "") headData.STLDATE = null;
|
|
|
if (headData.CUSTOMDATE == "") headData.CUSTOMDATE = null;
|
|
|
if (headData.INSPECTIONDATE == "") headData.INSPECTIONDATE = null;
|
|
|
if (headData.ISSUEDATE == "") headData.ISSUEDATE = null;
|
|
|
if (headData.CLOSEDOCDATE == "") headData.CLOSEDOCDATE = null;
|
|
|
if (headData.INTOPORTDATE == "") headData.INTOPORTDATE = null;
|
|
|
if (headData.BMDDATE == "") headData.BMDDATE = null;
|
|
|
if (headData.MDTDATE == "") headData.MDTDATE = null;
|
|
|
if (headData.TARRIFSPAIEDTIEM == "") headData.TARRIFSPAIEDTIEM = null;
|
|
|
if (headData.NOR == "") headData.NOR = null;
|
|
|
if (headData.UPDATETIME == "") headData.UPDATETIME = null;
|
|
|
if (headData.TIHUOTIME == "") headData.TIHUOTIME = null;
|
|
|
|
|
|
//需求编号:SR2017071700004
|
|
|
if (headData.SJYHDATE == "") headData.SJYHDATE = null;
|
|
|
if (headData.YaXiangDate == "") headData.YaXiangDate = null;
|
|
|
|
|
|
|
|
|
#region 判断字段长度
|
|
|
if (isPost)
|
|
|
{
|
|
|
var seaefield = MsSoftSysTableDAL.GetDefTableDetailList("OP_SEAI");
|
|
|
foreach (var enumValue in seaefield)
|
|
|
{
|
|
|
if (enumValue.FIELDNAME == "MBLNO" && headData.MBLNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "主提单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "HBLNO" && headData.HBLNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "分提单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CUSTNO" && headData.CUSTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "委托编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ORDERNO" && headData.ORDERNO != null && headData.ORDERNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "订舱编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SHIPPERID" && headData.SHIPPERID != null && headData.SHIPPERID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEEID" && headData.CONSIGNEEID != null && headData.CONSIGNEEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTYID" && headData.NOTIFYPARTYID != null && headData.NOTIFYPARTYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "通知人代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SHIPPER" && headData.SHIPPER != null && headData.SHIPPER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEE" && headData.CONSIGNEE != null && headData.CONSIGNEE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTY" && headData.NOTIFYPARTY != null && headData.NOTIFYPARTY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "通知人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "AGENTID" && headData.AGENTID != null && headData.AGENTID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "代理名称超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "AGENT" && headData.AGENT != null && headData.AGENT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "代理超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VESSEL" && headData.VESSEL != null && headData.VESSEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VOYNO" && headData.VOYNO != null && headData.VOYNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "航次超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTLOADID" && headData.PORTLOADID != null && headData.PORTLOADID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "装货港代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTLOAD" && headData.PORTLOAD != null && headData.PORTLOAD.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "装货港超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGEID" && headData.PORTDISCHARGEID != null && headData.PORTDISCHARGEID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "卸货港代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGE" && headData.PORTDISCHARGE != null && headData.PORTDISCHARGE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "卸货港超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERYID" && headData.PLACEDELIVERYID != null && headData.PLACEDELIVERYID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "交货地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERY" && headData.PLACEDELIVERY != null && headData.PLACEDELIVERY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "交货地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESTINATIONID" && headData.DESTINATIONID != null && headData.DESTINATIONID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "目的地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESTINATION" && headData.DESTINATION != null && headData.DESTINATION.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "目的地超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ISSUEPLACE" && headData.ISSUEPLACE != null && headData.ISSUEPLACE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "签单地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "BLFRT" && headData.BLFRT != null && headData.BLFRT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "付费方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PREPARDAT" && headData.PREPARDAT != null && headData.PREPARDAT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "预付地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PAYABLEAT" && headData.PAYABLEAT != null && headData.PAYABLEAT.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "到付地点超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "SERVICE" && headData.SERVICE != null && headData.SERVICE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "运输条款超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "MARKS" && headData.MARKS != null && headData.MARKS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "唛头超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "NOPKGS" && headData.NOPKGS != null && headData.NOPKGS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "件数包装超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DESCRIPTION" && headData.DESCRIPTION != null && headData.DESCRIPTION.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "货物描述超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "GOODSNAME" && headData.GOODSNAME != null && headData.GOODSNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "品名超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "KINDPKGS" && headData.KINDPKGS != null && headData.KINDPKGS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "包装超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "LANE" && headData.LANE != null && headData.LANE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "航线超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INVNO" && headData.INVNO != null && headData.INVNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "发票号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DCLASS" && headData.DCLASS != null && headData.DCLASS.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品类别超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DUNNO" && headData.DUNNO != null && headData.DUNNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品编号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "REEFERF" && headData.REEFERF != null && headData.REEFERF.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "冷藏通风量超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPID" && headData.TEMPID != null && headData.TEMPID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "温度单位超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPSET" && headData.TEMPSET != null && headData.TEMPSET.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "设置温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPMAX" && headData.TEMPMAX != null && headData.TEMPMAX.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "最高温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TEMPMIN" && headData.TEMPMIN != null && headData.TEMPMIN.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "最低温度超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CONTRACTNO" && headData.CONTRACTNO != null && headData.CONTRACTNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "运费协议号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSURANCEER" && headData.INSURANCEER != null && headData.INSURANCEER.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "保险人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSURANCENO" && headData.INSURANCENO != null && headData.INSURANCENO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "保险单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "REMARK" && headData.REMARK != null && headData.REMARK.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "备注超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "STLNAME" && headData.STLNAME != null && headData.STLNAME.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "结算方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "ENTERP" && headData.ENTERP != null && headData.ENTERP.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "经营单位超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "LINKMAN" && headData.LINKMAN != null && headData.LINKMAN.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "客户联系人超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSPECTSERVICE" && headData.INSPECTSERVICE != null && headData.INSPECTSERVICE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "报检项目超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "APPLYNO" && headData.APPLYNO != null && headData.APPLYNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "申请放箱号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "CUSTOMNO" && headData.CUSTOMNO != null && headData.CUSTOMNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "报关单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONNO" && headData.INSPECTIONNO != null && headData.INSPECTIONNO.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "商检单号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "PLACERECEIPTID" && headData.PLACERECEIPTID != null && headData.PLACERECEIPTID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "收货地代码超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TRADETERM" && headData.TRADETERM != null && headData.TRADETERM.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "贸易条款超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "VESSELID" && headData.VESSELID != null && headData.VESSELID.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "船舶呼号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DPAGE" && headData.DPAGE != null && headData.DPAGE.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品页号超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "TERMSDELIVERY" && headData.TERMSDELIVERY != null && headData.TERMSDELIVERY.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "贸易方式超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
if (enumValue.FIELDNAME == "DLABEL" && headData.DLABEL != null && headData.DLABEL.Length > Convert.ToInt32(enumValue.FIELDLEN)) { isPost = false; errorstr = "危险品标签超长,字段长度限制" + enumValue.FIELDLEN; }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
if (isPost) {
|
|
|
|
|
|
if (goodsbodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in goodsbodyList)
|
|
|
{
|
|
|
if (enumValue.PONO != "") {
|
|
|
if (MsOpSeaiDAL.GetPONOCount(enumValue.BsNo, enumValue.PONO)) {
|
|
|
isPost = false;
|
|
|
errorstr = errorstr+ " PONO重复";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
if (isPost)
|
|
|
{
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
var BSNO = headData.BSNO;
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
result = MsOpSeaiDAL.SaveGoodsDetail(headData, goodsbodyList, Convert.ToString(Session["USERID"]));
|
|
|
|
|
|
result = MsOpSeaiDAL.SaveDetail(headData, bodyList, Convert.ToString(Session["USERID"]));
|
|
|
//if (headData.APPLYNO != "" && headData.ETA != null)
|
|
|
//{
|
|
|
// var blUpSQL1 = " update op_ctnbscard set I_ETD='" + headData.ETA + "' where IS_RETURE_EMPTY=1 and APPLYNO='" + headData.APPLYNO + "' ";
|
|
|
// bool bl1 = T_ALL_DA.GetExecuteSqlCommand(blUpSQL1);
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message,
|
|
|
Data = MsOpSeaiDAL.GetData("BSNO='" + BSNO + "'")
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else {
|
|
|
if (iscreatecustno == true)
|
|
|
MsSysBillNoSetDAL.DeleteBsNo(headData.CUSTNO);
|
|
|
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message =errorstr+",不允许保存!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult DeleteDetail(string data)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var head = JsonConvert.Deserialize<MsOpSeaiDetail>(data);
|
|
|
DBResult result = MsOpSeaiDAL.DeleteDetail2(head);
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult Delete(string data)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var head = JsonConvert.Deserialize<MsOpSeai>(data);
|
|
|
var isfee = MsOpSeaiDAL.GetFeeCount(head.BSNO);
|
|
|
if (isfee)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message ="此票业务存在费用,请先删除费用才能删除此票业务!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
else {
|
|
|
DBResult result=null;
|
|
|
if (head.ORDERTYPE != "网上订舱")
|
|
|
{
|
|
|
if (head.BLTYPE == "拼箱主票")
|
|
|
{
|
|
|
T_ALL_DA T_ALL_DA = new T_ALL_DA();
|
|
|
var BLCOUNT = T_ALL_DA.GetStrSQL("BLCOUNT", "select count(*) BLCOUNT from OP_SEAI WHERE MASTERNO='" + head.BSNO + "' AND BSNO<>'" + head.BSNO + "'");
|
|
|
if (BLCOUNT == "0")
|
|
|
{
|
|
|
var BSNO = head.BSNO;
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Delete(head);
|
|
|
if (result.Success == true) { MsOpSeaiDAL.DeleteDetail(head); MsSysBillNoSetDAL.DeleteBsNo(head.CUSTNO); }
|
|
|
var jsonRespose3 = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose3) };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "此票拼箱主票存在分票业务,请先删除分票信息!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
var BSNO = head.BSNO;
|
|
|
var modb = new ModelObjectDB();
|
|
|
result = modb.Delete(head);
|
|
|
if (result.Success == true) { MsSysBillNoSetDAL.DeleteBsNo(head.CUSTNO); }
|
|
|
|
|
|
if (result.Success == true) { MsOpSeaiDAL.DeleteDetail(head); }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
result.Success = false;
|
|
|
result.Message = "网上订舱不能删除";
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public ContentResult GetCtnSum(string condition)
|
|
|
{
|
|
|
var rangstr = MsOpSeaiDAL.GetRangDAStr("index", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
condition = condition.Replace("'", "''");
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" declare @sql NVARCHAR(max) ");
|
|
|
strSql.Append(" set @sql='select S.NOBILL,S.PKGS,S.KGS,S.CBM,S.NETKGS,S.WMSCTNNUM ' ");
|
|
|
strSql.Append(" select @sql=@sql+',sum(case C.CTNALL when '''+t.CTN+''' then C.CTNNUM else 0 end) as C'+t.CTN ");
|
|
|
strSql.Append(" from (select CTN from code_ctn ) as t");
|
|
|
strSql.Append(" set @sql=@sql+',sum(C.TEU) TEU from op_ctn C left join op_seai B on (B.bsno=C.bsno) ");
|
|
|
strSql.Append(" left join (SELECT COUNT(BSNO) AS NOBILL,SUM(KGS) KGS,SUM(PKGS) PKGS,SUM(CBM) CBM,SUM(NETWEIGHT) NETKGS,SUM(ISNULL(W.WMSCTNNUM,0)) WMSCTNNUM");
|
|
|
strSql.Append(" from op_seai B LEFT JOIN (SELECT ASSOCIATEDNO,COUNT(DISTINCT CNTRNO) WMSCTNNUM FROM WMS_IN WHERE ISNULL(CNTRNO,'''')<>'''' GROUP BY ASSOCIATEDNO) W ON W.ASSOCIATEDNO=B.BSNO ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" ) S ON (1=1) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where B.BSNO IS NOT NULL AND " + condition);
|
|
|
}
|
|
|
else {
|
|
|
strSql.Append(" Where B.BSNO IS NOT NULL ");
|
|
|
|
|
|
}
|
|
|
|
|
|
strSql.Append(" GROUP BY S.NOBILL,S.KGS,S.PKGS,S.CBM,S.NETKGS,S.WMSCTNNUM ' ");
|
|
|
strSql.Append(" exec(@sql) ");
|
|
|
|
|
|
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, 1, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public ContentResult GetSaleCtnSum(string condition)
|
|
|
{
|
|
|
|
|
|
|
|
|
condition = condition.Replace("'", "''");
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" declare @sql NVARCHAR(max) ");
|
|
|
strSql.Append(" set @sql='select S.NOBILL,S.PKGS,S.KGS,S.CBM' ");
|
|
|
strSql.Append(" select @sql=@sql+',sum(case C.CTNALL when '''+t.CTN+''' then C.CTNNUM else 0 end) as C'+t.CTN ");
|
|
|
strSql.Append(" from (select CTN from code_ctn ) as t");
|
|
|
strSql.Append(" set @sql=@sql+',sum(C.TEU) TEU from op_ctn C left join op_seai B on (B.bsno=C.bsno) ");
|
|
|
strSql.Append(" left join (SELECT COUNT(BSNO) AS NOBILL,SUM(KGS) KGS,SUM(PKGS) PKGS,SUM(CBM) CBM from op_seai B ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" ) S ON (1=1) ");
|
|
|
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
strSql.Append(" GROUP BY S.NOBILL,S.KGS,S.PKGS,S.CBM ' ");
|
|
|
strSql.Append(" exec(@sql) ");
|
|
|
|
|
|
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, 1, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetCtnList(string condition)
|
|
|
{
|
|
|
var rangstr = MsOpSeaiDAL.GetRangDAStr("index", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append(" SELECT DISTINCT C.CTNALL from op_ctn C left join op_seai B on (B.bsno=C.bsno) ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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, 20, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
public ContentResult GetCtnDetailList(string condition)
|
|
|
{
|
|
|
var rangstr = MsOpSeaiDAL.GetRangDAStr("index", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
if (!string.IsNullOrEmpty(rangstr))
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
condition = condition + " and " + rangstr;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
condition = rangstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
strSql.Append("SELECT g.GID as GOODSNAMEID,b.GOODSNAME,b.UNITOFWEIGHT,c.CTN_ID,c.CTNCODE,c.SIZE,c.CTN,c.CTNNUM,c.CTNALL, ");
|
|
|
strSql.Append(" c.CNTRNO,c.SEALNO,c.PKGS,c.KGS,c.CBM from op_ctn c inner join op_seai b on (b.bsno=c.bsno) ");
|
|
|
strSql.Append(" left join code_goods g on (g.GOODNAME=b.GOODSNAME) ");
|
|
|
if (!string.IsNullOrEmpty(condition))
|
|
|
{
|
|
|
strSql.Append(" Where " + condition);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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, 50, dbRptResult, "Result_Set", true);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult CreateCtnFee(string bsno, string body)
|
|
|
{
|
|
|
var iResult = 0;
|
|
|
var headList = new List<MsChFee>();
|
|
|
var bodyList = JsonConvert.Deserialize<List<MsOpSeaiDetail>>(body);
|
|
|
if (bodyList != null)
|
|
|
{
|
|
|
foreach (var enumValue in bodyList)
|
|
|
{
|
|
|
if (enumValue.TRUCKFEE != "0" && enumValue.TRUCKFEE != "")
|
|
|
{
|
|
|
MsChFee data = new MsChFee();
|
|
|
data.BsNo = "*";
|
|
|
data.GId = Guid.NewGuid().ToString();
|
|
|
data.FeeType = 2;
|
|
|
data.FeeName = "陆运费";
|
|
|
data.CustomerType = "车队";
|
|
|
data.CustomerName = enumValue.TRUCKER;
|
|
|
data.Unit = enumValue.CTNALL;
|
|
|
data.UnitPrice = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.Quantity = 1;
|
|
|
data.Amount = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.Currency = "RMB";
|
|
|
data.ExChangerate = 1;
|
|
|
data.EnteroPerator = Convert.ToString(Session["USERID"]);
|
|
|
data.IsOpen = "0";
|
|
|
data.IsAdvancedpay = "0";
|
|
|
data.FeeStatus = 1;
|
|
|
data.TaxRate = 0;
|
|
|
data.NoTaxAmount = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.TaxUnitPrice = Convert.ToDecimal(enumValue.TRUCKFEE);
|
|
|
data.AccTaxRate = 0;
|
|
|
data.IsInvoice = "0";
|
|
|
data.LOCALCURR = "RMB";
|
|
|
headList.Add(data);
|
|
|
}
|
|
|
|
|
|
if (enumValue.CTNFEE != "0" && enumValue.CTNFEE != "")
|
|
|
{
|
|
|
MsChFee data = new MsChFee();
|
|
|
data.BsNo = "*";
|
|
|
data.GId = Guid.NewGuid().ToString();
|
|
|
data.FeeType = 2;
|
|
|
data.FeeName = "箱使费";
|
|
|
data.CustomerType = "车队";
|
|
|
data.CustomerName = enumValue.TRUCKER;
|
|
|
data.Unit = "天";
|
|
|
data.UnitPrice = Convert.ToDecimal(enumValue.CTNPRICE);
|
|
|
data.Quantity = Convert.ToInt16(enumValue.CTNDAY) - Convert.ToInt16(enumValue.FREECTNDAY);
|
|
|
data.Amount = Convert.ToDecimal(enumValue.CTNFEE);
|
|
|
data.Currency = "RMB";
|
|
|
data.ExChangerate = 1;
|
|
|
data.EnteroPerator = Convert.ToString(Session["USERID"]);
|
|
|
data.IsOpen = "0";
|
|
|
data.IsAdvancedpay = "0";
|
|
|
data.FeeStatus = 1;
|
|
|
data.TaxRate = 0;
|
|
|
data.NoTaxAmount = Convert.ToDecimal(enumValue.CTNFEE);
|
|
|
data.TaxUnitPrice = Convert.ToDecimal(enumValue.CTNPRICE);
|
|
|
data.AccTaxRate = 0;
|
|
|
data.IsInvoice = "0";
|
|
|
data.LOCALCURR = "RMB";
|
|
|
headList.Add(data);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
if (headList != null)
|
|
|
{
|
|
|
iResult = MsChFeeDAL.SaveUpdateFee(headList, bsno, CookieConfig.GetCookie_UserId(Request));
|
|
|
}
|
|
|
}
|
|
|
if (iResult == 0 || iResult == 1)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = true, Message = "已生成费用!", Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "生成费用时出错!", Data = "" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region EDI引入
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportEdi()
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["file"];
|
|
|
if (file == null)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/Edi");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filename = path + "\\" + usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var headList = MsOpSeaiDAL.ImportEdiList(filename, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
//var headList = new List<MsOpSeai>();
|
|
|
|
|
|
if (headList.Count != 0)
|
|
|
{
|
|
|
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "导入成功" + headList.Count.ToString()+"票", data = headList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
else {
|
|
|
var json = JsonConvert.Serialize(new { Success =false, Message = "未导入数据,请确认是否已经有此业务!" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取EDI文件出错,请确认文件正确性";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region EDI导出
|
|
|
public ContentResult CreateEDIList(string headData, string mblno, string type, string filetype, string filerole, int isbill, int isnoctn)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var headList = JsonConvert.Deserialize<List<MsOpSeai>>(headData);
|
|
|
|
|
|
|
|
|
var path = Server.MapPath("../../EDIFiles/SeaiEdi");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var error = MsOpSeaiDAL.IsCreateEdi(headList, type, filetype, filerole,"");
|
|
|
if (error == "")
|
|
|
{
|
|
|
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='" + type + "'", Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
var filename = MsOpSeaiDAL.CreateEdi(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, type, isbill, isnoctn, "", "");
|
|
|
|
|
|
|
|
|
if (ftpset.SERVERIP != "" && ftpset.SERVERIP != null)
|
|
|
result = MsOpSeaiDAL.FtpFile(filename, ftpset);
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "FTP参数没有设置,请先设置FTP参数!";
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveEDIList(string headData, string mblno, string type, string filetype, string filerole, int isbill, int isnoctn)
|
|
|
{
|
|
|
|
|
|
var headList = JsonConvert.Deserialize<List<MsOpSeai>>(headData);
|
|
|
|
|
|
|
|
|
var path = Server.MapPath("../../EDIFiles/SeaiEdi");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var error = MsOpSeaiDAL.IsCreateEdi(headList, type, filetype, filerole,"");
|
|
|
if (error == "")
|
|
|
{
|
|
|
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='" + type + "'", Convert.ToString(Session["COMPANYID"]));
|
|
|
var filename = MsOpSeaiDAL.CreateEdi(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, type, isbill, isnoctn, "", "");
|
|
|
|
|
|
filename = Path.GetFileName(filename);
|
|
|
|
|
|
result.Success = true;
|
|
|
result.Data = "../../EDIFiles/SeaiEdi/" + filename;
|
|
|
|
|
|
result.Message = filename;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message,Data=result.Data };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region DHL EDI
|
|
|
public ContentResult CreateDHLList(string bsnos, string mblno, string filerole)
|
|
|
{
|
|
|
bsnos = bsnos.Replace(",", "','");
|
|
|
var headList = MsOpSeaiDAL.GetDataList("BSNO IN ('" + bsnos + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var path = Server.MapPath("../../EDIFiles/SeaiEdi");
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var error = MsOpSeaiDAL.IsCreateEdiDHL(headList,filerole);
|
|
|
if (error == "")
|
|
|
{
|
|
|
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='DHL' ", Convert.ToString(Session["COMPANYID"]));
|
|
|
var filename = "";
|
|
|
if (ftpset.SERVERIP != "" && ftpset.SERVERIP != null)
|
|
|
{
|
|
|
foreach (var bill in headList)
|
|
|
{
|
|
|
filename = MsOpSeaiDAL.CreateEdiDHL(bill, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset);
|
|
|
result = MsOpSeaiDAL.SFtpFile(filename, ftpset);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "FTP参数没有设置,请先设置FTP参数!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveDHLList(string bsnos, string mblno, string filerole)
|
|
|
{
|
|
|
bsnos = bsnos.Replace(",", "','");
|
|
|
var headList = MsOpSeaiDAL.GetDataList("BSNO IN ('" + bsnos + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var path = Server.MapPath("../../EDIFiles/SeaiEdi");
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var error = MsOpSeaiDAL.IsCreateEdiDHL(headList, filerole);
|
|
|
if (error == "")
|
|
|
{
|
|
|
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='DHL' ", Convert.ToString(Session["COMPANYID"]));
|
|
|
var filename = "";
|
|
|
if (ftpset.SENDCODE == "")
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "EDI参数没有设置,请先设置EDI参数!";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
filename = MsOpSeaiDAL.CreateEdiDHL(headList[0], Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset);
|
|
|
filename = Path.GetFileName(filename);
|
|
|
result.Data = "../../EDIFiles/SeaiEdi/" + filename;
|
|
|
result.Success = true;
|
|
|
result.Message = filename;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message,Data = result.Data };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 舱单申报
|
|
|
|
|
|
public ContentResult CreateCustomList(string bsnos, string type)
|
|
|
{
|
|
|
bsnos = bsnos.Replace(",", "','");
|
|
|
var billList = MsOpSeaiDAL.GetDataList("BSNO IN ('" + bsnos + "')", CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var error = "";
|
|
|
if (error == "")
|
|
|
{
|
|
|
result = MsOpSeaiDAL.CreateCustomList(billList, type, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
|
|
|
}
|
|
|
|
|
|
var json = JsonConvert.Serialize(result);
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 交通部2.0 EDI导出
|
|
|
public ContentResult CreateIFTMBFList(string bsnos, string mblno, string filerole, string carrier)
|
|
|
{
|
|
|
bsnos = bsnos.Replace(",", "','");
|
|
|
var headList = MsOpSeaiDAL.GetDataList("BSNO IN ('" + bsnos + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var path = Server.MapPath("../../EDIFiles/SeaiEdi");
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var error = MsOpSeaiDAL.IsCreateEdi(headList, "IFTMBF", "", filerole, carrier);
|
|
|
if (error == "")
|
|
|
{
|
|
|
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='IFTMBF' AND CARRIERID='" + carrier + "'", Convert.ToString(Session["COMPANYID"]));
|
|
|
var filename = "";
|
|
|
filename = MsOpSeaiDAL.CreateEdi(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, "IFTMBF", 0, 0, carrier, "");
|
|
|
|
|
|
if (ftpset.SERVERIP != "" && ftpset.SERVERIP != null)
|
|
|
result = MsOpSeaiDAL.FtpFile(filename, ftpset);
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "FTP参数没有设置,请先设置FTP参数!";
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
public ContentResult SaveIFTMBFList(string bsnos, string mblno, string filerole, string carrier)
|
|
|
{
|
|
|
bsnos = bsnos.Replace(",", "','");
|
|
|
var headList = MsOpSeaiDAL.GetDataList("BSNO IN ('" + bsnos + "')", Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var path = Server.MapPath("../../EDIFiles/SeaiEdi");
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var error = MsOpSeaiDAL.IsCreateEdi(headList, "IFTMBF", "", filerole, carrier);
|
|
|
if (error == "")
|
|
|
{
|
|
|
var ftpset = MsCodeFtpSetDAL.GetData("EDINAME='IFTMBF' AND CARRIERID='" + carrier + "'", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (ftpset.SENDCODE == "" || ftpset.RECEIVECODE == "")
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "EDI参数没有设置,请先设置EDI参数!";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
var filename = "";
|
|
|
//filename = MsOpSeaiDAL.CreateEdi(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, "IFTMBF", isbill, 0, carrier, "", "", filetype);
|
|
|
filename = MsOpSeaiDAL.CreateEdi(headList, Convert.ToString(Session["USERCODE"]), path, mblno, filerole, ftpset, "IFTMBF", 0, 0, carrier, "");
|
|
|
filename = Path.GetFileName(filename);
|
|
|
result.Data = "../../EDIFiles/SeaiEdi/" + filename;
|
|
|
result.Success = true;
|
|
|
result.Message = filename;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = error;
|
|
|
}
|
|
|
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = result.Data };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 生成报关信息
|
|
|
public ContentResult SaveBG(string data, string data2, string data3)
|
|
|
{
|
|
|
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
}
|
|
|
//
|
|
|
var aaa = "";
|
|
|
|
|
|
var head = JsonConvert.Deserialize<MsOpSeai>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
|
|
|
var headData = new MsOpApply();
|
|
|
|
|
|
|
|
|
|
|
|
if (headData.CORPID == "" || headData.CORPID == null)
|
|
|
{
|
|
|
headData.CORPID = Convert.ToString(Session["COMPANYID"]);
|
|
|
}
|
|
|
headData.MASTERNO = head.BSNO;
|
|
|
headData.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
|
|
|
headData.BSDATE = DateTime.Now;
|
|
|
headData.DbOperationType = DbOperationType.DbotIns;
|
|
|
headData.CUSTOMERNAME = head.CUSTOMERNAME;
|
|
|
headData.MBLNO = head.MBLNO;
|
|
|
headData.VESSEL = head.VESSEL;
|
|
|
headData.VOYNO = head.VOYNO;
|
|
|
headData.BSSOURCE = head.BSSOURCE;
|
|
|
headData.BSSOURCEDETAIL = head.BSSOURCEDETAIL;
|
|
|
headData.ETD = head.ETD;
|
|
|
headData.ETA = head.ETA;
|
|
|
headData.PKGS = head.PKGS;
|
|
|
headData.KGS = head.KGS;
|
|
|
headData.CBM = head.CBM;
|
|
|
headData.PORTLOAD = head.PORTLOAD;
|
|
|
headData.PORTDISCHARGE = head.PORTDISCHARGE;
|
|
|
headData.SALE = head.SALE;
|
|
|
headData.SALEDEPT = head.SALEDEPT;
|
|
|
headData.BSTYPE = "2";
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(headData);
|
|
|
|
|
|
if (result.Success == true)
|
|
|
{
|
|
|
result.Success = true;
|
|
|
result.Message = "生成成功";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Success = false;
|
|
|
result.Message = "生成过程发生错误";
|
|
|
|
|
|
}
|
|
|
|
|
|
var jsonRespose = new JsonResponse
|
|
|
{
|
|
|
Success = result.Success,
|
|
|
Message = result.Message
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 集团委托引入
|
|
|
public ContentResult GetImpDataList(int start, int limit, string sort, string condition)
|
|
|
{
|
|
|
//var dataList = MsOpSeaiDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
//var list = dataList.Skip(start).Take(limit);
|
|
|
var dataList = MsOpSeaiDAL.GetImpDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
|
|
|
int count = MsOpSeaiDAL.getImpTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 导入excel
|
|
|
|
|
|
private bool IsNumber(string wmsdate)
|
|
|
{
|
|
|
{
|
|
|
if (String.IsNullOrEmpty(wmsdate))
|
|
|
|
|
|
return false; //是,就返回False
|
|
|
ASCIIEncoding ascii = new ASCIIEncoding();//new ASCIIEncoding 的实例
|
|
|
byte[] bytestr = ascii.GetBytes(wmsdate); //把string类型的参数保存到数组里
|
|
|
|
|
|
foreach (byte c in bytestr) //遍历这个数组里的内容
|
|
|
{
|
|
|
if (c == 46) continue;
|
|
|
if (c < 48 || c > 57) //判断是否为数字
|
|
|
{
|
|
|
return false; //不是,就返回False
|
|
|
}
|
|
|
}
|
|
|
return true; //是,就返回True
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
///海运进口 导入excel
|
|
|
[HttpPost]
|
|
|
public ContentResult ImportExcel(string CtnrData, string data, string data2, string data3)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
if (Request.Files.Count != 1)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请选择上传的文件";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var file = Request.Files["LoadExcel"];
|
|
|
if (file == null || file.ContentLength == 0 || string.IsNullOrEmpty(file.FileName))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传文件发生未知错误,请重新上传";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
|
|
Stream stream = file.InputStream;
|
|
|
|
|
|
StreamReader reader = new StreamReader(stream, Encoding.UTF8);
|
|
|
|
|
|
string str = "";
|
|
|
|
|
|
while (str != null)
|
|
|
{
|
|
|
str = reader.ReadLine();
|
|
|
string[] xu = new String[3];
|
|
|
xu = str.Split(',');
|
|
|
string ctrnno = xu[0];
|
|
|
string pack = xu[1];
|
|
|
string pkgs = xu[2];
|
|
|
|
|
|
|
|
|
reader.Close();
|
|
|
|
|
|
*/
|
|
|
|
|
|
var path = Server.MapPath("../../UploadFiles/CtrnExcel");
|
|
|
var path2 = Server.MapPath("../../UploadFiles/CtrnExcel/");
|
|
|
|
|
|
if (!Directory.Exists(path))
|
|
|
{
|
|
|
Directory.CreateDirectory(path);
|
|
|
}
|
|
|
|
|
|
var size = file.ContentLength;
|
|
|
var name = Path.GetFileName(file.FileName);
|
|
|
var bsno = Request.Form["BSNO"];
|
|
|
|
|
|
var usercode = CookieConfig.GetCookie_UserCode(Request);
|
|
|
string filenamepath = usercode + DateTime.Now.ToString("yyyyMMddHHmmssfff") + name;
|
|
|
|
|
|
string filename = path + "\\" + filenamepath;
|
|
|
|
|
|
|
|
|
|
|
|
string excelFilePath = path2 + filenamepath;
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
file.SaveAs(filename);
|
|
|
|
|
|
if (!System.IO.File.Exists(filename))
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "上传的Excel不包含数据01";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
|
|
|
|
|
|
if (excel == null)
|
|
|
{
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "无法创建Excel对象,可能您的服务器计算机未安装Excel!!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Workbook workbook = excel.Workbooks.Open(excelFilePath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
|
|
|
|
|
|
Worksheet mySheet = workbook.Sheets[1] as Worksheet;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var isuse = false;
|
|
|
|
|
|
|
|
|
var CtrnList = JsonConvert.Deserialize<List<MsOpSeaiDetail>>(CtnrData);
|
|
|
var HeadData = JsonConvert.Deserialize<MsOpSeai>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int rowsint = mySheet.UsedRange.Cells.Rows.Count;
|
|
|
|
|
|
if (rowsint < 3)
|
|
|
{
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请检查excel文件数据是否正确";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
var CtrnExcelList = new List<MsOpCtrnExcel>();
|
|
|
|
|
|
for (int i = 3; i < rowsint + 1; i++)
|
|
|
{
|
|
|
MsOpCtrnExcel CtrnExcel = new MsOpCtrnExcel();
|
|
|
object objDate = mySheet.Cells.get_Range("B" + i).Value2;
|
|
|
|
|
|
object objCtrno = mySheet.Cells.get_Range("D" + i).Value2;
|
|
|
object objPack = mySheet.Cells.get_Range("E" + i).Value2;
|
|
|
object objKgs = mySheet.Cells.get_Range("F" + i).Value2;
|
|
|
object objblno = mySheet.Cells.get_Range("C" + i).Value2;
|
|
|
object objarea = mySheet.Cells.get_Range("G" + i).Value2;
|
|
|
|
|
|
object obj_INVOICENO = mySheet.Cells.get_Range("H" + i).Value2;
|
|
|
object obj_GOODSMODEL = mySheet.Cells.get_Range("I" + i).Value2;
|
|
|
object obj_BZTCHNO = mySheet.Cells.get_Range("J" + i).Value2;
|
|
|
object obj_PRODUCTIONDATE = mySheet.Cells.get_Range("K" + i).Value2;
|
|
|
object obj_KINDPKGS = mySheet.Cells.get_Range("L" + i).Value2;
|
|
|
|
|
|
if (objCtrno != null && objPack != null && objPack != null && objDate != null && objblno != null && objCtrno.ToString() != "" && objPack.ToString() != "" && objKgs.ToString() != "" && objDate.ToString() != "" && objblno.ToString() != "" )
|
|
|
{
|
|
|
CtrnExcel.CtrnNo = objCtrno.ToString();
|
|
|
CtrnExcel.Pkgs = objPack.ToString();
|
|
|
CtrnExcel.Kgs = objKgs.ToString();
|
|
|
|
|
|
string tmpDate = objDate.ToString();
|
|
|
if (IsNumber(tmpDate) )
|
|
|
CtrnExcel.WMSDate = DateTime.FromOADate(Convert.ToDouble(objDate)).ToString("d");
|
|
|
else
|
|
|
CtrnExcel.WMSDate = objDate.ToString();
|
|
|
|
|
|
if (objarea != null)
|
|
|
CtrnExcel.AreaName = objarea.ToString();
|
|
|
else
|
|
|
CtrnExcel.AreaName = "";
|
|
|
|
|
|
CtrnExcel.INVOICENO = (obj_INVOICENO == null ? "" : obj_INVOICENO.ToString());
|
|
|
CtrnExcel.GOODSMODEL = (obj_GOODSMODEL == null ? "" : obj_GOODSMODEL.ToString());
|
|
|
CtrnExcel.BZTCHNO = (obj_BZTCHNO == null ? "" : obj_BZTCHNO.ToString());
|
|
|
CtrnExcel.KINDPKGS = (obj_KINDPKGS == null ? "" : obj_KINDPKGS.ToString());
|
|
|
|
|
|
if (IsNumber(tmpDate))
|
|
|
CtrnExcel.PRODUCTIONDATE = DateTime.FromOADate(Convert.ToDouble(obj_PRODUCTIONDATE)).ToString("d");
|
|
|
else
|
|
|
CtrnExcel.PRODUCTIONDATE = obj_PRODUCTIONDATE.ToString();
|
|
|
|
|
|
CtrnExcelList.Add(CtrnExcel);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if ( objblno.ToString() != HeadData.MBLNO)
|
|
|
{
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请检查提单号是否正确";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
|
|
|
|
|
|
foreach (MsOpSeaiDetail item in CtrnList)
|
|
|
{
|
|
|
if (item.CNTRNO == CtrnExcel.CtrnNo)
|
|
|
{
|
|
|
item.PKGS = Convert.ToInt32(CtrnExcel.Pkgs);
|
|
|
item.KGS = Convert.ToDecimal(CtrnExcel.Kgs)*1000;
|
|
|
item.WMSDATE = CtrnExcel.WMSDate;
|
|
|
item.ISWMS = "0";
|
|
|
item.AREANAME = CtrnExcel.AreaName;
|
|
|
isuse = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
|
|
|
bool isSucess = true;
|
|
|
|
|
|
|
|
|
if (System.IO.File.Exists(filename))
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
}
|
|
|
|
|
|
if (!isuse)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "请检查excel数据,数据不匹配,更新失败";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
|
|
|
DBResult resultCtrn = MsOpSeaiDAL.UpdateCtrnDetail(CtrnList);
|
|
|
|
|
|
if (HeadData.STORAGENAME == "" || HeadData.GOODSNAME == "")
|
|
|
{
|
|
|
System.IO.File.Delete(filename);
|
|
|
JsonConvert.Serialize(new { success = true, Message = "提单箱数据更新成功,入库失败,请检查品名和仓库", data = CtrnList, });
|
|
|
}
|
|
|
|
|
|
if (resultCtrn.Success)
|
|
|
{
|
|
|
|
|
|
//按照入库时间、储位分别生成入库单
|
|
|
if (HeadData.BSNO == "")
|
|
|
HeadData.BSNO = HeadData.MASTERNO;
|
|
|
int ctrnNum = MsOpSeaiDAL.CtrnToWMS_DATENUM(HeadData.BSNO);
|
|
|
if (ctrnNum == 0)
|
|
|
{
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "提单箱数据更新成功,入库失败,请联系管理员!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
for (int i = 1; i <= ctrnNum; i++)
|
|
|
{
|
|
|
List<MsOpSeaiDetail> dateList = CtrnToWMSDateList(CtrnList);
|
|
|
if (dateList.Count != 0)
|
|
|
{
|
|
|
for (int j = 1; j <= dateList.Count(); j++)
|
|
|
{
|
|
|
List<MsOpSeaiDetail> areaList = CtrnToAreaList(dateList);
|
|
|
if (areaList.Count != 0)
|
|
|
{
|
|
|
resultCtrn = CtrnToWMS(areaList, HeadData, CtrnExcelList);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//20191206 更新主业务的毛重和件数
|
|
|
Decimal KGS = 0;
|
|
|
Decimal PKGS = 0;
|
|
|
foreach (var _ctn in CtrnExcelList)
|
|
|
{
|
|
|
KGS += Convert.ToDecimal(_ctn.Kgs)*1000;
|
|
|
PKGS += Convert.ToDecimal(_ctn.Pkgs);
|
|
|
}
|
|
|
HeadData.KGS = KGS;
|
|
|
HeadData.PKGS = PKGS;
|
|
|
HeadData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
DBResult result = modb.Save(HeadData);
|
|
|
|
|
|
if (!resultCtrn.Success)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "入库失败!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(new { success = true, Message = "入库成功", data = CtrnList, });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
workbook.Close(true, Type.Missing, Type.Missing);
|
|
|
workbook = null;
|
|
|
excel.Quit();
|
|
|
excel = null;
|
|
|
System.IO.File.Delete(filename);
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "读取Excel文件出错,请确认文件正确性" + execError.Message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 从一组海运进口的集装箱信息中,
|
|
|
/// 找到并返回一组与【第一条“ISWMS==0”】的WMSDATE相一致的一组ctn
|
|
|
/// 他们的ISWMS被标记为“D”;
|
|
|
/// </summary>
|
|
|
/// <param name="ctrnList"></param>
|
|
|
/// <returns></returns>
|
|
|
public List<MsOpSeaiDetail> CtrnToWMSDateList(List<MsOpSeaiDetail> ctrnList)
|
|
|
{
|
|
|
List<MsOpSeaiDetail> dateList = new List<MsOpSeaiDetail>();
|
|
|
string wmsdate = "";
|
|
|
foreach (var enumValue in ctrnList)
|
|
|
{
|
|
|
|
|
|
if (enumValue.ISWMS == "0" && dateList.Count == 0)
|
|
|
{
|
|
|
wmsdate = enumValue.WMSDATE;
|
|
|
enumValue.ISWMS = "D";
|
|
|
dateList.Add(enumValue);
|
|
|
}
|
|
|
else if (enumValue.ISWMS == "0" && enumValue.ISWMS !="" && enumValue.WMSDATE == wmsdate)
|
|
|
{
|
|
|
enumValue.ISWMS = "D";
|
|
|
dateList.Add(enumValue);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return dateList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public List<MsOpSeaiDetail> CtrnToAreaList(List<MsOpSeaiDetail> ctrnList)
|
|
|
{
|
|
|
List<MsOpSeaiDetail> areaList = new List<MsOpSeaiDetail>();
|
|
|
string areaname = "";
|
|
|
foreach (var enumValue in ctrnList)
|
|
|
{
|
|
|
|
|
|
if (enumValue.ISWMS == "D" && areaList.Count == 0)
|
|
|
{
|
|
|
areaname = enumValue.AREANAME;
|
|
|
enumValue.ISWMS = "1";
|
|
|
areaList.Add(enumValue);
|
|
|
}
|
|
|
else if (enumValue.ISWMS == "D" && enumValue.AREANAME == areaname)
|
|
|
{
|
|
|
enumValue.ISWMS = "1";
|
|
|
areaList.Add(enumValue);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return areaList;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 通过海运进口的集装箱信息 生成相应的入库信息
|
|
|
/// </summary>
|
|
|
/// <param name="ctrnList"></param>
|
|
|
/// <param name="headData"></param>
|
|
|
/// <returns></returns>
|
|
|
public DBResult CtrnToWMS(List<MsOpSeaiDetail> ctrnList, MsOpSeai headData, List<MsOpCtrnExcel> CtrnExcelList = null)
|
|
|
{
|
|
|
DBResult result = null;
|
|
|
|
|
|
if (ctrnList.Count == 0)
|
|
|
return result;
|
|
|
|
|
|
|
|
|
WMSNew wms = new WMSNew();
|
|
|
wms.GID = "Wms" + Guid.NewGuid().ToString().Replace("-", "");
|
|
|
wms.WMSDATE = ctrnList[0].WMSDATE;
|
|
|
wms.ACCDATE = wms.WMSDATE.Substring(0, 7);
|
|
|
var billnoset = MsSysBillNoSetDAL.GetData("OPLBNAME='仓储入库'", Convert.ToString(Session["COMPANYID"]));
|
|
|
wms.WMSNO = MsSysBillNoSetDAL.GetBillNo(billnoset, ctrnList[0].WMSDATE.ToString().Trim(), wms.ACCDATE.ToString().Trim());
|
|
|
|
|
|
wms.DbOperationType = DbOperationType.DbotIns;
|
|
|
wms.ModelUIStatus = "I";
|
|
|
wms.CORPID = Convert.ToString(Session["COMPANYID"]).Trim();//CORPID
|
|
|
wms.WMSOP = CookieConfig.GetCookie_UserName(Request);
|
|
|
wms.CREATEUSER = CookieConfig.GetCookie_UserId(Request);
|
|
|
wms.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
wms.MODIFIEDTIME = wms.CREATETIME;
|
|
|
wms.MODIFIEDUSER = wms.CREATEUSER;
|
|
|
wms.ASSOCIATEDNO = ctrnList[0].BSNO;
|
|
|
wms.ISCHANGE = "False";
|
|
|
wms.FREESTORAGEPERIODAP = "0";
|
|
|
wms.BLNO = headData.MBLNO;
|
|
|
wms.ASSOCIATEDNO = headData.BSNO;
|
|
|
wms.CONTRACTNO = headData.CONTRACTNO;
|
|
|
wms.STORAGENAME = headData.STORAGENAME;
|
|
|
wms.CUSTOMERNAME = headData.CUSTOMERNAME;
|
|
|
wms.ARCLIENT = headData.CUSTOMERNAME;
|
|
|
wms.GOODSNAME = headData.GOODSNAME;
|
|
|
wms.GOODSNAMEID = headData.GOODSNAMEID;
|
|
|
wms.AREANAME = ctrnList[0].AREANAME;
|
|
|
|
|
|
|
|
|
wms.FREESTORAGEPERIOD = "0";
|
|
|
wms.STARTBILLINGDATE = wms.WMSDATE;
|
|
|
wms.STARTBILLINGDATEAP = wms.WMSDATE;
|
|
|
wms.CHARGEUNIT = headData.UNITOFWEIGHT;
|
|
|
wms.ISLOCK = "0";
|
|
|
wms.RENTAREA = "0";
|
|
|
wms.MARKETVALUE = "0";
|
|
|
wms.BANKVALUE = "0";
|
|
|
|
|
|
int linenum = 1;
|
|
|
int pkgs = 0;
|
|
|
decimal kgs = 0;
|
|
|
|
|
|
List<WMSNewIN> wmsInList = new List<WMSNewIN>();
|
|
|
List<WMSIN_ZMYL> wmsIn_ZMYLList = new List<WMSIN_ZMYL>();
|
|
|
|
|
|
if (CtrnExcelList == null)
|
|
|
{
|
|
|
|
|
|
foreach (MsOpSeaiDetail item in ctrnList)
|
|
|
{
|
|
|
WMSNewIN wmsin = new WMSNewIN();
|
|
|
wmsin.GID = item.CTN_ID;
|
|
|
//wmsin.GID = Guid.NewGuid().ToString();
|
|
|
// wmsin.ASSOCIATEDNO = wms.GID;
|
|
|
wmsin.BSNO = wms.ASSOCIATEDNO;
|
|
|
wmsin.CONTRACTNO = wms.CONTRACTNO;
|
|
|
wmsin.BLNO = wms.BLNO;
|
|
|
wmsin.STORAGENAME = wms.STORAGENAME;
|
|
|
|
|
|
wmsin.GOODSNAME = wms.GOODSNAME;
|
|
|
wmsin.GOODSNAMEID = wms.GOODSNAMEID;
|
|
|
|
|
|
pkgs += item.PKGS;
|
|
|
wmsin.JIANSHU1 = Convert.ToString(item.PKGS);
|
|
|
wmsin.GOODSPACK = Convert.ToString(item.PKGS);
|
|
|
wmsin.GOODSPACKSTOCK = Convert.ToString(item.PKGS);
|
|
|
wmsin.GOODSPACKACTUAL = Convert.ToString(item.PKGS);
|
|
|
|
|
|
kgs += item.KGS / 1000;
|
|
|
wmsin.GOODSKGS = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.GOODSSTOCK = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.GOODSRKSL = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.GOODSRKSLACTUAL = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.SHIJIZHONGLIANG = Convert.ToString(item.KGS / 1000);
|
|
|
|
|
|
|
|
|
wmsin.CHARGEUNIT = wms.CHARGEUNIT;
|
|
|
|
|
|
wmsin.CNTRNO = item.CNTRNO;
|
|
|
wmsin.SEALNO = item.SEALNO;
|
|
|
wmsin.CTNALL = item.CTNALL;
|
|
|
|
|
|
wmsin.STORAGENAME = wms.STORAGENAME;
|
|
|
wmsin.CLIENTNAME = wms.CUSTOMERNAME;
|
|
|
wmsin.DODATE = wms.WMSDATE;
|
|
|
wmsin.CORPID = Convert.ToString(Session["COMPANYID"]).Trim();
|
|
|
wmsin.CREATEUSER = CookieConfig.GetCookie_UserId(Request);
|
|
|
wmsin.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
wmsin.MODIFIEDTIME = wms.CREATETIME;
|
|
|
wmsin.MODIFIEDUSER = wms.CREATEUSER;
|
|
|
wmsin.ISLOCK = "0";
|
|
|
|
|
|
wmsin.LOADERFEE = "0";
|
|
|
wmsin.ZhuangXieFei = "0";
|
|
|
wmsin.CHIMA2 = "0";
|
|
|
|
|
|
wmsin.ZHONGLIANG2 = "0";
|
|
|
wmsin.SHIJICHIMA = "0";
|
|
|
|
|
|
wmsin.LUYUNFEI = "0";
|
|
|
wmsin.DIAOTOUFEI = "0";
|
|
|
wmsin.XIUXIXIANGFEI = "0";
|
|
|
wmsin.DIAOZHUANGFEI = "0";
|
|
|
|
|
|
wmsin.JIANSHU2 = "0";
|
|
|
wmsin.LinShiZhuangXieFeiDanJiaDun = "0";
|
|
|
wmsin.LinShiZhuangXieFeiDanJiaJian = "0";
|
|
|
wmsin.FREESTORAGEPERIOD = "0";
|
|
|
|
|
|
wmsin.ISDELETE = "0";
|
|
|
wmsin.APFEE = "0";
|
|
|
wmsin.ARFEE = "0";
|
|
|
|
|
|
wmsin.MARKETVALUE = "0";
|
|
|
wmsin.BANKVALUE = "0";
|
|
|
wmsin.LINENUM = Convert.ToString(linenum);
|
|
|
linenum++;
|
|
|
|
|
|
wmsin.GOODSTHICKNESS = "0";
|
|
|
wmsin.GOODSWIDTH = "0";
|
|
|
wmsin.GOODSLENGTH = "0";
|
|
|
|
|
|
wmsin.GOODSSLICE = "0";
|
|
|
wmsin.GOODSGRADE = "0";
|
|
|
wmsin.ISCHANGE = "0";
|
|
|
|
|
|
wmsInList.Add(wmsin);
|
|
|
}
|
|
|
}
|
|
|
if (CtrnExcelList != null)
|
|
|
{
|
|
|
|
|
|
foreach (MsOpSeaiDetail item in ctrnList)
|
|
|
{
|
|
|
WMSIN_ZMYL wmsin = new WMSIN_ZMYL();
|
|
|
wmsin.GID = item.CTN_ID;
|
|
|
//wmsin.GID = Guid.NewGuid().ToString();
|
|
|
// wmsin.ASSOCIATEDNO = wms.GID;
|
|
|
wmsin.BSNO = wms.ASSOCIATEDNO;
|
|
|
wmsin.CONTRACTNO = wms.CONTRACTNO;
|
|
|
wmsin.BLNO = wms.BLNO;
|
|
|
wmsin.STORAGENAME = wms.STORAGENAME;
|
|
|
|
|
|
wmsin.GOODSNAME = wms.GOODSNAME;
|
|
|
wmsin.GOODSNAMEID = wms.GOODSNAMEID;
|
|
|
|
|
|
pkgs += item.PKGS;
|
|
|
wmsin.JIANSHU1 = Convert.ToString(item.PKGS);
|
|
|
wmsin.GOODSPACK = Convert.ToString(item.PKGS);
|
|
|
wmsin.GOODSPACKSTOCK = Convert.ToString(item.PKGS);
|
|
|
wmsin.GOODSPACKACTUAL = Convert.ToString(item.PKGS);
|
|
|
|
|
|
kgs += item.KGS / 1000;
|
|
|
wmsin.GOODSKGS = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.GOODSSTOCK = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.GOODSRKSL = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.GOODSRKSLACTUAL = Convert.ToString(item.KGS / 1000);
|
|
|
wmsin.SHIJIZHONGLIANG = Convert.ToString(item.KGS / 1000);
|
|
|
|
|
|
|
|
|
wmsin.CHARGEUNIT = wms.CHARGEUNIT;
|
|
|
|
|
|
wmsin.CNTRNO = item.CNTRNO;
|
|
|
wmsin.SEALNO = item.SEALNO;
|
|
|
wmsin.CTNALL = item.CTNALL;
|
|
|
|
|
|
wmsin.STORAGENAME = wms.STORAGENAME;
|
|
|
wmsin.CLIENTNAME = wms.CUSTOMERNAME;
|
|
|
wmsin.DODATE = wms.WMSDATE;
|
|
|
wmsin.CORPID = Convert.ToString(Session["COMPANYID"]).Trim();
|
|
|
wmsin.CREATEUSER = CookieConfig.GetCookie_UserId(Request);
|
|
|
wmsin.CREATETIME = DateTime.Now.ToString("yyyy-MM-dd");
|
|
|
wmsin.MODIFIEDTIME = wms.CREATETIME;
|
|
|
wmsin.MODIFIEDUSER = wms.CREATEUSER;
|
|
|
wmsin.ISLOCK = "0";
|
|
|
|
|
|
wmsin.LOADERFEE = "0";
|
|
|
wmsin.ZhuangXieFei = "0";
|
|
|
wmsin.CHIMA2 = "0";
|
|
|
|
|
|
wmsin.ZHONGLIANG2 = "0";
|
|
|
wmsin.SHIJICHIMA = "0";
|
|
|
|
|
|
wmsin.LUYUNFEI = "0";
|
|
|
wmsin.DIAOTOUFEI = "0";
|
|
|
wmsin.XIUXIXIANGFEI = "0";
|
|
|
wmsin.DIAOZHUANGFEI = "0";
|
|
|
|
|
|
wmsin.JIANSHU2 = "0";
|
|
|
wmsin.LinShiZhuangXieFeiDanJiaDun = "0";
|
|
|
wmsin.LinShiZhuangXieFeiDanJiaJian = "0";
|
|
|
wmsin.FREESTORAGEPERIOD = "0";
|
|
|
|
|
|
wmsin.ISDELETE = "0";
|
|
|
wmsin.APFEE = "0";
|
|
|
wmsin.ARFEE = "0";
|
|
|
|
|
|
wmsin.MARKETVALUE = "0";
|
|
|
wmsin.BANKVALUE = "0";
|
|
|
wmsin.LINENUM = Convert.ToString(linenum);
|
|
|
linenum++;
|
|
|
|
|
|
wmsin.GOODSTHICKNESS = "0";
|
|
|
wmsin.GOODSWIDTH = "0";
|
|
|
wmsin.GOODSLENGTH = "0";
|
|
|
|
|
|
wmsin.GOODSSLICE = "0";
|
|
|
wmsin.GOODSGRADE = "0";
|
|
|
wmsin.ISCHANGE = "0";
|
|
|
|
|
|
////
|
|
|
var CtrnExcel = CtrnExcelList.Find(t => t.CtrnNo == wmsin.CNTRNO);
|
|
|
if (CtrnExcel != null)
|
|
|
{
|
|
|
wmsin.GOODSMODEL = CtrnExcel.GOODSMODEL;
|
|
|
wmsin.KINDPKGS = CtrnExcel.KINDPKGS;
|
|
|
wmsin.BZTCHNO = CtrnExcel.BZTCHNO;
|
|
|
wmsin.PRODUCTIONDATE = CtrnExcel.PRODUCTIONDATE;
|
|
|
wmsin.INVOICENO = CtrnExcel.INVOICENO;
|
|
|
}
|
|
|
|
|
|
wmsin.FACTORYNO = "";
|
|
|
wmsIn_ZMYLList.Add(wmsin);
|
|
|
}
|
|
|
}
|
|
|
wms.TiDanZhongLiang = Convert.ToString(headData.KGS / 1000);
|
|
|
wms.TiDanJianShu = Convert.ToString(headData.PKGS);
|
|
|
wms.GOODSRKSL = Convert.ToString(kgs);
|
|
|
wms.GOODSRKSLACTUAL = Convert.ToString(kgs);
|
|
|
wms.GOODSKGS = Convert.ToString(kgs);
|
|
|
wms.GOODSSTOCK = Convert.ToString(kgs);
|
|
|
|
|
|
wms.GOODSPACK = Convert.ToString(pkgs);
|
|
|
wms.GOODSPACKSTOCK = Convert.ToString(pkgs);
|
|
|
wms.GOODSPACKACTUAL = Convert.ToString(pkgs);
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
|
|
|
if (CtrnExcelList == null)
|
|
|
{
|
|
|
result = modb.Save(wms,
|
|
|
ModelObjectConvert<WMSNewIN>.ToModelObjectList(wmsInList),
|
|
|
null
|
|
|
);
|
|
|
}
|
|
|
else {
|
|
|
result = modb.Save(wms,
|
|
|
ModelObjectConvert<WMSIN_ZMYL>.ToModelObjectList(wmsIn_ZMYLList),
|
|
|
null
|
|
|
);
|
|
|
}
|
|
|
if(result.Success)
|
|
|
result = MsOpSeaiDAL.UpdateCtrnWMSState(ctrnList);
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 提单箱数据入库
|
|
|
public ContentResult SaveCtrnToWMS(string CtnrData, string data, string data2, string data3)
|
|
|
{
|
|
|
var jsonRespose = new JsonResponse { Success = false, Message = "" };
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
var CtrnList = JsonConvert.Deserialize<List<MsOpSeaiDetail>>(CtnrData);
|
|
|
var HeadData = JsonConvert.Deserialize<MsOpSeai>(data.Replace("}", ",") + data2.Replace("{", "").Replace("}", ",") + data3.Replace("{", ""));
|
|
|
|
|
|
|
|
|
DBResult resultCtrn = MsOpSeaiDAL.UpdateCtrnDetail(CtrnList);
|
|
|
if (resultCtrn.Success)
|
|
|
{
|
|
|
//按照入库时间、储位分别生成入库单
|
|
|
int ctrnNum = MsOpSeaiDAL.CtrnToWMS_DATENUM(HeadData.BSNO);
|
|
|
if (ctrnNum > 0)
|
|
|
{
|
|
|
for (int i = 1; i <= ctrnNum; i++)
|
|
|
{
|
|
|
List<MsOpSeaiDetail> dateList = CtrnToWMSDateList(CtrnList);
|
|
|
if (dateList.Count != 0)
|
|
|
{
|
|
|
for (int j = 1; j <= dateList.Count(); j++)
|
|
|
{
|
|
|
List<MsOpSeaiDetail> areaList = CtrnToAreaList(dateList);
|
|
|
resultCtrn = CtrnToWMS(areaList, HeadData);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if (!resultCtrn.Success)
|
|
|
{
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "入库失败!";
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "入库成功", Data = CtrnList, });
|
|
|
return new ContentResult() { Content = json };
|
|
|
|
|
|
}
|
|
|
catch (Exception execError)
|
|
|
{
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
jsonRespose.Message = "对不起,提单箱数据入库出现异常" + execError.Message;
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
//
|
|
|
}
|
|
|
}
|
|
|
|