/// <summary> /// 第三种情况 成功处理,无箱主 /// </summary> public string DealSuccessWithoutLinecode() { StringBuilder sb = new StringBuilder(); //查找所有班轮分发规则 int i = 0; using (DataSet1.T_OCRX_VESSELDataTable rules = cctdbDAL.SelectVessel()) { if (rules == null || rules.Count == 0) { return(""); } //查找待分发的识别记录 using (OCR.Model.OcrCnt.T_OCR_CNTDataTable data = cctdbDAL.SelectDispatch3()) { foreach (OCR.Model.OcrCnt.T_OCR_CNTRow row in data) { try { //查找匹配外理 string companyCode = GetCompanyCode(row.SERVICECODE, row.containerowner, rules); if (!string.IsNullOrEmpty(companyCode)) { DataSet1.T_OCRX_CNTRow newRow = CopyRow(row); newRow.COMPANYCODE = companyCode; //插入新分发记录 cctdbDAL.InsertCntx(newRow); //更新分发状态 cctdbDAL.UpdateDispatched(row.DOCK_ID, row.containerowner, companyCode); i++; //sb.AppendLine(string.Format("数据分发 {0} {1}", row.TRVAL_NO, newRow.CONTAINER_NO)); } } catch { } } } } if (i > 0) { sb.AppendFormat("数据分发 {0}条记录", i); } return(sb.ToString()); }
/// <summary> /// 第一种情况 内理不作业,外理作业 SCT港区 /// </summary> public string DealExOnlySCT() { StringBuilder sb = new StringBuilder(); int i = 0; jobBLL bll = new jobBLL(); //查找待分发的识别记录 //如果有箱号,调CTOS接口,找出对应的船名航次 //如果无箱号,或者箱号无效,根据QC设置表的船对应的船东分发 using (OCR.Model.OcrCnt.T_OCR_CNTDataTable data = cctdbDAL.SelectDispatch()) { using (DataSet1.T_OCRX_VESSELDataTable rules = cctdbDAL.SelectVessel()) { foreach (OCR.Model.OcrCnt.T_OCR_CNTRow row in data) { try { QcSet.T_OCR_QCSETRow qc = bll.SelectQCSet(row.TRVAL_NO); if (row.CONTAINER_NO == "未识别" && string.IsNullOrEmpty(row.RCONTAINER_NO)) { //该模式分班轮和驳船 if (row.IsENAMNull() || string.IsNullOrEmpty(row.ENAM) || row.ENAM.StartsWith("8")) { //找到船名航次,分发给外理 row.ENAM = qc.VESSELALIASE; //查对应的驳船公司 OCRX.Model.DataSet1.T_OCRX_BARGERow bg = cctdbDAL.SelectBargeByVelaliase(row.ENAM); if (row.SERVICECODE == "DOM") { row.ISARCHIVED = "Y"; } else if (bg != null) { row.COMPANYCODE = bg.COMPANYCODE; row.SHIP_CODE = qc.SHIP_CODE; row.C_VOYAGE = row.DOCK_STATUS == 0 ? qc.OUT_VOYAGE_CODE : qc.IN_VOYAGE_CODE; //row.LINECODE = cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["CONTAINEROWNER"].ToString(); row.ISARCHIVED = "Y"; //row.OPERATORNAME = Config.SysUser; row.CONTAINERID = 0; bll.UpdateCntStatus(row); DataSet1.T_OCRX_CNTRow newRow = CopyRow(row); //插入新分发记录 cctdbDAL.InsertCntx(newRow); //更新分发状态 cctdbDAL.UpdateDispatched(row.DOCK_ID, string.Empty, row.COMPANYCODE); continue; } else { //无外理认领,归档 row.ISARCHIVED = "Y"; } } else { //班轮 是否有箱主,无则等待 string lineCode = qc.OWNER; if (String.IsNullOrEmpty(lineCode)) { //row.CSTATUS = Convert.ToDecimal(Config.CStatus.WaitHandle);//转人工 row.ISARCHIVED = "N"; } else { //查找匹配外理 string companyCode = GetCompanyCode(row.SERVICECODE, lineCode, rules); if (!string.IsNullOrEmpty(companyCode)) { DataSet1.T_OCRX_CNTRow newRow = CopyRow(row); newRow.COMPANYCODE = companyCode; //插入新分发记录 cctdbDAL.InsertCntx(newRow); //更新分发状态 cctdbDAL.UpdateDispatched(row.DOCK_ID, row.LINECODE, companyCode); i++; continue; //sb.AppendLine(string.Format("数据分发 {0} {1}", row.TRVAL_NO, newRow.CONTAINER_NO)); } else { //无外理认领,归档 row.ISARCHIVED = "Y"; } } } } else { //查箱信息 CtosResult cntInfo = CtosAPIBLL.CM005001(string.IsNullOrEmpty(row.RCONTAINER_NO) ? row.CONTAINER_NO : row.RCONTAINER_NO, qc.TICKET_ID); if (cntInfo.ERRORCODE != CtosAPIBLL.SUCCESSCODE || cntInfo.DS.Tables[0].Rows.Count == 0) { //班轮 是否有箱主,无则等待 string lineCode = qc.OWNER; //查找匹配外理 string companyCode = GetCompanyCode(row.SERVICECODE, lineCode, rules); row.LINECODE = lineCode; if (!string.IsNullOrEmpty(companyCode)) { DataSet1.T_OCRX_CNTRow newRow = CopyRow(row); newRow.COMPANYCODE = companyCode; //插入新分发记录 cctdbDAL.InsertCntx(newRow); //更新分发状态 cctdbDAL.UpdateDispatched(row.DOCK_ID, row.LINECODE, companyCode); i++; continue; //sb.AppendLine(string.Format("数据分发 {0} {1}", row.TRVAL_NO, newRow.CONTAINER_NO)); } else { //无外理认领,归档 row.ISARCHIVED = "Y"; } } else { //该模式分班轮和驳船 if (row.IsENAMNull() || string.IsNullOrEmpty(row.ENAM) || row.ENAM.StartsWith("8")) { //找到船名航次,分发给外理 row.ENAM = row.DOCK_STATUS == 0 ? cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["OUTVELALIASE"].ToString() : cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["INVELALIASE"].ToString(); //查对应的驳船公司 OCRX.Model.DataSet1.T_OCRX_BARGERow bg = cctdbDAL.SelectBargeByVelaliase(row.ENAM); if (row.SERVICECODE == "DOM") { row.ISARCHIVED = "Y"; } else if (bg != null) { row.COMPANYCODE = bg.COMPANYCODE; row.SHIP_CODE = row.DOCK_STATUS == 0 ? cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["OUTEVESSELNAME"].ToString() : cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["INEVESSELNAME"].ToString(); row.C_VOYAGE = row.DOCK_STATUS == 0 ? cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["OUTBOUNDVOY"].ToString() : cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["INBOUNDVOY"].ToString(); row.LINECODE = cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["CONTAINEROWNER"].ToString(); row.ISARCHIVED = "Y"; //row.OPERATORNAME = Config.SysUser; row.CONTAINERID = 0; bll.UpdateCntStatus(row); DataSet1.T_OCRX_CNTRow newRow = CopyRow(row); //插入新分发记录 cctdbDAL.InsertCntx(newRow); //更新分发状态 cctdbDAL.UpdateDispatched(row.DOCK_ID, string.Empty, row.COMPANYCODE); continue; } else { //无外理认领,归档 row.ISARCHIVED = "Y"; } } else { //班轮 是否有箱主,无则等待 string lineCode = cntInfo.DS.Tables["CM_CONTAINERS"].Rows[0]["CONTAINEROWNER"].ToString(); if (String.IsNullOrEmpty(lineCode)) { //row.CSTATUS = Convert.ToDecimal(Config.CStatus.WaitHandle);//转人工 //row.ISARCHIVED = "N"; lineCode = qc.OWNER; } //else //{ //查找匹配外理 string companyCode = GetCompanyCode(row.SERVICECODE, lineCode, rules); row.LINECODE = lineCode; if (!string.IsNullOrEmpty(companyCode)) { DataSet1.T_OCRX_CNTRow newRow = CopyRow(row); newRow.COMPANYCODE = companyCode; //插入新分发记录 cctdbDAL.InsertCntx(newRow); //更新分发状态 cctdbDAL.UpdateDispatched(row.DOCK_ID, row.LINECODE, companyCode); i++; continue; //sb.AppendLine(string.Format("数据分发 {0} {1}", row.TRVAL_NO, newRow.CONTAINER_NO)); } else { //无外理认领,归档 row.ISARCHIVED = "Y"; } //} } } } row.CONTAINERID = 0; bll.UpdateCntStatus(row); //DataSet1.T_OCRX_CNTRow newRow = CopyRow(row); ////newRow.COMPANYCODE = companyCode; ////插入新分发记录 //cctdbDAL.InsertCntx(newRow); ////更新分发状态 //cctdbDAL.UpdateDispatched(row.DOCK_ID, string.Empty, row.COMPANYCODE); //i++; //sb.AppendLine(string.Format("数据分发 {0} {1}", row.TRVAL_NO, newRow.CONTAINER_NO)); } catch (Exception ex) { sb.Append(ex.StackTrace); } } } } if (i > 0) { sb.AppendFormat("数据分发 {0}条记录", i); } return(sb.ToString()); }