|
|
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 com.sun.org.apache.bcel.@internal.generic;
|
|
|
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.MsOpApplyDAL;
|
|
|
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 Terminal_CDMA;
|
|
|
using Microsoft.Office.Interop.Excel;
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
|
using DSWeb.MvcShipping.Models.WMSNew;
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
using sun.font;
|
|
|
using Type = System.Type;
|
|
|
using DSWeb.MvcShipping.DAL.MsCodeOpTemplate;
|
|
|
using DSWeb.MvcShipping.DAL.ChMonthCloseDAL;
|
|
|
using ikvm.extensions;
|
|
|
using java.util.regex;
|
|
|
using DSWeb.Common.DB;
|
|
|
using DSWeb.Common.Helper;
|
|
|
using DSWeb.Areas.SysMng.DAL.SysUser;
|
|
|
|
|
|
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"]);
|
|
|
}
|
|
|
}
|
|
|
if (handle == "copyadd") {
|
|
|
var copyfieldlist = MsCodeOpTemplateDAL.GetCodeOpTemplateDetail(" LINKGID in (select top 1 GID from CODE_OP_TEMPLATE where BSTYPE='海运进口' and op='" + CookieConfig.GetCookie_UserId(Request) + "' or ISPUBLIC='是' order by ISPUBLIC)");
|
|
|
if (copyfieldlist.Count != 0)
|
|
|
{
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = true, Message = "查询成功", data = head });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
public ContentResult GetCountryForWMSIn(string condition)
|
|
|
{
|
|
|
CountryModel head = null;
|
|
|
head = MsOpSeaiDAL.GetCountryModelData(condition);
|
|
|
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 GetCopyData(string condition, string copyfee = "false", string copybill="false")
|
|
|
{
|
|
|
MsOpSeai head = null;
|
|
|
|
|
|
var oldhead = MsOpSeaiDAL.GetData(condition);
|
|
|
|
|
|
var copyfieldlist = MsCodeOpTemplateDAL.GetCodeOpTemplateDetail(" LINKGID in (select top 1 GID from CODE_OP_TEMPLATE where BSTYPE='海运进口' and (op='" + CookieConfig.GetCookie_UserId(Request) + "' or ISPUBLIC='是') order by ISPUBLIC)");
|
|
|
if (copyfieldlist.Count == 0)
|
|
|
{
|
|
|
head = oldhead;
|
|
|
head.BSNO = "topseai" + Guid.NewGuid().ToString();
|
|
|
head.MASTERNO = "";
|
|
|
head.CUSTNO = "";
|
|
|
head.ORDERNO = "";
|
|
|
head.ORDERTYPE = "操作录入";
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
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"]);
|
|
|
}
|
|
|
head.BSSTATUS = false;
|
|
|
head.FEESTATUS = false;
|
|
|
head.BSSTATUSREF = "未锁定";
|
|
|
head.FEESTATUSREF = "未锁定";
|
|
|
if (copyfee == "true")
|
|
|
{
|
|
|
var feelist = MsChFeeDAL.GetAllDataList(condition);
|
|
|
if (feelist != null)
|
|
|
{
|
|
|
for (int _i = 0; _i < feelist.Count; _i++)
|
|
|
{
|
|
|
feelist[_i].BsNo = "*";
|
|
|
}
|
|
|
MsChFeeDAL.SaveFee(feelist, head.BSNO, CookieConfig.GetCookie_UserId(Request));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (head == null)
|
|
|
{
|
|
|
head = new MsOpSeai();
|
|
|
head.BSNO = "topseai" + Guid.NewGuid().ToString();
|
|
|
head.ORDERTYPE = "操作录入";
|
|
|
head.OP = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.DOC = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.INPUTBY = Convert.ToString(Session["SHOWNAME"]);
|
|
|
head.CUSTSERVICE = Convert.ToString(Session["SHOWNAME"]);
|
|
|
var period = ChMonthCloseDAL.GetData("", Convert.ToString(Session["COMPANYID"]));
|
|
|
if (Convert.ToDateTime(period.FDAY) > DateTime.Now)
|
|
|
{
|
|
|
head.ACCDATE = period.PERIOD;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
head.ACCDATE = DateTime.Now.ToString("yyyy-MM");
|
|
|
|
|
|
}
|
|
|
foreach (var enumValue in copyfieldlist)
|
|
|
{
|
|
|
if (enumValue.FIELDNAME == "ORDERTYPE") head.ORDERTYPE = oldhead.ORDERTYPE;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMERNAME") head.CUSTOMERNAME = oldhead.CUSTOMERNAME;
|
|
|
if (enumValue.FIELDNAME == "BSSOURCEDETAIL") head.BSSOURCEDETAIL = oldhead.BSSOURCEDETAIL;
|
|
|
if (enumValue.FIELDNAME == "BSSOURCE") head.BSSOURCE = oldhead.BSSOURCE;
|
|
|
if (enumValue.FIELDNAME == "OP") head.OP = oldhead.OP;
|
|
|
if (enumValue.FIELDNAME == "CUSTSERVICE") head.CUSTSERVICE = oldhead.CUSTSERVICE;
|
|
|
if (enumValue.FIELDNAME == "SALE") head.SALE = oldhead.SALE;
|
|
|
if (enumValue.FIELDNAME == "VESSEL") head.VESSEL = oldhead.VESSEL;
|
|
|
if (enumValue.FIELDNAME == "VOYNO") head.VOYNO = oldhead.VOYNO;
|
|
|
if (enumValue.FIELDNAME == "ETD") head.ETD = oldhead.ETD;
|
|
|
if (enumValue.FIELDNAME == "PORTLOADID") head.PORTLOADID = oldhead.PORTLOADID;
|
|
|
if (enumValue.FIELDNAME == "PORTLOAD") head.PORTLOAD = oldhead.PORTLOAD;
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGEID") head.PORTDISCHARGEID = oldhead.PORTDISCHARGEID;
|
|
|
if (enumValue.FIELDNAME == "PORTDISCHARGE") head.PORTDISCHARGE = oldhead.PORTDISCHARGE;
|
|
|
if (enumValue.FIELDNAME == "GOODSNAME") head.GOODSNAME = oldhead.GOODSNAME;
|
|
|
if (enumValue.FIELDNAME == "CONTRACTNO") head.CONTRACTNO = oldhead.CONTRACTNO;
|
|
|
if (enumValue.FIELDNAME == "KGS") head.KGS = oldhead.KGS;
|
|
|
if (enumValue.FIELDNAME == "PKGS") head.PKGS = oldhead.PKGS;
|
|
|
if (enumValue.FIELDNAME == "KINDPKGS") head.KINDPKGS = oldhead.KINDPKGS;
|
|
|
if (enumValue.FIELDNAME == "REMARK") head.REMARK = oldhead.REMARK;
|
|
|
if (enumValue.FIELDNAME == "YARD") head.YARD = oldhead.YARD;
|
|
|
if (enumValue.FIELDNAME == "BLTYPE") head.BLTYPE = oldhead.BLTYPE;
|
|
|
if (enumValue.FIELDNAME == "CBM") head.CBM = oldhead.CBM;
|
|
|
if (enumValue.FIELDNAME == "CARRIER") head.CARRIER = oldhead.CARRIER;
|
|
|
if (enumValue.FIELDNAME == "TRUCKER") head.TRUCKER = oldhead.TRUCKER;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMSNUM") head.CUSTOMSNUM = oldhead.CUSTOMSNUM;
|
|
|
if (enumValue.FIELDNAME == "NOPKGS") head.NOPKGS = oldhead.NOPKGS;
|
|
|
if (enumValue.FIELDNAME == "GROSSWEIGHT") head.GROSSWEIGHT = oldhead.GROSSWEIGHT;
|
|
|
if (enumValue.FIELDNAME == "MEASUREMENT") head.MEASUREMENT = oldhead.MEASUREMENT;
|
|
|
if (enumValue.FIELDNAME == "DESCRIPTION") head.DESCRIPTION = oldhead.DESCRIPTION;
|
|
|
if (enumValue.FIELDNAME == "TOTALNO") head.TOTALNO = oldhead.TOTALNO;
|
|
|
if (enumValue.FIELDNAME == "TRANSNO") head.TRANSNO = oldhead.TRANSNO;
|
|
|
if (enumValue.FIELDNAME == "SHIPPERID") head.SHIPPERID = oldhead.SHIPPERID;
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEEID") head.CONSIGNEEID = oldhead.CONSIGNEEID;
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTYID") head.NOTIFYPARTYID = oldhead.NOTIFYPARTYID;
|
|
|
if (enumValue.FIELDNAME == "SHIPPER") head.SHIPPER = oldhead.SHIPPER;
|
|
|
if (enumValue.FIELDNAME == "CONSIGNEE") head.CONSIGNEE = oldhead.CONSIGNEE;
|
|
|
if (enumValue.FIELDNAME == "NOTIFYPARTY") head.NOTIFYPARTY = oldhead.NOTIFYPARTY;
|
|
|
if (enumValue.FIELDNAME == "AGENTID") head.AGENTID = oldhead.AGENTID;
|
|
|
if (enumValue.FIELDNAME == "AGENT") head.AGENT = oldhead.AGENT;
|
|
|
if (enumValue.FIELDNAME == "CLOSINGDATE") head.CLOSINGDATE = oldhead.CLOSINGDATE;
|
|
|
if (enumValue.FIELDNAME == "ETA") head.ETA = oldhead.ETA;
|
|
|
if (enumValue.FIELDNAME == "PLACERECEIPT" || enumValue.FIELDNAME == "PlACERECEIPT") head.PlACERECEIPT = oldhead.PlACERECEIPT;
|
|
|
if (enumValue.FIELDNAME == "PLACERECEIPTID") head.PLACERECEIPTID = oldhead.PLACERECEIPTID;
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERYID") head.PLACEDELIVERYID = oldhead.PLACEDELIVERYID;
|
|
|
if (enumValue.FIELDNAME == "PLACEDELIVERY") head.PLACEDELIVERY = oldhead.PLACEDELIVERY;
|
|
|
if (enumValue.FIELDNAME == "DESTINATIONID") head.DESTINATIONID = oldhead.DESTINATIONID;
|
|
|
if (enumValue.FIELDNAME == "DESTINATION") head.DESTINATION = oldhead.DESTINATION;
|
|
|
if (enumValue.FIELDNAME == "NOBILL") head.NOBILL = oldhead.NOBILL;
|
|
|
if (enumValue.FIELDNAME == "ISSUEDATE") head.ISSUEDATE = oldhead.ISSUEDATE;
|
|
|
if (enumValue.FIELDNAME == "ISSUEPLACE") head.ISSUEPLACE = oldhead.ISSUEPLACE;
|
|
|
if (enumValue.FIELDNAME == "BLFRT") head.BLFRT = oldhead.BLFRT;
|
|
|
if (enumValue.FIELDNAME == "PREPARDAT") head.PREPARDAT = oldhead.PREPARDAT;
|
|
|
if (enumValue.FIELDNAME == "PAYABLEAT") head.PAYABLEAT = oldhead.PAYABLEAT;
|
|
|
if (enumValue.FIELDNAME == "SERVICE") head.SERVICE = oldhead.SERVICE;
|
|
|
if (enumValue.FIELDNAME == "MARKS") head.MARKS = oldhead.MARKS;
|
|
|
if (enumValue.FIELDNAME == "LANE") head.LANE = oldhead.LANE;
|
|
|
if (enumValue.FIELDNAME == "FORWARDER") head.FORWARDER = oldhead.FORWARDER;
|
|
|
if (enumValue.FIELDNAME == "INVNO") head.INVNO = oldhead.INVNO;
|
|
|
if (enumValue.FIELDNAME == "CARGOID") head.CARGOID = oldhead.CARGOID;
|
|
|
if (enumValue.FIELDNAME == "DCLASS") head.DCLASS = oldhead.DCLASS;
|
|
|
if (enumValue.FIELDNAME == "DUNNO") head.DUNNO = oldhead.DUNNO;
|
|
|
if (enumValue.FIELDNAME == "REEFERF") head.REEFERF = oldhead.REEFERF;
|
|
|
if (enumValue.FIELDNAME == "TEMPID") head.TEMPID = oldhead.TEMPID;
|
|
|
if (enumValue.FIELDNAME == "TEMPSET") head.TEMPSET = oldhead.TEMPSET;
|
|
|
if (enumValue.FIELDNAME == "TEMPMAX") head.TEMPMAX = oldhead.TEMPMAX;
|
|
|
if (enumValue.FIELDNAME == "TEMPMIN") head.TEMPMIN = oldhead.TEMPMIN;
|
|
|
if (enumValue.FIELDNAME == "ORDTYPE") head.ORDTYPE = oldhead.ORDTYPE;
|
|
|
if (enumValue.FIELDNAME == "ORDERNO") head.ORDERNO = oldhead.ORDERNO;
|
|
|
if (enumValue.FIELDNAME == "INSURANCEER") head.INSURANCEER = oldhead.INSURANCEER;
|
|
|
if (enumValue.FIELDNAME == "INSURANCENO") head.INSURANCENO = oldhead.INSURANCENO;
|
|
|
if (enumValue.FIELDNAME == "INAMOUT") head.INAMOUT = oldhead.INAMOUT;
|
|
|
if (enumValue.FIELDNAME == "ISFUMIGATION") head.ISFUMIGATION = oldhead.ISFUMIGATION;
|
|
|
if (enumValue.FIELDNAME == "ISSTORAGE") head.ISSTORAGE = oldhead.ISSTORAGE;
|
|
|
if (enumValue.FIELDNAME == "ISLAND") head.ISLAND = oldhead.ISLAND;
|
|
|
if (enumValue.FIELDNAME == "ISCUSTOMS") head.ISCUSTOMS = oldhead.ISCUSTOMS;
|
|
|
if (enumValue.FIELDNAME == "ISINSPECTION") head.ISINSPECTION = oldhead.ISINSPECTION;
|
|
|
if (enumValue.FIELDNAME == "ISBOOKING") head.ISBOOKING = oldhead.ISBOOKING;
|
|
|
if (enumValue.FIELDNAME == "ISAGENT") head.ISAGENT = oldhead.ISAGENT;
|
|
|
if (enumValue.FIELDNAME == "ISHBLNO") head.ISHBLNO = oldhead.ISHBLNO;
|
|
|
if (enumValue.FIELDNAME == "SERVICE9") head.SERVICE9 = oldhead.SERVICE9;
|
|
|
if (enumValue.FIELDNAME == "SERVICE10") head.SERVICE10 = oldhead.SERVICE10;
|
|
|
if (enumValue.FIELDNAME == "DOC") head.DOC = oldhead.DOC;
|
|
|
if (enumValue.FIELDNAME == "PACKINGTYPE") head.PACKINGTYPE = oldhead.PACKINGTYPE;
|
|
|
if (enumValue.FIELDNAME == "WAREHOUSE") head.WAREHOUSE = oldhead.WAREHOUSE;
|
|
|
if (enumValue.FIELDNAME == "CLOSEDOCDATE") head.CLOSEDOCDATE = oldhead.CLOSEDOCDATE;
|
|
|
if (enumValue.FIELDNAME == "INTOPORTDATE") head.INTOPORTDATE = oldhead.INTOPORTDATE;
|
|
|
if (enumValue.FIELDNAME == "MBLFRT") head.MBLFRT = oldhead.MBLFRT;
|
|
|
if (enumValue.FIELDNAME == "STLNAME") head.STLNAME = oldhead.STLNAME;
|
|
|
if (enumValue.FIELDNAME == "STLDATE") head.STLDATE = oldhead.STLDATE;
|
|
|
if (enumValue.FIELDNAME == "OPERATOR") head.OPERATOR = oldhead.OPERATOR;
|
|
|
if (enumValue.FIELDNAME == "OPERATORTEL") head.OPERATORTEL = oldhead.OPERATORTEL;
|
|
|
if (enumValue.FIELDNAME == "FINANCIALSTAFF") head.FINANCIALSTAFF = oldhead.FINANCIALSTAFF;
|
|
|
if (enumValue.FIELDNAME == "SOURCECODE") head.SOURCECODE = oldhead.SOURCECODE;
|
|
|
if (enumValue.FIELDNAME == "ISCONTAINERSOC") head.ISCONTAINERSOC = oldhead.ISCONTAINERSOC;
|
|
|
if (enumValue.FIELDNAME == "DPAGE") head.DPAGE = oldhead.DPAGE;
|
|
|
if (enumValue.FIELDNAME == "DLABEL") head.DLABEL = oldhead.DLABEL;
|
|
|
if (enumValue.FIELDNAME == "LINKMAN") head.LINKMAN = oldhead.LINKMAN;
|
|
|
if (enumValue.FIELDNAME == "VESSELID") head.VESSELID = oldhead.VESSELID;
|
|
|
if (enumValue.FIELDNAME == "ISSUEPLACEID") head.ISSUEPLACEID = oldhead.ISSUEPLACEID;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMNO") head.CUSTOMNO = oldhead.CUSTOMNO;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMDATE") head.CUSTOMDATE = oldhead.CUSTOMDATE;
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONNO") head.INSPECTIONNO = oldhead.INSPECTIONNO;
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONDATE") head.INSPECTIONDATE = oldhead.INSPECTIONDATE;
|
|
|
if (enumValue.FIELDNAME == "ENTERP") head.ENTERP = oldhead.ENTERP;
|
|
|
if (enumValue.FIELDNAME == "TERMSDELIVERY") head.TERMSDELIVERY = oldhead.TERMSDELIVERY;
|
|
|
if (enumValue.FIELDNAME == "INSPECTSERVICE") head.INSPECTSERVICE = oldhead.INSPECTSERVICE;
|
|
|
if (enumValue.FIELDNAME == "TRADETERM") head.TRADETERM = oldhead.TRADETERM;
|
|
|
if (enumValue.FIELDNAME == "SHIPAGENCY") head.SHIPAGENCY = oldhead.SHIPAGENCY;
|
|
|
if (enumValue.FIELDNAME == "ISMOREGOOD") head.ISMOREGOOD = oldhead.ISMOREGOOD;
|
|
|
if (enumValue.FIELDNAME == "CUSTNO") head.CUSTNO = oldhead.CUSTNO;
|
|
|
if (enumValue.FIELDNAME == "MBLNO") head.MBLNO = oldhead.MBLNO;
|
|
|
if (enumValue.FIELDNAME == "HBLNO") head.HBLNO = oldhead.HBLNO;
|
|
|
if (enumValue.FIELDNAME == "APPLYNO") head.APPLYNO = oldhead.APPLYNO;
|
|
|
if (enumValue.FIELDNAME == "UNITOFWEIGHT") head.UNITOFWEIGHT = oldhead.UNITOFWEIGHT;
|
|
|
if (enumValue.FIELDNAME == "ISSUETYPE") head.ISSUETYPE = oldhead.ISSUETYPE;
|
|
|
if (enumValue.FIELDNAME == "VESSELID") head.VESSELID = oldhead.VESSELID;
|
|
|
if (enumValue.FIELDNAME == "SALECORPID") head.SALECORPID = oldhead.SALECORPID;
|
|
|
if (enumValue.FIELDNAME == "COUNTRYOFORIGIN") head.COUNTRYOFORIGIN = oldhead.COUNTRYOFORIGIN;
|
|
|
if (enumValue.FIELDNAME == "NUMBERPLATE") head.NUMBERPLATE = oldhead.NUMBERPLATE;
|
|
|
if (enumValue.FIELDNAME == "UNITS") head.UNITS = oldhead.UNITS;
|
|
|
if (enumValue.FIELDNAME == "TRANSKINDPKGS") head.TRANSKINDPKGS = oldhead.TRANSKINDPKGS;
|
|
|
if (enumValue.FIELDNAME == "BALES") head.BALES = oldhead.BALES;
|
|
|
if (enumValue.FIELDNAME == "CUSTOMSER") head.CUSTOMSER = oldhead.CUSTOMSER;
|
|
|
if (enumValue.FIELDNAME == "INSPECTION") head.INSPECTION = oldhead.INSPECTION;
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONNO") head.INSPECTIONNO = oldhead.INSPECTIONNO;
|
|
|
if (enumValue.FIELDNAME == "INSPECTIONDATE") head.INSPECTIONDATE = oldhead.INSPECTIONDATE;
|
|
|
if (enumValue.FIELDNAME == "FBP") head.FBP = oldhead.FBP;
|
|
|
if (enumValue.FIELDNAME == "BMDDATE") head.BMDDATE = oldhead.BMDDATE;
|
|
|
if (enumValue.FIELDNAME == "MDTDATE") head.MDTDATE = oldhead.MDTDATE;
|
|
|
if (enumValue.FIELDNAME == "MT") head.MT = oldhead.MT;
|
|
|
if (enumValue.FIELDNAME == "TRADINGAGENCY") head.TRADINGAGENCY = oldhead.TRADINGAGENCY;
|
|
|
if (enumValue.FIELDNAME == "GOODSTYPENAME") head.GOODSTYPENAME = oldhead.GOODSTYPENAME;
|
|
|
if (enumValue.FIELDNAME == "SHOWNAME") head.SHOWNAME = oldhead.SHOWNAME;
|
|
|
if (enumValue.FIELDNAME == "APPROVENO") head.APPROVENO = oldhead.APPROVENO;
|
|
|
if (enumValue.FIELDNAME == "GRADE") head.GRADE = oldhead.GRADE;
|
|
|
if (enumValue.FIELDNAME == "NOR") head.NOR = oldhead.NOR;
|
|
|
if (enumValue.FIELDNAME == "STORAGENAME") head.STORAGENAME = oldhead.STORAGENAME;
|
|
|
if (enumValue.FIELDNAME == "ISFORCEDTODESPATCH") head.ISFORCEDTODESPATCH = oldhead.ISFORCEDTODESPATCH;
|
|
|
if (enumValue.FIELDNAME == "BSKGS") head.BSKGS = oldhead.BSKGS;
|
|
|
if (enumValue.FIELDNAME == "ACTUALKGS") head.ACTUALKGS = oldhead.ACTUALKGS;
|
|
|
if (enumValue.FIELDNAME == "DRAFTKGS") head.DRAFTKGS = oldhead.DRAFTKGS;
|
|
|
if (enumValue.FIELDNAME == "WHARFSKGS") head.WHARFSKGS = oldhead.WHARFSKGS;
|
|
|
if (enumValue.FIELDNAME == "WMSINKGS") head.WMSINKGS = oldhead.WMSINKGS;
|
|
|
if (enumValue.FIELDNAME == "WMSOUTKGS") head.WMSOUTKGS = oldhead.WMSOUTKGS;
|
|
|
if (enumValue.FIELDNAME == "DIFFERENCEKGS") head.DIFFERENCEKGS = oldhead.DIFFERENCEKGS;
|
|
|
if (enumValue.FIELDNAME == "WATERCONTENT") head.WATERCONTENT = oldhead.WATERCONTENT;
|
|
|
if (enumValue.FIELDNAME == "WATERDENSITY") head.WATERDENSITY = oldhead.WATERDENSITY;
|
|
|
if (enumValue.FIELDNAME == "WMSTYPE") head.WMSTYPE = oldhead.WMSTYPE;
|
|
|
if (enumValue.FIELDNAME == "ISMOREGOOD") head.ISMOREGOOD = oldhead.ISMOREGOOD;
|
|
|
if (enumValue.FIELDNAME == "CHANGEDOCDATE") head.CHANGEDOCDATE = oldhead.CHANGEDOCDATE;
|
|
|
if (enumValue.FIELDNAME == "ISMOREGOOD") head.ISMOREGOOD = oldhead.ISMOREGOOD;
|
|
|
if (enumValue.FIELDNAME == "TERMSDELIVERY") head.TERMSDELIVERY = oldhead.TERMSDELIVERY;
|
|
|
if (enumValue.FIELDNAME == "INSPECTSERVICE") head.INSPECTSERVICE = oldhead.INSPECTSERVICE;
|
|
|
if (enumValue.FIELDNAME == "SHIPAGENCY") head.SHIPAGENCY = oldhead.SHIPAGENCY;
|
|
|
if (enumValue.FIELDNAME == "ISBONDED") head.ISBONDED = oldhead.ISBONDED;
|
|
|
if (enumValue.FIELDNAME == "TIHUOTIME") head.TIHUOTIME = oldhead.TIHUOTIME;
|
|
|
if (enumValue.FIELDNAME == "SJYHDATE") head.SJYHDATE = oldhead.SJYHDATE;
|
|
|
if (enumValue.FIELDNAME == "YaXiangDate") head.YaXiangDate = oldhead.YaXiangDate;
|
|
|
if (enumValue.FIELDNAME == "YaXiangDiDian") head.YaXiangDiDian = oldhead.YaXiangDiDian;
|
|
|
if (enumValue.FIELDNAME == "YaXiangJinE") head.YaXiangJinE = oldhead.YaXiangJinE;
|
|
|
if (enumValue.FIELDNAME == "CTNNUM") head.CTNNUM = oldhead.CTNNUM;
|
|
|
if (enumValue.FIELDNAME == "WMSCTNNUM") head.WMSCTNNUM = oldhead.WMSCTNNUM;
|
|
|
if (enumValue.FIELDNAME == "MaTou") head.MaTou = oldhead.MaTou;
|
|
|
if (enumValue.FIELDNAME == "TRADETYPE") head.TRADETYPE = oldhead.TRADETYPE;
|
|
|
}
|
|
|
if (copyfee == "true")
|
|
|
{
|
|
|
var feelist = MsChFeeDAL.GetAllDataList(condition);
|
|
|
if (feelist != null)
|
|
|
{
|
|
|
for (int _i = 0; _i < feelist.Count; _i++)
|
|
|
{
|
|
|
feelist[_i].BsNo = "*";
|
|
|
}
|
|
|
MsChFeeDAL.SaveFee(feelist, head.BSNO, CookieConfig.GetCookie_UserId(Request));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
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
|
|
|
{
|
|
|
|
|
|
var CUSTOMHEAD = "";
|
|
|
if (billnoset.CUSTOMHEAD != "")
|
|
|
{
|
|
|
var HBLCUSTOMHEAD = billnoset.CUSTOMHEAD;
|
|
|
if ((HBLCUSTOMHEAD.IndexOf("[SALE]") >= 0) && !string.IsNullOrEmpty(headData.SALE))
|
|
|
{
|
|
|
var user = SysUserDAL.GetData("u.SHOWNAME='" + headData.SALE + "'");
|
|
|
if (!string.IsNullOrEmpty(user.NOCODE))
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[SALE]", user.NOCODE);
|
|
|
|
|
|
}
|
|
|
if ((HBLCUSTOMHEAD.IndexOf("[OP]") >= 0) && !string.IsNullOrEmpty(headData.OP))
|
|
|
{
|
|
|
var user = SysUserDAL.GetData("u.SHOWNAME='" + headData.OP + "'");
|
|
|
if (!string.IsNullOrEmpty(user.NOCODE))
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[OP]", user.NOCODE);
|
|
|
}
|
|
|
CUSTOMHEAD = HBLCUSTOMHEAD;
|
|
|
var CUST = MsInfoClientDAL.GetData("SHORTNAME='" + headData.CUSTOMERNAME + "'");
|
|
|
CUSTOMHEAD = CUSTOMHEAD.Replace("[CUSTCODE]", CUST.CODENAME);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
headData.CUSTNO = MsSysBillNoSetDAL.GetBillNo(billnoset, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), "", headData.OP, headData.SALECORPID, CUSTOMHEAD);
|
|
|
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")
|
|
|
{
|
|
|
if (billnosethblno.CUSTOMHEAD != "")
|
|
|
{
|
|
|
var HBLCUSTOMHEAD = billnosethblno.CUSTOMHEAD;
|
|
|
var bssource = BasicDataRefDAL.GetSourceData("SOURCENAME='" + headData.BSSOURCE + "'");
|
|
|
var lanelist = BasicDataRefDAL.GetCodeLaneList();
|
|
|
var lane = lanelist.Find(x => x.LANE == headData.LANE);
|
|
|
var bstypelist = PubSysDAL.GetEnumValueList(97042, "");
|
|
|
var bstype = bstypelist.Find(x => x.EnumValueName == headData.BLTYPE);
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[LN]", lane.LANEID);
|
|
|
HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BT]", bstype.EnumValueName_2);
|
|
|
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
|
|
|
// HBLCUSTOMHEAD = HBLCUSTOMHEAD.Replace("[BS]", bssource.SOURCECODE);
|
|
|
|
|
|
var hblno = MsSysBillNoSetDAL.GetBillNoHblno(billnosethblno, headData.ETD.ToString().Trim(), headData.ACCDATE.ToString().Trim(), HBLCUSTOMHEAD);
|
|
|
headData.HBLNO = hblno;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
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;
|
|
|
if (headData.HGCYDATE == "") headData.HGCYDATE = null;
|
|
|
if (headData.CONTRACTDATE == "") headData.CONTRACTDATE = 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
|
|
|
//
|
|
|
|
|
|
var nowperiod = ChMonthCloseDAL.GetData("", Convert.ToString(Session["COMPANYID"]));
|
|
|
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;
|
|
|
if (Convert.ToDateTime(nowperiod.PERIOD + "-01") > Convert.ToDateTime(headData.ACCDATE + "-01"))
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = "已月末结转,不允许添加业务!",
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (opstatus == "edit")
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotUpd;
|
|
|
headData.ModelUIStatus = "E";
|
|
|
if (Convert.ToDateTime(nowperiod.PERIOD + "-01") > Convert.ToDateTime(headData.ACCDATE + "-01"))
|
|
|
{
|
|
|
|
|
|
var ACCDATE = T_ALL_DA.GetStrSQL("ACCDATE", "select ACCDATE from v_op_bill WHERE BSNO='" + headData.BSNO + "'");
|
|
|
if (ACCDATE != headData.ACCDATE)
|
|
|
{
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
{
|
|
|
Success = false,
|
|
|
Message = "已月末结转,不允许修改会计期间!",
|
|
|
};
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
headData.DbOperationType = DbOperationType.DbotDel;
|
|
|
}
|
|
|
|
|
|
if (opstatus == "add" || opstatus == "edit") {
|
|
|
|
|
|
//var _r1 = QY_addWarehouseNotice(headData);
|
|
|
|
|
|
var _r2 = QY_ETA_SEND(headData);
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
}
|
|
|
headData.BSSOURCE = headData.BSSOURCE.Trim();
|
|
|
|
|
|
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"]));
|
|
|
|
|
|
if (headData.APPLYNO != "" && headData.APPLYNO.IndexOf("CPN") > 0 && bodyList.Count == 0)
|
|
|
{
|
|
|
var applyctnlist = MvcContainer.DAL.MsOpCtnApply.MsOpCtnApplyDAL.GetCtnApplyCtnItemsList("LINKGID in (SELECT GID FROM op_ctnapply WHERE BSNO='" + headData.APPLYNO + "') ");
|
|
|
if (applyctnlist.Count != 0)
|
|
|
{
|
|
|
foreach (var applyctn in applyctnlist)
|
|
|
{
|
|
|
if (bodyList.FindAll(x => x.CNTRNO == applyctn.CTNNO).Count == 0)
|
|
|
{
|
|
|
var ctn = new MsOpSeaiDetail();
|
|
|
ctn.BSNO = "*";
|
|
|
ctn.CNTRNO = applyctn.CTNNO;
|
|
|
ctn.CTNALL = "20TK";
|
|
|
ctn.CTNNUM = 1;
|
|
|
ctn.CTNSTATUS = "F";
|
|
|
ctn.CTN_ID = Guid.NewGuid().ToString();
|
|
|
bodyList.Add(ctn);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
//}
|
|
|
var istrue = MsBaseInfoDAL.GetUserModuleEnable("modWxOpStatusMsg", Convert.ToString(Session["USERID"]));
|
|
|
if (istrue) {
|
|
|
if (headData.BSDATE != null && headData.BSDATE != "") {
|
|
|
var blUpSQL = " if (select ST_ID from op_status where BSNO='" + headData.BSNO + "' AND STATUS='接单完成') is null insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP) values(NEWID(),'" + headData.BSNO + "','接单完成',1,'" +Convert.ToDateTime(headData.BSDATE).ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','"+ Convert.ToString(Session["SHOWNAME"]) + "')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
if (headData.CUSTOMDATE != null&& headData.CUSTOMDATE!="")
|
|
|
{
|
|
|
var blUpSQL = " if (select ST_ID from op_status where BSNO='" + headData.BSNO + "' AND STATUS='通关完成') is null insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP) values(NEWID(),'" + headData.BSNO + "','通关完成',1,'" + Convert.ToDateTime(headData.CUSTOMDATE).ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','" + Convert.ToString(Session["SHOWNAME"]) + "')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
if (headData.TIHUOTIME != null && headData.TIHUOTIME != "")
|
|
|
{
|
|
|
var blUpSQL = " if (select ST_ID from op_status where BSNO='" + headData.BSNO + "' AND STATUS='入库状态') is null insert into op_status(ST_ID,BSNO,STATUS,ISCOMP,COMPTIME,INPUTTIME,STTYPE,COMPOP) values(NEWID(),'" + headData.BSNO + "','入库状态',1,'" + Convert.ToDateTime(headData.TIHUOTIME).ToString("yyyy-MM-dd HH:mm:ss") + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','1','" + Convert.ToString(Session["SHOWNAME"]) + "')";
|
|
|
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
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";
|
|
|
headData.CUSTOMDATE = head.CUSTOMDATE;
|
|
|
var isuse = MsBaseInfoDAL.GetRuleUse("委托编号", "4");
|
|
|
if (isuse)
|
|
|
{
|
|
|
var _r = MsOpApplyDAL.getCUSTNO(headData, Session["USERID"].ToString(), Session["SHOWNAME"].ToString(), Session["COMPANYID"].ToString());
|
|
|
headData.CUSTNO = _r.Data.ToString();
|
|
|
}
|
|
|
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 && !string.IsNullOrWhiteSpace(objCtrno.ToString() ) && !string.IsNullOrWhiteSpace(objPack.ToString() ) && !string.IsNullOrWhiteSpace(objKgs.ToString()) && !string.IsNullOrWhiteSpace(objDate.ToString()) && !string.IsNullOrWhiteSpace( 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 (obj_PRODUCTIONDATE != null)
|
|
|
{
|
|
|
if (IsNumber(obj_PRODUCTIONDATE.ToString()))
|
|
|
CtrnExcel.PRODUCTIONDATE = DateTime.FromOADate(Convert.ToDouble(obj_PRODUCTIONDATE)).ToString("d");
|
|
|
else
|
|
|
CtrnExcel.PRODUCTIONDATE = obj_PRODUCTIONDATE.ToString();
|
|
|
}
|
|
|
else { CtrnExcel.PRODUCTIONDATE = ""; }
|
|
|
CtrnExcelList.Add(CtrnExcel);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
if ( objblno.ToString().Trim() != HeadData.MBLNO.Trim())
|
|
|
{
|
|
|
//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.ToString();
|
|
|
item.ISWMS = "0";
|
|
|
item.AREANAME = CtrnExcel.AreaName.ToString();
|
|
|
isuse = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
workbook.Close(false, filename, 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>();
|
|
|
List<CountryModel> countryList = BasicDataRefDAL.GetCountryRefList("");
|
|
|
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";
|
|
|
//wmsin.COUNTRYID = "";
|
|
|
|
|
|
|
|
|
Pattern p = Pattern.compile(".*?(?=\\()");
|
|
|
Matcher m = p.matcher(headData.COUNTRYOFORIGIN);
|
|
|
var countryname = "";
|
|
|
if (m.find())
|
|
|
{
|
|
|
countryname=m.group();
|
|
|
}
|
|
|
|
|
|
CountryModel c = countryList.FirstOrDefault(s => s.country.indexOf (countryname) >=0);
|
|
|
try
|
|
|
{
|
|
|
wmsin.COUNTRYID = c.countryid;
|
|
|
}
|
|
|
catch {
|
|
|
wmsin.COUNTRYID = "";
|
|
|
}
|
|
|
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 = "";
|
|
|
|
|
|
Pattern p = Pattern.compile(".*?(?=\\()");
|
|
|
Matcher m = p.matcher(headData.COUNTRYOFORIGIN);
|
|
|
var countryname = "";
|
|
|
if (m.find())
|
|
|
{
|
|
|
countryname = m.group();
|
|
|
}
|
|
|
|
|
|
CountryModel c = countryList.FirstOrDefault(s => s.country.indexOf(countryname) >= 0);
|
|
|
try
|
|
|
{
|
|
|
wmsin.COUNTRYID = c.countryid;
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
wmsin.COUNTRYID = "";
|
|
|
}
|
|
|
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
|
|
|
//
|
|
|
|
|
|
#region 红柿子-青银 接口发送到港日
|
|
|
|
|
|
public ContentResult Needsend(string headid) {
|
|
|
var condition = $" B.bsno='{headid}'";
|
|
|
var head = MsOpSeaiDAL.GetData(condition);
|
|
|
|
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
|
|
|
|
var cansendparam = cdc.sys_param_set.Where(x => x.PARAMNAME == "QY_ETA_SEND").ToList();
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (cansendparam != null && cansendparam.Count > 0)
|
|
|
{
|
|
|
if (cansendparam[0].PARAMVALUE == "1")
|
|
|
{
|
|
|
result.setMessage(true, "");
|
|
|
}
|
|
|
}
|
|
|
else result.SetErrorInfo("无此项目");
|
|
|
|
|
|
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = result.Success, Message = result.Message, data = "" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
|
|
|
private static DBResult needsend(MsOpSeai headData) {
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(headData.CONTRACTNO) || string.IsNullOrWhiteSpace(headData.MBLNO) || string.IsNullOrWhiteSpace(headData.ETD)) {
|
|
|
result.SetErrorInfo("数据不全,不需传送");
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
|
|
|
|
var cansendparam = cdc.sys_param_set.Where(x => x.PARAMNAME == "QY_ETA_SEND").ToList();
|
|
|
|
|
|
if (cansendparam != null && cansendparam.Count > 0)
|
|
|
{
|
|
|
if (cansendparam[0].PARAMVALUE == "1") {
|
|
|
result.setMessage(true, "");
|
|
|
}
|
|
|
}
|
|
|
else result.SetErrorInfo("无此项目");
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public class saveEtaTimemb
|
|
|
{
|
|
|
public string status { get; set; }
|
|
|
public string msg { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
public static DBResult QY_ETA_SEND(MsOpSeai headData) {
|
|
|
var result = new DBResult();
|
|
|
|
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//如果符合条件 则进行发送
|
|
|
|
|
|
var cansend = needsend(headData);
|
|
|
if (!cansend.Success) return cansend;
|
|
|
|
|
|
var dic = new Dictionary<string, string>();
|
|
|
dic.Add("contractNo", headData.CONTRACTNO);
|
|
|
dic.Add("blNo", headData.MBLNO);
|
|
|
dic.Add("etatime", headData.ETD);
|
|
|
|
|
|
//var _IURL = "http://47.105.179.40:8080/wms-admin/api/edi/saveEtaTime";
|
|
|
var _IURL = "http://82.157.27.145:8099/wms-admin/api/edi/saveEtaTime";
|
|
|
|
|
|
string Contentjson = JsonConvert.Serialize(dic);
|
|
|
|
|
|
var rtn = WebRequestHelper.DoPost(_IURL, Contentjson);
|
|
|
//var rtn = WebRequestHelper.DoPost(_SandBoxURL, dic, 20000);
|
|
|
|
|
|
//RepCZModel CZM = Newtonsoft.Json.JsonConvert.DeserializeObject<RepCZModel>(rtn);
|
|
|
saveEtaTimemb pt = Newtonsoft.Json.JsonConvert.DeserializeObject<saveEtaTimemb>(rtn);
|
|
|
|
|
|
if (pt.status == "0")
|
|
|
{
|
|
|
result.OK();
|
|
|
return result;
|
|
|
}
|
|
|
else {
|
|
|
result.SetErrorInfo(pt.msg);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
result.SetErrorInfo(e.Message);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public class QY_WarehouseNotice_good {
|
|
|
public string goodId { get; set; }
|
|
|
public string goodCode { get; set; }
|
|
|
public string goodName { get; set; }
|
|
|
public string oneNum { get; set; }
|
|
|
public string unit { get; set; }
|
|
|
public string grossWeightSum { get; set; }
|
|
|
public string total { get; set; }
|
|
|
public QY_WarehouseNotice_good() { }
|
|
|
|
|
|
public QY_WarehouseNotice_good(MsOpApplyDetail detail) {
|
|
|
goodId = detail.BsNo + detail.SerialNo;
|
|
|
goodCode = detail.GoodsCode;
|
|
|
goodName = detail.GoodsName;
|
|
|
oneNum = Math.Round(detail.GOODSNUM,0).ToString();
|
|
|
unit = detail.KINDPKGS;
|
|
|
grossWeightSum = detail.KGS.ToString();
|
|
|
total = detail.Total.ToString();
|
|
|
}
|
|
|
}
|
|
|
public class QY_WarehouseNotice {
|
|
|
public string id { get; set; }
|
|
|
public string blNo { get; set; }
|
|
|
public string contractNo { get; set; }
|
|
|
public string customerCode { get; set; }
|
|
|
public string trade { get; set; }
|
|
|
public string caseType { get; set; }
|
|
|
public string etaDate { get; set; }
|
|
|
public string receiveDate { get; set; }
|
|
|
|
|
|
public string remark { get; set; }
|
|
|
public List<QY_WarehouseNotice_good> goodsList { get; set; }
|
|
|
|
|
|
public QY_WarehouseNotice() { }
|
|
|
public QY_WarehouseNotice(MsOpSeai headData) {
|
|
|
id = headData.BSNO;
|
|
|
blNo = headData.MBLNO;
|
|
|
contractNo = headData.CONTRACTNO;
|
|
|
|
|
|
var custcode = BasicDataRefDAL.GetCustomerCode(headData.CUSTOMERNAME);
|
|
|
|
|
|
//customerCode = headData.CUSTOMERNAME;
|
|
|
|
|
|
customerCode = headData.APPLYNO;//20220323修改
|
|
|
trade = headData.TRADETYPE;
|
|
|
caseType = headData.CNTRTOTAL.replace("/",",");
|
|
|
etaDate = headData.ETD;
|
|
|
receiveDate = headData.BSDATE+" 00:00:00";
|
|
|
remark = headData.REMARK;
|
|
|
|
|
|
var detaillist= MsOpApplyDAL.GetBodyList(" BsNo='" + id + "' ");
|
|
|
goodsList = new List<QY_WarehouseNotice_good>();
|
|
|
|
|
|
foreach (var item in detaillist) {
|
|
|
var newdetail = new QY_WarehouseNotice_good(item);
|
|
|
goodsList.Add(newdetail);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public DBResult cansend() {
|
|
|
var result = new DBResult();
|
|
|
result.setMessage(true, "");
|
|
|
if (goodsList==null|| goodsList.Count == 0) {
|
|
|
result.SetErrorInfo("没有商品明细");
|
|
|
}
|
|
|
if (goodsList .Exists(x=>Convert.ToInt32( x.oneNum)==0))
|
|
|
{
|
|
|
result.SetErrorInfo("存在件数为0的商品信息");
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public ContentResult QY_addWarehouseNotice(string headid)
|
|
|
{
|
|
|
var condition = $" B.bsno='{headid}'";
|
|
|
var head = MsOpSeaiDAL.GetData(condition);
|
|
|
|
|
|
var dbresult = QY_addWarehouseNotice(head);
|
|
|
|
|
|
var json = JsonConvert.Serialize(
|
|
|
new { Success = dbresult.Success, Message = dbresult.Message, data = "" });
|
|
|
return new ContentResult() { Content = json };
|
|
|
}
|
|
|
public static DBResult QY_addWarehouseNotice(MsOpSeai headData)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
CommonDataContext cdc = new CommonDataContext();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
//如果符合条件 则进行发送
|
|
|
|
|
|
//var cansend = needsend(headData);
|
|
|
//if (!cansend.Success) return cansend;
|
|
|
|
|
|
var newrecord = new QY_WarehouseNotice(headData);
|
|
|
|
|
|
//var _IURL = "http://47.105.179.40:8080/wms-admin/api/edi/addWarehouseNotice";
|
|
|
var _IURL = "http://82.157.27.145:8099/wms-admin/api/edi/addWarehouseNotice";
|
|
|
|
|
|
string Contentjson = JsonConvert.Serialize(newrecord);
|
|
|
|
|
|
var rtn = WebRequestHelper.DoPost(_IURL, Contentjson);
|
|
|
//var rtn = WebRequestHelper.DoPost(_SandBoxURL, dic, 20000);
|
|
|
|
|
|
//RepCZModel CZM = Newtonsoft.Json.JsonConvert.DeserializeObject<RepCZModel>(rtn);
|
|
|
saveEtaTimemb pt = Newtonsoft.Json.JsonConvert.DeserializeObject<saveEtaTimemb>(rtn);
|
|
|
|
|
|
if (pt.status == "0")
|
|
|
{
|
|
|
result.OK();
|
|
|
return result;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.SetErrorInfo(pt.msg);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
result.SetErrorInfo(e.Message);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
}
|
|
|
|