|
|
|
@ -46,6 +46,7 @@ using SharpCompress.Common;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
|
using NPOI.OpenXmlFormats;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.ContainerManagement.Info.Method;
|
|
|
|
|
|
|
|
|
@ -844,8 +845,13 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
|
|
|
|
|
// db.Queryable<SysDictType>()
|
|
|
|
|
var 状态变动表head = await db.Queryable<SysDictType>().FirstAsync(x => x.Code == "CM_StateChange_Field");
|
|
|
|
|
|
|
|
|
|
var 字段列表 = await db.Queryable<SysDictData>().Where(x => x.TypeId == 状态变动表head.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var head =await tenantDb.Queryable<CM_State_Change_TemplatImport>().FirstAsync(x => x.Id == req.Id);
|
|
|
|
|
|
|
|
|
|
var 模板明细= await tenantDb.Queryable<CM_State_Change_TemplatDetail>().Where(x => x.Pid == head.TempletId).ToListAsync();
|
|
|
|
|
|
|
|
|
|
var excel文件info = tenantDb.Queryable<OpFile>().FirstAsync(x => x.Id == req.FileId).Result;
|
|
|
|
|
|
|
|
|
|
//正式地址
|
|
|
|
@ -923,40 +929,40 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
Type type = newchange.GetType();
|
|
|
|
|
|
|
|
|
|
var XXDM = "";
|
|
|
|
|
var XXHM = "";
|
|
|
|
|
var XXCM = "";
|
|
|
|
|
var Vessel = "";
|
|
|
|
|
var Voyno = "";
|
|
|
|
|
|
|
|
|
|
foreach (var 字段 in 字段列表)
|
|
|
|
|
foreach (var 字段 in 模板明细)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrWhiteSpace(字段.Value))
|
|
|
|
|
if (string.IsNullOrWhiteSpace(字段.FieldName))
|
|
|
|
|
continue;
|
|
|
|
|
var field = type.GetProperty(字段.Value);
|
|
|
|
|
var field = type.GetProperty(字段.FieldTitle);
|
|
|
|
|
|
|
|
|
|
if (field != null && dt.Columns.Contains(字段.Name))
|
|
|
|
|
if (field != null && dt.Columns.Contains(字段.ColumnTitle))
|
|
|
|
|
{
|
|
|
|
|
var _value = row[字段.Name];
|
|
|
|
|
var _value = row[字段.ColumnTitle];
|
|
|
|
|
field.SetValue(newchange, _value);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (field == null && 字段.Value == "XXDM")
|
|
|
|
|
if (field == null && 字段.FieldTitle == "XXDM")
|
|
|
|
|
{
|
|
|
|
|
XXDM = row[字段.Name].ToString();
|
|
|
|
|
XXDM = row[字段.ColumnTitle].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (field == null && 字段.Value == "XXHM")
|
|
|
|
|
if (field == null && 字段.FieldTitle == "XXCM")
|
|
|
|
|
{
|
|
|
|
|
XXHM = row[字段.Name].ToString();
|
|
|
|
|
XXCM = row[字段.ColumnTitle].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (field == null && 字段.Value == "Vessel")
|
|
|
|
|
if (field == null && 字段.FieldTitle == "Vessel")
|
|
|
|
|
{
|
|
|
|
|
Vessel = row[字段.Name].ToString();
|
|
|
|
|
Vessel = row[字段.ColumnTitle].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (field == null && 字段.Value == "Voyno")
|
|
|
|
|
if (field == null && 字段.FieldTitle == "Voyno")
|
|
|
|
|
{
|
|
|
|
|
Voyno = row[字段.Name].ToString();
|
|
|
|
|
Voyno = row[字段.ColumnTitle].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -967,8 +973,8 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (XXDM != "" && XXHM != "") {
|
|
|
|
|
newchange.Ctnall= XXDM + XXHM;
|
|
|
|
|
if (XXDM != "" && XXCM != "") {
|
|
|
|
|
newchange.Ctnall= XXCM+ XXDM ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Vessel != "" && Voyno != "")
|
|
|
|
@ -980,6 +986,73 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//对于港口类字段 做如下操作:
|
|
|
|
|
|
|
|
|
|
if (changelist != null && changelist.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var portlist = await tenantDb.Queryable<CodePort>().ToListAsync();
|
|
|
|
|
|
|
|
|
|
portinfo getport(string port) {
|
|
|
|
|
var result = new portinfo();
|
|
|
|
|
if (portlist.Exists(x => x.PortName == port || x.EdiCode == port)) {
|
|
|
|
|
var _r = portlist.First(x => x.PortName == port || x.EdiCode == port);
|
|
|
|
|
|
|
|
|
|
result.Portid = _r.Id;
|
|
|
|
|
result.PortName = _r.PortName;
|
|
|
|
|
result.PortCode = _r.EdiCode;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var item in changelist) {
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.Port))
|
|
|
|
|
{
|
|
|
|
|
var _port = getport(item.Port);
|
|
|
|
|
if (string.IsNullOrWhiteSpace(_port.PortName))
|
|
|
|
|
{
|
|
|
|
|
item.Port = _port.PortName;
|
|
|
|
|
item.Portid = _port.Portid;
|
|
|
|
|
item.PortCode = _port.PortCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.PortLoad))
|
|
|
|
|
{
|
|
|
|
|
var _port = getport(item.PortLoad);
|
|
|
|
|
if (string.IsNullOrWhiteSpace(_port.PortName))
|
|
|
|
|
{
|
|
|
|
|
item.PortLoad = _port.PortName;
|
|
|
|
|
item.PortLoadid = _port.Portid;
|
|
|
|
|
item.PortLoadCode = _port.PortCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.PortDelivery))
|
|
|
|
|
{
|
|
|
|
|
var _port = getport(item.PortDelivery);
|
|
|
|
|
if (string.IsNullOrWhiteSpace(_port.PortName))
|
|
|
|
|
{
|
|
|
|
|
item.PortDelivery = _port.PortName;
|
|
|
|
|
item.PortDeliveryid = _port.Portid;
|
|
|
|
|
item.PortDeliveryCode = _port.PortCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(item.PortDischarge))
|
|
|
|
|
{
|
|
|
|
|
var _port = getport(item.PortDischarge);
|
|
|
|
|
if (string.IsNullOrWhiteSpace(_port.PortName))
|
|
|
|
|
{
|
|
|
|
|
item.PortDischarge = _port.PortName;
|
|
|
|
|
item.PortDischargeid = _port.Portid;
|
|
|
|
|
item.PortDischargeCode = _port.PortCode;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (changelist != null && changelist.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
await tenantDb.Deleteable<CM_State_Change_Temp>(x => x.Pid == req.Id).ExecuteCommandAsync();
|
|
|
|
@ -1043,6 +1116,14 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
return _r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class portinfo {
|
|
|
|
|
|
|
|
|
|
public string PortName { get; set; }
|
|
|
|
|
public long Portid { get; set; }
|
|
|
|
|
public string PortCode { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private async Task<DataResult> 通过模板导入子表明细<T,T2>(T ReqItem, T2 InsertItem, CM_DealExcelReq req,bool DoInsert=true) where T : class, new() where T2 : class, new()
|
|
|
|
|
{
|
|
|
|
|
//Type reqtype = ReqItem.GetType();
|
|
|
|
@ -1290,7 +1371,7 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
_pid.SetValue(newchange, req.Id);
|
|
|
|
|
|
|
|
|
|
var XXDM = "";
|
|
|
|
|
var XXHM = "";
|
|
|
|
|
var XXCM = "";
|
|
|
|
|
var Vessel = "";
|
|
|
|
|
var Voyno = "";
|
|
|
|
|
|
|
|
|
@ -1342,9 +1423,9 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
XXDM = row[字段.ColumnTitle].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (field == null && 字段.FieldTitle == "XXHM")
|
|
|
|
|
if (field == null && 字段.FieldTitle == "XXCM")
|
|
|
|
|
{
|
|
|
|
|
XXHM = row[字段.ColumnTitle].ToString();
|
|
|
|
|
XXCM = row[字段.ColumnTitle].ToString();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (field == null && 字段.FieldTitle == "Vessel")
|
|
|
|
@ -1363,11 +1444,11 @@ public class CM_State_Change_TemplatImportService : CMServiceBase, ICM_State_Cha
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (XXDM != "" && XXHM != "")
|
|
|
|
|
if (XXDM != "" && XXCM != "")
|
|
|
|
|
{
|
|
|
|
|
var field = reqtype.GetProperty("Ctnall");
|
|
|
|
|
if(field!=null)
|
|
|
|
|
field.SetValue(newchange, XXDM+ XXHM);
|
|
|
|
|
field.SetValue(newchange, XXCM+XXDM );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Vessel != "" && Voyno != "")
|
|
|
|
|