|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Data.Entity.Migrations;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.Mvc;
|
|
|
|
|
using Colo.Web.admin.user;
|
|
|
|
|
using com.sun.org.apache.bcel.@internal.generic;
|
|
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
using DSWeb.Areas.MvcShipping.Helper;
|
|
|
|
|
using DSWeb.Common.DB;
|
|
|
|
|
using DSWeb.EntityDA;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsChFeeDAL;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsOpApplyDAL;
|
|
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
|
using DSWeb.MvcShipping.Helper.Repository;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsInfoClient;
|
|
|
|
|
using DSWeb.MvcShipping.Models.MsOpApply;
|
|
|
|
|
using DSWeb.ParameterSet;
|
|
|
|
|
using DSWeb.SoftMng.Model;
|
|
|
|
|
using DSWeb.TruckMng.Comm.Cookie;
|
|
|
|
|
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using java.rmi.server;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.CommMng.DAL
|
|
|
|
|
{
|
|
|
|
|
public class PublicAPIDAL
|
|
|
|
|
{
|
|
|
|
|
public static JsonResponse GuanMaoYun_Head_Save(GuanMaoYun_Head head,string OP)
|
|
|
|
|
{
|
|
|
|
|
var result = new JsonResponse();
|
|
|
|
|
|
|
|
|
|
//将head转化为报关业务
|
|
|
|
|
|
|
|
|
|
//var OpapplyHead = getHeadInfo(head);
|
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
|
|
|
|
var admin = cdc.VW_user.First(x => x.CODENAME == "admin");
|
|
|
|
|
|
|
|
|
|
var _r2 = getHeadInfo(head, "add", admin);
|
|
|
|
|
if (!_r2.Success)
|
|
|
|
|
{
|
|
|
|
|
result = new JsonResponse { Success = _r2.Success, Message = _r2.Message, Data = _r2.Data };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
var OpapplyHead = (MsOpApply)_r2.Data;
|
|
|
|
|
|
|
|
|
|
var OpapplyGoodsDetailList = new List<MsOpApplyDetail>();
|
|
|
|
|
|
|
|
|
|
var OpapplyCtnList = new List<MsOpCtn>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据唯一编号判断是否重复
|
|
|
|
|
|
|
|
|
|
//如重复则更新 如不重复则添加(MsOpApply 和 MsOpApplyDetail都是)
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
var bsno = OpapplyHead.BSNO;
|
|
|
|
|
|
|
|
|
|
var _count = BasicDataRefDAL.GetExist("OP_APPLY", " BSNO='" + bsno + "' ");
|
|
|
|
|
|
|
|
|
|
var delDetailList = new List<MsOpApplyDetail>();
|
|
|
|
|
var delCtnList = new List<MsOpCtn>();
|
|
|
|
|
|
|
|
|
|
if (_count == 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _r3 = getHeadInfo(head, "add", admin);
|
|
|
|
|
if (!_r3.Success)
|
|
|
|
|
{
|
|
|
|
|
result = new JsonResponse { Success = _r3.Success, Message = _r3.Message, Data = _r3.Data };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
OpapplyHead = (MsOpApply)_r3.Data;
|
|
|
|
|
|
|
|
|
|
OpapplyHead.DbOperationType = DbOperationType.DbotIns;
|
|
|
|
|
|
|
|
|
|
OpapplyHead.ModelUIStatus = "I";
|
|
|
|
|
|
|
|
|
|
if (OpapplyHead.CUSTNO == "")
|
|
|
|
|
{
|
|
|
|
|
var isuse = false;
|
|
|
|
|
|
|
|
|
|
var _r1 = MsOpApplyDAL.getCUSTNO(OpapplyHead, admin.USERID, admin.SHOWNAME, admin.COMPANYID);
|
|
|
|
|
|
|
|
|
|
if (_r1.Success)
|
|
|
|
|
{
|
|
|
|
|
OpapplyHead.CUSTNO = _r1.Data.ToString();
|
|
|
|
|
//iscreatecustno = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var jsonRespose2 = new JsonResponse
|
|
|
|
|
{
|
|
|
|
|
Success = _r1.Success,
|
|
|
|
|
Message = _r1.Message,
|
|
|
|
|
Data = null
|
|
|
|
|
};
|
|
|
|
|
return jsonRespose2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OpapplyGoodsDetailList = getGoodsDetailListInfo(head);
|
|
|
|
|
|
|
|
|
|
OpapplyCtnList = getCtnListInfo(head);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//OpapplyHead = getHeadInfo(head, "update");
|
|
|
|
|
|
|
|
|
|
var _r4 = getHeadInfo(head, "update");
|
|
|
|
|
if (!_r4.Success)
|
|
|
|
|
{
|
|
|
|
|
result = new JsonResponse { Success = _r4.Success, Message = _r4.Message, Data = _r4.Data };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
OpapplyHead = (MsOpApply)_r4.Data;
|
|
|
|
|
|
|
|
|
|
OpapplyHead.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
|
|
|
|
|
OpapplyHead.ModelUIStatus = "E";
|
|
|
|
|
|
|
|
|
|
//var currhead= MsOpApplyDAL.GetData("BSNO='"+ bsno + "'");
|
|
|
|
|
OpapplyGoodsDetailList = getGoodsDetailListInfo(head);
|
|
|
|
|
|
|
|
|
|
OpapplyCtnList = getCtnListInfo(head);
|
|
|
|
|
|
|
|
|
|
//同时将后台已有而此次没有的明细加入删除列表
|
|
|
|
|
//var currDetailList= MsOpApplyDAL.GetBodyList(" BsNo='" + bsno + "'");
|
|
|
|
|
|
|
|
|
|
//if (currDetailList.Count > 0) {
|
|
|
|
|
// foreach (var item in currDetailList) {
|
|
|
|
|
// //如果存在 则update
|
|
|
|
|
// if (OpapplyGoodsDetailList.Exists(x => x.BsNo == bsno && x.SerialNo == item.SerialNo))
|
|
|
|
|
// {
|
|
|
|
|
// var updrec = OpapplyGoodsDetailList.First(x => x.BsNo == bsno && x.SerialNo == item.SerialNo);
|
|
|
|
|
// OpapplyGoodsDetailList.Remove(updrec);
|
|
|
|
|
// updrec.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
// updrec.BsNo=
|
|
|
|
|
// OpapplyGoodsDetailList.Add(updrec) ;
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// delDetailList.Add(item);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//20230111 改为删除所有明细
|
|
|
|
|
BasicDataRefDAL.ExecSql($"delete from op_apply_detail where BSNO ='{bsno}'");
|
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.ExecSql($"delete from op_ctn where BSNO ='{bsno}'");
|
|
|
|
|
//var currctnList = MsOpApplyDAL.GetCtnBodyList(" BsNo='" + bsno + "'");
|
|
|
|
|
|
|
|
|
|
//if (currctnList.Count > 0)
|
|
|
|
|
//{
|
|
|
|
|
// foreach (var item in currctnList)
|
|
|
|
|
// {
|
|
|
|
|
// if (OpapplyCtnList.Exists(x => x.BSNO == bsno && x.CNTRNO == item.CNTRNO))
|
|
|
|
|
// {
|
|
|
|
|
// var updrec = OpapplyCtnList.First(x => x.BSNO == bsno && x.CNTRNO == item.CNTRNO);
|
|
|
|
|
// OpapplyCtnList.Remove(updrec);
|
|
|
|
|
|
|
|
|
|
// updrec.DbOperationType = DbOperationType.DbotUpd;
|
|
|
|
|
// updrec.CTN_ID= item.CTN_ID;
|
|
|
|
|
// updrec.GID = item.GID;
|
|
|
|
|
// OpapplyCtnList.Add(updrec);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// delCtnList.Add(item);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OpapplyHead.OP = OP;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var modb = new ModelObjectRepository();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DBResult _r = modb.Save(OpapplyHead
|
|
|
|
|
, ModelObjectConvert<MsOpApplyDetail>.ToModelObjectList(OpapplyGoodsDetailList)
|
|
|
|
|
, ModelObjectConvert<MsOpApplyDetail>.ToModelObjectList(delDetailList)
|
|
|
|
|
, ModelObjectConvert<MsOpCtn>.ToModelObjectList(OpapplyCtnList)
|
|
|
|
|
, ModelObjectConvert<MsOpCtn>.ToModelObjectList(delCtnList)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
result = new JsonResponse { Success = _r.Success, Message = _r.Message, Data = _r.Data };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static JsonResponse GuanMaoYun_Fee_Save(GuanMaoYun_Fee FeeHead)
|
|
|
|
|
{
|
|
|
|
|
var result = new JsonResponse();
|
|
|
|
|
|
|
|
|
|
//根据 GuanMaoYun_Fee.CUSTOMER 查找客户
|
|
|
|
|
//在 code_cust_edi当中寻找EDICODE=关贸云的对应关系,取EDINAME=GuanMaoYun_Fee.CUSTOMER的CUST
|
|
|
|
|
|
|
|
|
|
var BSNO = FeeHead.JOB_ID;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _count = BasicDataRefDAL.GetExist("OP_APPLY", " BSNO='" + BSNO + "' ");
|
|
|
|
|
|
|
|
|
|
if (_count == 0)
|
|
|
|
|
{
|
|
|
|
|
result = new JsonResponse { Success = false, Message = "【" + BSNO + "】没有该业务编号的业务,请先导出业务" };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
|
|
|
|
var feecustidList = new List<string>();
|
|
|
|
|
|
|
|
|
|
foreach (var costs in FeeHead.COSTS)
|
|
|
|
|
{
|
|
|
|
|
feecustidList.Add(costs.COAGENT_ID.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feecodelist = new List<string>();
|
|
|
|
|
foreach (var costs in FeeHead.COSTS)
|
|
|
|
|
{
|
|
|
|
|
feecodelist.Add(costs.FEE_TYPE_CODE.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var customernameList = cdc.code_cust_edi.Where(x => x.EDINAME == "关贸云" && feecustidList.Contains(x.EDICODE)).ToList();
|
|
|
|
|
|
|
|
|
|
var CUSTOMER = new info_client_md();
|
|
|
|
|
|
|
|
|
|
if (customernameList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var Fee in FeeHead.COSTS)
|
|
|
|
|
{
|
|
|
|
|
if (customernameList.Exists(x => x.EDICODE == Fee.COAGENT_ID))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = new JsonResponse { Success = false, Message = "【" + Fee.COAGENT_ID + "】没有对应的往来单位信息" };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//CUSTOMER = cdc.info_client.FirstOrDefault(x => x.SHORTNAME == customernameList[0].CUST);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var _str = string.Join(",", feecustidList);
|
|
|
|
|
result = new JsonResponse { Success = false, Message = "【" + _str + "】没有对应的往来单位信息" };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var feelist = cdc.code_fee_edi.Where(x => feecodelist.Contains(x.FEEENAME)).ToList();
|
|
|
|
|
foreach (var costs in FeeHead.COSTS)
|
|
|
|
|
{
|
|
|
|
|
if (!feelist.Exists(x => x.FEEENAME == costs.FEE_TYPE_CODE))
|
|
|
|
|
{
|
|
|
|
|
result = new JsonResponse { Success = false, Message = "【" + costs.FEE_TYPE_CODE + "】没有对应的费用名称" };
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var CurrChfeelist = cdc.ch_fee.Where(x => x.BSNO == BSNO && x.BXGID == "GMY").ToList();
|
|
|
|
|
|
|
|
|
|
//20230103 导入费用时先删除所有能删的费用
|
|
|
|
|
|
|
|
|
|
var 当前现存费用 = cdc.ch_fee.Where(x => x.BSNO == BSNO).ToList();
|
|
|
|
|
|
|
|
|
|
var delgidListstr = "";
|
|
|
|
|
foreach (var item2 in 当前现存费用)
|
|
|
|
|
{
|
|
|
|
|
if (MsChFeeDAL.ChFeeCanChange(item2))
|
|
|
|
|
{
|
|
|
|
|
var delgidstr = "'" + item2.GID + "'";
|
|
|
|
|
if (delgidListstr != "") delgidListstr += ",";
|
|
|
|
|
delgidListstr += delgidstr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (delgidListstr != "")
|
|
|
|
|
{
|
|
|
|
|
delgidListstr += BasicDataRefDAL.ExecSql($"delete from ch_fee where gid in({delgidListstr})");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in FeeHead.COSTS)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var customername = cdc.code_cust_edi.FirstOrDefault(x => x.EDINAME == "关贸云" && x.EDICODE == item.COAGENT_ID);
|
|
|
|
|
CUSTOMER = cdc.info_client.FirstOrDefault(x => x.SHORTNAME == customername.CUST);
|
|
|
|
|
|
|
|
|
|
//如果存在SOURCE_JOB_BALANCE_ID等于当前存在的某费用
|
|
|
|
|
|
|
|
|
|
//如状态为 1 6 录入 提交 驳回 则直接更新之
|
|
|
|
|
|
|
|
|
|
//如状态不为1 6 则返回错误
|
|
|
|
|
|
|
|
|
|
//如不存在SOURCE_JOB_BALANCE_ID等于当前存在的某费用GID 则添加
|
|
|
|
|
|
|
|
|
|
if (CurrChfeelist.Exists(x => x.GID == item.SOURCE_JOB_BALANCE_ID))
|
|
|
|
|
{
|
|
|
|
|
//如状态为 1 6 录入 提交 驳回 则直接更新之
|
|
|
|
|
|
|
|
|
|
//如状态不为1 6 则返回错误
|
|
|
|
|
|
|
|
|
|
var currfee = CurrChfeelist.First(x => x.GID == item.SOURCE_JOB_BALANCE_ID);
|
|
|
|
|
if (currfee.FEESTATUS == 1 || currfee.FEESTATUS == 6)//currfee.FEESTATUS == 2 ||
|
|
|
|
|
{
|
|
|
|
|
currfee = getFee(FeeHead, item, CUSTOMER, currfee);
|
|
|
|
|
cdc.ch_fee.AddOrUpdate(currfee);
|
|
|
|
|
cdc.SaveChanges();
|
|
|
|
|
result.OK();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.SetError("费用已审核通过,请将当前业务的费用流程回退至可被更改的状态(录入状态 驳回提交)");
|
|
|
|
|
//return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//如不存在SOURCE_JOB_BALANCE_ID等于当前存在的某费用GID 则添加
|
|
|
|
|
|
|
|
|
|
var newfee = getFee(FeeHead, item, CUSTOMER);
|
|
|
|
|
cdc.ch_fee.Add(newfee);
|
|
|
|
|
cdc.SaveChanges();
|
|
|
|
|
result.OK();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var currfee in CurrChfeelist)
|
|
|
|
|
{
|
|
|
|
|
if (FeeHead.COSTS.Exists(x => x.SOURCE_JOB_BALANCE_ID == currfee.GID))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//如不存在则删除
|
|
|
|
|
|
|
|
|
|
if (currfee.FEESTATUS == 1 || currfee.FEESTATUS == 6)//currfee.FEESTATUS == 2 ||
|
|
|
|
|
{
|
|
|
|
|
BasicDataRefDAL.ExecSql($"delete from ch_fee where gid='{currfee.GID}'");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.SetError("费用已审核通过,请将当前业务的费用流程回退至可被更改的状态(录入状态 驳回提交)");
|
|
|
|
|
//return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static DBResult getHeadInfo(GuanMaoYun_Head headinfo, string opstatus, VW_user_md userinfo = null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var result = new MsOpApply();
|
|
|
|
|
|
|
|
|
|
var returnresult = new DBResult();
|
|
|
|
|
|
|
|
|
|
if (opstatus == "add")
|
|
|
|
|
{
|
|
|
|
|
result.INPUTBY = userinfo.SHOWNAME;
|
|
|
|
|
result.CORPID = userinfo.COMPANYID;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = MsOpApplyDAL.GetData("BSNO='" + headinfo.BUSINESS_ORDER_INFO.WORK_NO + "'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var head = headinfo.DECL_HEAD;
|
|
|
|
|
|
|
|
|
|
result.BSNO = headinfo.GetBSNO();
|
|
|
|
|
result.MASTERNO = headinfo.BUSINESS_ORDER_INFO.WORK_NO;
|
|
|
|
|
result.CUSCIQNO = head.EPROT_NO;
|
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
|
|
|
|
//委托单位使用BUSINESS_ORDER_INFO.EXPORT_CODE和code_cust_edi中ediname=关贸云的数据相关联 如无则返回错误
|
|
|
|
|
var 委托单位关贸云code = headinfo.BUSINESS_ORDER_INFO.EXPORT_CODE;
|
|
|
|
|
|
|
|
|
|
var customernameList = cdc.code_cust_edi.Where(x => x.EDINAME == "关贸云" && 委托单位关贸云code == x.EDICODE).ToList();
|
|
|
|
|
|
|
|
|
|
var CUSTOMER = new info_client_md();
|
|
|
|
|
|
|
|
|
|
if (customernameList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result.CUSTOMERNAME = customernameList[0].CUST;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
returnresult.SetErrorInfo($"[{委托单位关贸云code}]没有做代码对应(ediname=关贸云,edicode=关贸云的用户id)");
|
|
|
|
|
return returnresult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//result.CUSTOMERNAME = headinfo.BUSINESS_ORDER_INFO.EXPORT_NAME;
|
|
|
|
|
|
|
|
|
|
//E出口 I进口
|
|
|
|
|
if (head.IE_TYPE == "E") result.BSTYPE = "2";
|
|
|
|
|
if (head.IE_TYPE == "I") result.BSTYPE = "1";
|
|
|
|
|
|
|
|
|
|
//head.DECL_TYPE //暂不处理
|
|
|
|
|
|
|
|
|
|
//head.DECL_PORT
|
|
|
|
|
|
|
|
|
|
//result.MBLNO = head.BILL_NO;
|
|
|
|
|
result.VESSEL = head.TRANS_TOOL_NAME;
|
|
|
|
|
result.VOYNO = head.VOYAGE_NO;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (head.是出口())
|
|
|
|
|
{
|
|
|
|
|
result.ETD = head.IE_DATE.ToString("yyyy-MM-dd");
|
|
|
|
|
if (result.ETD == "0001-01-01") result.ETD = null;
|
|
|
|
|
result.PORTDISCHARGE = head.DEST_PORT_CODE;
|
|
|
|
|
|
|
|
|
|
result.DESPPORT = head.CIQ_ENTY_PORT_CODE;
|
|
|
|
|
}
|
|
|
|
|
if (head.是进口())
|
|
|
|
|
{
|
|
|
|
|
result.ETA = head.IE_DATE.ToString("yyyy-MM-dd");
|
|
|
|
|
if (result.ETD == "0001-01-01") result.ETD = null;
|
|
|
|
|
result.PORTLOAD = head.DEST_PORT_CODE;
|
|
|
|
|
result.GOODSOURCE = head.COUNTRY_CODE_EN;
|
|
|
|
|
|
|
|
|
|
result.CONSIGNEE = head.EXPORT_NAME;//经营单位名称 进口:境内收货人名称 出口:发货人名称
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.ARCOUNTRY = head.COUNTRY_CODE_EN;
|
|
|
|
|
|
|
|
|
|
result.CUSTOMNO = head.CUSTOMS_NO;//报关单号
|
|
|
|
|
|
|
|
|
|
result.CUSTOMDATE = head.DECL_DATE.ToString("yyyy-MM-dd");
|
|
|
|
|
if (result.CUSTOMDATE == "0001-01-01") result.CUSTOMDATE = null;
|
|
|
|
|
|
|
|
|
|
result.INSPECTIONNO = head.CORRELATION_DECL_NO;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.BOOKNO = head.HAND_BOOK_NO;//手册备案号
|
|
|
|
|
|
|
|
|
|
result.CONTRACTNO = head.CONTR_NO;//合同号
|
|
|
|
|
|
|
|
|
|
result.PKGS = string.IsNullOrWhiteSpace(head.TOTAL_PACKEGES) ? 0 : Convert.ToDecimal(head.TOTAL_PACKEGES);
|
|
|
|
|
|
|
|
|
|
result.KGS = string.IsNullOrWhiteSpace(head.TOTAL_GROSS_WEIGHT) ? 0 : Convert.ToDecimal(head.TOTAL_GROSS_WEIGHT);
|
|
|
|
|
result.NETWEIGHT = string.IsNullOrWhiteSpace(head.TOTAL_NET_WEIGHT) ? 0 : Convert.ToDecimal(head.TOTAL_NET_WEIGHT);
|
|
|
|
|
//result.CBM = string.IsNullOrWhiteSpace(head.TOTAL_NET_WEIGHT) ? 0 : Convert.ToDecimal(head.TOTAL_NET_WEIGHT);
|
|
|
|
|
|
|
|
|
|
//result.BYCUSTOM = head.cus;
|
|
|
|
|
result.BSCUSTOMNO = head.RELATIVE_ENTRY_ID;//关联报关单号
|
|
|
|
|
result.TRADETERM = head.TRADE_TYPE_CODE;//贸易方式
|
|
|
|
|
result.CURRENCY = head.CURRENCY_CODE;
|
|
|
|
|
result.CURRENCY = head.CURRENCY_CODE;
|
|
|
|
|
result.CARGOVALUE = head.TOTAL_AMOUNT;
|
|
|
|
|
result.INQUNO = head.CIQ_BILL_NO; //检验检疫号
|
|
|
|
|
result.CUSCIQNO = head.EPROT_NO; //统一编号 电子口岸统一编号
|
|
|
|
|
result.TRANCUSTOMNO = head.TRN_PRE_ID;
|
|
|
|
|
result.EXPCUSTOMTYPE = head.IE_PORT; //出境关别 代码
|
|
|
|
|
|
|
|
|
|
//result.DESPPORT = head.CIQ_ENTY_PORT_CODE;
|
|
|
|
|
|
|
|
|
|
result.CUSTOMSNUM = headinfo.GOODS_LIST.Count();
|
|
|
|
|
|
|
|
|
|
//SR2023012800001
|
|
|
|
|
result.MBLNO = headinfo.BUSINESS_ORDER_INFO.CONSIGN_REMARK;//东盛主提单号------关贸云的委托备注
|
|
|
|
|
result.HBLNO = headinfo.DECL_HEAD.BILL_NO;// 东盛分提单号--------关贸云的订舱/提运单号
|
|
|
|
|
result.ENTERP = head.EXPORT_NAME; //经营单位名称
|
|
|
|
|
result.ENTERPID = head.EXPORT_CODE; //经营单位代码 东盛经营单位-----------关贸云的经营单位,并且需要放在报关界面。
|
|
|
|
|
//东盛委托单位--------关贸云客户名称
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.OP = headinfo.BUSINESS_ORDER_INFO.PROJECT_NO;//操作 2023-1-13
|
|
|
|
|
|
|
|
|
|
returnresult.OK("", result);
|
|
|
|
|
|
|
|
|
|
return returnresult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static List<MsOpApplyDetail> getGoodsDetailListInfo(GuanMaoYun_Head head)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var result = new List<MsOpApplyDetail>();
|
|
|
|
|
|
|
|
|
|
var BSNO = head.BUSINESS_ORDER_INFO.WORK_NO;
|
|
|
|
|
|
|
|
|
|
if (head.GOODS_LIST.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var good in head.GOODS_LIST)
|
|
|
|
|
{
|
|
|
|
|
var newrec = new MsOpApplyDetail();
|
|
|
|
|
var goodinfo = good.DECL_GOODS;
|
|
|
|
|
newrec.BsNo = BSNO;
|
|
|
|
|
newrec.SerialNo = BasicDataRefDAL.String2Decimal(goodinfo.GOODS_SEQ);
|
|
|
|
|
|
|
|
|
|
newrec.GoodsCode = goodinfo.HSCODE_TS;
|
|
|
|
|
newrec.GoodsName = goodinfo.GOODS_NAME;
|
|
|
|
|
newrec.GOODSMODEL = goodinfo.GOODS_MODEL;
|
|
|
|
|
newrec.Pkgs = BasicDataRefDAL.String2Decimal(goodinfo.PACKEGES);
|
|
|
|
|
newrec.GOODSNUM = BasicDataRefDAL.String2Decimal(goodinfo.PACKEGES);
|
|
|
|
|
newrec.KGS = goodinfo.QTY;
|
|
|
|
|
|
|
|
|
|
newrec.Price = BasicDataRefDAL.String2Decimal(goodinfo.PRICE);
|
|
|
|
|
newrec.Total = BasicDataRefDAL.String2Decimal(goodinfo.AMOUNT);
|
|
|
|
|
newrec.Currency = goodinfo.CURRENCY;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Add(newrec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static List<MsOpCtn> getCtnListInfo(GuanMaoYun_Head head)
|
|
|
|
|
{
|
|
|
|
|
var result = new List<MsOpCtn>();
|
|
|
|
|
|
|
|
|
|
var BSNO = head.GetBSNO();
|
|
|
|
|
|
|
|
|
|
if (head.CONTA_LIST != null && head.CONTA_LIST.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var ctn in head.CONTA_LIST)
|
|
|
|
|
{
|
|
|
|
|
var _ctn = ctn.DECL_CONTA;
|
|
|
|
|
var _ctnid = Guid.NewGuid().ToString();
|
|
|
|
|
decimal 皮重 = string.IsNullOrWhiteSpace(_ctn.CONTA_GROSS_WEIGHT) ? 0 : Convert.ToDecimal(_ctn.CONTA_GROSS_WEIGHT);
|
|
|
|
|
decimal 箱货总重 = string.IsNullOrWhiteSpace(_ctn.GOODS_CONTA_WT) ? 0 : Convert.ToDecimal(_ctn.GOODS_CONTA_WT);
|
|
|
|
|
decimal kgs = 箱货总重 - 皮重;
|
|
|
|
|
|
|
|
|
|
var newrec = new MsOpCtn
|
|
|
|
|
{
|
|
|
|
|
CTN_ID = _ctnid,
|
|
|
|
|
GID = _ctnid,
|
|
|
|
|
BSNO = BSNO,
|
|
|
|
|
CTNNUM = 1,
|
|
|
|
|
CNTRNO = _ctn.CONTA_NO,
|
|
|
|
|
CTNALL = _ctn.CONTA_SIZE + _ctn.CONTA_TYPE,
|
|
|
|
|
TAREWEIGHT = 皮重,
|
|
|
|
|
KGS = kgs,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Add(newrec);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static ch_fee_md getFee(GuanMaoYun_Fee FeeHead, COSTS Fee, info_client_md CUSTOMER, ch_fee_md chfee = null)
|
|
|
|
|
{
|
|
|
|
|
//if (chfee == null)
|
|
|
|
|
//{
|
|
|
|
|
// chfee = new ch_fee_md();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string USERID = "1BEC90E1-9780-472F-90C2-0C6390C044A4";
|
|
|
|
|
string BSNO = FeeHead.JOB_ID;
|
|
|
|
|
string CUSTOMERNAME = CUSTOMER.SHORTNAME;
|
|
|
|
|
int FEETYPE = Fee.BALANCE_DIRECTION_ID.ToUpper() == "PAYOUT" ? 2 : 1;
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
|
|
|
|
//string FEENAME = string.IsNullOrWhiteSpace( Fee.FEE_TYPE_NAME)?Fee.MEMO: Fee.FEE_TYPE_NAME;
|
|
|
|
|
string FEENAME = cdc.code_fee_edi.First(x => x.FEEENAME == Fee.FEE_TYPE_CODE).FEENAME;
|
|
|
|
|
|
|
|
|
|
decimal AMOUNT = Fee.AMOUNT == null ? 0 : (decimal)Fee.AMOUNT;
|
|
|
|
|
string UNIT = "";
|
|
|
|
|
decimal QUANTITY = Fee.UNIT_NUMBER == null ? 0 : (decimal)Fee.UNIT_NUMBER;
|
|
|
|
|
|
|
|
|
|
chfee = MsChFeeDAL.getChFee(USERID, BSNO, CUSTOMERNAME, FEETYPE, FEENAME, AMOUNT, UNIT, QUANTITY);
|
|
|
|
|
|
|
|
|
|
chfee.BXGID = "GMY";//用于标记关贸云产生的费用
|
|
|
|
|
//chfee.GID = Fee.SOURCE_JOB_BALANCE_ID;
|
|
|
|
|
//chfee.BSNO = FeeHead.JOB_ID;
|
|
|
|
|
//chfee.FEETYPE = Fee.BALANCE_DIRECTION_ID.ToUpper() == "PAYOUT" ? 2 : 1;
|
|
|
|
|
//chfee.CUSTOMERNAME = CUSTOMER.SHORTNAME;
|
|
|
|
|
|
|
|
|
|
//chfee.CURRENCY = CURRENCYCODE.GetName(string.IsNullOrWhiteSpace( Fee.MONEY_TYPE_ID)?142: Convert.ToInt32(Fee.MONEY_TYPE_ID));
|
|
|
|
|
//chfee.EXCHANGERATE = Fee.EXCHANGE_RATE;
|
|
|
|
|
|
|
|
|
|
//chfee.UNIT = "";
|
|
|
|
|
//chfee.AMOUNT = Fee.AMOUNT;
|
|
|
|
|
//chfee.QUANTITY = Fee.UNIT_NUMBER;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return chfee;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|