/// <summary> /// 倒箱作业校验 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string Moved_CheckWork(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql = string.Empty; //出口装箱,判断前后贝 string pos1 = Convert.ToString((Convert.ToInt16(tallyE.StrBay_No.Substring(0, 2)) - 1)).PadLeft(2, '0') + tallyE.StrBay_No.Substring(2).PadLeft(4, '0'); string pos2 = Convert.ToString((Convert.ToInt16(tallyE.StrBay_No.Substring(0, 2)) + 1)).PadLeft(2, '0') + tallyE.StrBay_No.Substring(2).PadLeft(4, '0'); strSql = string.Format(@"select container_no, bayno from VCON_IMAGE_PDA where old_id='{0}' and bayno in ('{1}','{2}','{3}') and unload_mark='1' ", tallyE.StrShip_Id, tallyE.StrBay_No, pos1, pos2); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("作业校验异常:" + strErr); return Result.Failure("作业校验异常:" + strErr); } if (dt.Rows.Count > 0) { string strMsg = Convert.ToString(dt.Rows[0]["container_no"]) + "已装船!" + Convert.ToString(dt.Rows[0]["bayno"]); strMsg += ",请注意调整"; log.LogCatalogSuccess(strMsg); return Result.Success(null, strMsg); } return null; }
/// <summary> /// 查找匹配箱号列表 /// </summary> /// <param name="strShip_Id">航次ID</param> /// <param name="strContainer_No">查询箱号</param> /// <returns>结果</returns> public string FindMatchedContainerNoList(string strShip_Id, string strContainer_No) { //错误提示 string strErr = string.Empty; string strSql = string.Format(@"select distinct container_no from CON_IMAGE where ship_id='{0}' and container_no like '%{1}'", strShip_Id, strContainer_No); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (dt.Rows.Count <= 0) { log.LogCatalogSuccess("无匹配箱号数据"); return(Result.Success(null, null)); } string[] strArray = new string[dt.Rows.Count]; for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { strArray[iRow] = Convert.ToString(dt.Rows[iRow]["container_no"]); } log.LogCatalogSuccess(); return(Result.Success(strArray, null)); }
/// <summary> /// 倒箱更新配载指令 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string Moved_UpdateInstruction(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql = string.Empty; if (tallyE.StrInOutType.Equals("I")) { strSql = string.Format(@"update TB_CON_INSTRUCTION set complete_mark='1', bayno='{5}',truck_no='{2}',tally_mark='{3}',updatetime='{6}' where ship_id='{0}' and ctn_no='{1}' and loadUnload_Mark='{4}' and reLoad_mark='1' ", tallyE.StrShip_Id, tallyE.StrContainer_No, tallyE.StrTruck_No, tallyE.StrWork_No, "0", tallyE.StrBay_No, tallyE.StrTime); } else { strSql = string.Format(@"update TB_CON_INSTRUCTION set complete_mark = '1', bayno = '{2}', tally_mark = '{3}', updatetime = '{5}' where ship_id = '{0}' and ctn_no = '{1}' and loadUnload_mark = '{4}' and reLoad_mark = '1' ", tallyE.StrShip_Id, tallyE.StrContainer_No, tallyE.StrBay_No, tallyE.StrWork_No, "1", tallyE.StrTime); } Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("倒箱更新配载指令:" + strErr); return Rollback(tallyE); //return Result.Failure("倒箱更新配载指令:" + strErr); } return null; }
/// <summary> /// 同步舱单 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string UpdateHatch(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql = string.Empty; if (tallyE.StrInOutType.Equals("E")) { strSql = string.Format(@"update CON_HATCH_RECORD set unload_mark = '1',bayno='{0}',user_code='{1}' where ship_id='{2}' and container_no='{3}'", tallyE.StrBay_No, tallyE.StrWork_No, tallyE.StrNewShip_Id, tallyE.StrContainer_No); } else { strSql = string.Format(@"update CON_HATCH_RECORD set unload_mark = '1',user_code='{0}' where ship_id='{1}' and container_no='{2}'", tallyE.StrWork_No, tallyE.StrNewShip_Id, tallyE.StrContainer_No); } Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步舱单异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步舱单异常:" + strErr); } return null; }
/// <summary> /// 理箱回滚 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string Rollback(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql = string.Empty; try { strSql = string.Format(@"update CON_HATCH_RECORD set unload_mark='0' where ship_id='{0}' and container_no='{1}' and unload_mark='1'", tallyE.StrNewShip_Id, tallyE.StrContainer_No); Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("理箱回滚(舱单)异常:" + strErr); return Result.Failure("理箱回滚(舱单)异常:" + strErr); } strSql = string.Format(@"update CON_IMAGE set unload_mark='0',work_no=null,editbaymark='0' where ship_id='{0}' and container_no='{1}' and unload_mark='1'", tallyE.StrNewShip_Id, tallyE.StrContainer_No); Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("理箱回滚(船图)异常:" + strErr); return Result.Failure("理箱回滚(船图)异常:" + strErr); } strSql = string.Format(@"delete from CON_TALLY_DETAIL where ship_id='{0}' and container_no='{1}'", tallyE.StrNewShip_Id, tallyE.StrContainer_No); Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("理箱回滚(理箱单子表)异常:" + strErr); return Result.Failure("理箱回滚(理箱单子表)异常:" + strErr); } log.LogCatalogSuccess("rollback_ok"); return Result.Success(null, null); } catch (Exception ex) { log.strWorkType = "rollback_ec"; log.LogCatalogFailure("异常:" + ex.Message); return Result.Failure("异常:" + ex.Message); } }
/// <summary> /// 出口调贝 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string MoveBay(TallyE tallyE) { //错误提示 string strErr = string.Empty; //返回数据对象 string strJson = null; log.LogCatalogSuccess(); try { //作业校验 strJson = new Pub(log).Moved_CheckWork(tallyE); if (!string.IsNullOrWhiteSpace(strJson)) { return(strJson); } //如果新贝位目前存在箱号,则与当前箱所在贝位调换 string strSql = "update CON_IMAGE set BayNo=nvl((select Max(BayNo) BayNo from con_image where SHIP_ID=" + tallyE.StrNewShip_Id + " and CONTAINER_NO ='" + tallyE.StrContainer_No + "'),'" + tallyE.StrBay_No + "')" + " where SHIP_ID=" + tallyE.StrNewShip_Id + " and BayNO='" + tallyE.StrBay_No + "' and CONTAINER_NO !='" + tallyE.StrContainer_No + "'"; Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("出口调贝异常:" + strErr); return(Result.Failure("出口调贝异常:" + strErr)); } strSql = "update CON_IMAGE set WORK_NO='" + tallyE.StrWork_No + "',USER_NAME='" + tallyE.StrWork_No + "',BAYNO='" + tallyE.StrBay_No + "' where SHIP_ID='" + tallyE.StrNewShip_Id + "' and CONTAINER_NO='" + tallyE.StrContainer_No + "'"; Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("出口调贝异常:" + strErr); return(Result.Failure("出口调贝异常:" + strErr)); } log.LogCatalogSuccess("chgbay_ok"); return(Result.Success(null, null)); } catch (Exception ex) { log.strWorkType = "chgbay_ec"; log.LogCatalogFailure("异常:" + ex.Message); return(Result.Failure("异常:" + ex.Message)); } }
/// <summary> /// 下载贝位规范 /// </summary> /// <param name="strV_Id">航次ID</param> /// <returns>结果</returns> public string DownloadBayStandard(string strV_Id) { //错误提示 string strErr = string.Empty; string strSql = string.Format(@"select v_id,eng_vessel,chi_vessel,location,screen_row,screen_col,bay_num,bay_row,bay_col,occupy,user_char from CODE_CON_MAP where v_id={0}", strV_Id); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (dt.Rows.Count <= 0) { log.LogCatalogSuccess("无贝位规范数据"); return(Result.Success(null, null)); } string[,] strArray = new string[dt.Rows.Count, 11]; for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { strArray[iRow, 0] = Convert.ToString(dt.Rows[iRow]["v_id"]); strArray[iRow, 1] = Convert.ToString(dt.Rows[iRow]["eng_vessel"]); strArray[iRow, 2] = Convert.ToString(dt.Rows[iRow]["chi_vessel"]); strArray[iRow, 3] = Convert.ToString(dt.Rows[iRow]["location"]); strArray[iRow, 4] = Convert.ToString(dt.Rows[iRow]["screen_row"]); strArray[iRow, 5] = Convert.ToString(dt.Rows[iRow]["screen_col"]); strArray[iRow, 6] = Convert.ToString(dt.Rows[iRow]["bay_num"]); strArray[iRow, 7] = Convert.ToString(dt.Rows[iRow]["bay_row"]); strArray[iRow, 8] = Convert.ToString(dt.Rows[iRow]["bay_col"]); strArray[iRow, 9] = Convert.ToString(dt.Rows[iRow]["occupy"]); strArray[iRow, 10] = Convert.ToString(dt.Rows[iRow]["user_char"]); } log.LogCatalogSuccess(); return(Result.Success(strArray, null)); }
/// <summary> /// 倒箱同步船图 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string Moved_UpdateImage(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSplit = string.Empty; if (tallyE.StrMovedMark.Equals("1")) { strSplit = "moved='1',"; } else if (tallyE.StrMovedMark.Equals("2")) { strSplit = "bayno='" + tallyE.StrBay_No + "',"; string strSql = string.Format(@"update CON_IMAGE set oldbayno=bayno,moved='1' where ship_id='{0}' and bayno='{1}'", tallyE.StrNewShip_Id, tallyE.StrBay_No); Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("倒箱同步船图异常:" + strErr); return Rollback(tallyE); //return Result.Failure("倒箱同步船图异常:" + strErr); } } string sqlUpdate = string.Empty; //智能识别自动理货处理 if (tallyE.StrWork_No.Substring(0, 1) == "P" || tallyE.StrWork_No.Substring(0, 1) == "X") sqlUpdate = "update CON_IMAGE set UNLOAD_MARK='1'," + strSplit + "WORK_NO='A',WORK_NO='9999',CODE_CRANE='" + tallyE.StrWork_No + "',USER_CODE='" + tallyE.StrWork_No + "',USER_NAME='" + tallyE.StrWork_No + "',WORK_DATE=TO_DATE('" + tallyE.StrTime + "','YYYY-MM-DD HH24:MI:SS') where SHIP_ID='" + tallyE.StrNewShip_Id + "' and CONTAINER_NO='" + tallyE.StrContainer_No + "'"; else sqlUpdate = "update CON_IMAGE set UNLOAD_MARK='1'," + strSplit + "WORK_NO='" + tallyE.StrWork_No + "',USER_CODE='" + tallyE.StrWork_No + "',USER_NAME='" + tallyE.StrWork_No + "',WORK_DATE=TO_DATE('" + tallyE.StrTime + "','YYYY-MM-DD HH24:MI:SS') where SHIP_ID='" + tallyE.StrNewShip_Id + "' and CONTAINER_NO='" + tallyE.StrContainer_No + "'"; Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(sqlUpdate, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("倒箱同步船图异常:" + strErr); return Rollback(tallyE); //return Result.Failure("倒箱同步船图异常:" + strErr); } return null; }
/// <summary> /// 获取个人作业进度 /// </summary> /// <param name="strShip_Id">航次ID</param> /// <param name="strInOutType">进出口类型</param> /// <param name="strWork_No">工号</param> /// <returns>结果</returns> public string GetWorkProgress_Perssonal(string strShip_Id, string strInOutType, string strWork_No) { //错误提示 string strErr = string.Empty; string strSql = string.Empty; strSql = string.Format(@"select Max(NAME) NAME,SIZE_CON,FULLOREMPTY,Count(*) CON_TOLTAL,Sum(UNLOAD_MARK) CON_TALLY,Sum(YB) CON_YB,Sum(JJR) CON_JJR from vcon_image_pda_stat where Old_ID='{0}' and PORT like '%LYG' and WORK_NO='{1}' group by SIZE_CON,FULLOREMPTY order by SIZE_CON,FULLOREMPTY", strShip_Id, strWork_No); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (dt.Rows.Count <= 0) { log.LogCatalogFailure("无作业数据"); return(Result.Failure(null)); } string[,] strArray = new string[dt.Rows.Count, 7]; for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { strArray[iRow, 0] = Convert.ToString(dt.Rows[iRow]["NAME"]); strArray[iRow, 1] = Convert.ToString(dt.Rows[iRow]["SIZE_CON"]); strArray[iRow, 2] = Convert.ToString(dt.Rows[iRow]["FULLOREMPTY"]); strArray[iRow, 3] = Convert.ToString(dt.Rows[iRow]["CON_TOLTAL"]); strArray[iRow, 4] = Convert.ToString(dt.Rows[iRow]["CON_TALLY"]); strArray[iRow, 5] = Convert.ToString(dt.Rows[iRow]["CON_YB"]); strArray[iRow, 6] = Convert.ToString(dt.Rows[iRow]["FULLOREMPTY"]); } log.LogCatalogSuccess(); return(Result.Success(strArray, null)); }
/// <summary> /// 调用指令发送至码头 /// </summary> /// <param name="tallyE"></param> /// <returns>结果</returns> private string Con_Instruction(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql = string.Empty; string strInfo = string.Empty; var dt = new DataTable(); string strLoaddir = tallyE.StrInOutType.Equals("I") == true ? "0" : "1"; try { strSql = string.Format(@"select * from TB_CON_INSTRUCTION where ship_id='{0}' and ctn_no='{1}' and loadunload_mark='{2}'", tallyE.StrShip_Id, tallyE.StrContainer_No, strLoaddir); dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (dt.Rows.Count > 0) { if (tallyE.StrInOutType.Equals("I")) { return Con_Instruction_InPort(tallyE, dt); } else { return Con_Instruction_OutPort(tallyE, dt); } } } catch (Exception ex) { //回滚 log.strWorkType = "con_instruction_ec"; log.strBay_No = Convert.ToString(dt.Rows[0]["bayno"]); log.strTruck_No = Convert.ToString(dt.Rows[0]["truck_no"]); log.LogCatalogFailure("异常:" + ex.Message + "; " + strInfo); if (tallyE.StrInOutType.Equals("I")) { oracle_find_cntr_plac_try_rollback(Convert.ToString(dt.Rows[0]["ctn_no]));
/// <summary> /// 倒箱生成理货单编号 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string Moved_GenerateTallyNum(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql = string.Format(@"select max(no) from CON_TALLY_LIST where ship_id='{0}' and team_no='{1}' and tally_clerk1='{2}' and inout_mark='0' and reload='0' ", tallyE.StrNewShip_Id, tallyE.StrTeam_No, tallyE.StrWork_No); string strTemp = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_String(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("倒箱生成理货单编号:" + strErr); return Rollback(tallyE); //return Result.Failure("倒箱生成理货单编号:" + strErr); } if (strTemp.Length == 0) tallyE.StrBhno = "dx" + tallyE.StrWork_No + tallyE.StrTeam_No + "0001"; else tallyE.StrBhno = strTemp.Substring(0, 10) + Convert.ToString(Convert.ToInt64(strTemp.Substring(10)) + 1).PadLeft(4, '0'); return null; }
/// <summary> /// 下载车号 /// </summary> /// <returns>结果</returns> public string DownloadTruckNo() { //错误提示 string strErr = string.Empty; //注:要完善数据库表,添加车队编码和车队名称,只获取新东方和PSA的车队即可 string strSql = string.Format(@"select code_jzx,code_hik,code_pda,truck,c_team,n_team from CODE_TRUCK_JZX"); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (dt.Rows.Count <= 0) { log.LogCatalogSuccess("无车号数据"); return(Result.Success(null, null)); } string[,] strArray = new string[dt.Rows.Count, 6]; for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { strArray[iRow, 0] = Convert.ToString(dt.Rows[iRow]["code_jzx"]); strArray[iRow, 1] = Convert.ToString(dt.Rows[iRow]["code_hik"]); strArray[iRow, 2] = Convert.ToString(dt.Rows[iRow]["code_pda"]); strArray[iRow, 3] = Convert.ToString(dt.Rows[iRow]["truck"]); strArray[iRow, 4] = Convert.ToString(dt.Rows[iRow]["c_team"]); strArray[iRow, 5] = Convert.ToString(dt.Rows[iRow]["n_team"]); } log.LogCatalogSuccess(); return(Result.Success(strArray, null)); }
/// <summary> /// 发送指令 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string SendInstruction(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql = string.Empty; strSql = string.Format(@"select active_id from TB_CON_INSTRUCTION where ship_id='{0}' and ctn_no='{1}' and loadunload_mark='{2}'", tallyE.StrShip_Id, tallyE.StrContainer_No); string strActive_id = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_String(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return Result.Failure("异常:" + strErr); } if (strActive_id.Equals("2")) { log.LogCatalogSuccess("xdf_over:中控已确认指令"); return Result.Success(null, "xdf_over:中控已确认指令"); } else { string strInfo = Con_Instruction(tallyE); if (strInfo.Equals("1")) { log.LogCatalogSuccess("xdf_ok"); return Result.Success(null, "xdf_ok"); } else { log.LogCatalogSuccess("xdf_err: " + strInfo); return Result.Success(null, "xdf_err: " + strInfo); } } }
/// <summary> /// 获取同班人员 /// </summary> /// <param name="strShip_Id">航次ID</param> /// <param name="strNight_Mark">夜班标志</param> /// <returns>结果</returns> public string GetWorkerOfSameClass(string strShip_Id, string strNight_Mark) { //错误提示 string strErr = string.Empty; string strSql = string.Format(@"", strShip_Id, strNight_Mark); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (dt.Rows.Count <= 0) { log.LogCatalogFailure("无同班人员数据"); return(Result.Failure(null)); } string[,] strArray = new string[dt.Rows.Count, 6]; for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { strArray[iRow, 0] = Convert.ToString(dt.Rows[iRow]["SIZE_CON"]); strArray[iRow, 1] = Convert.ToString(dt.Rows[iRow]["FULLOREMPTY"]); strArray[iRow, 2] = Convert.ToString(dt.Rows[iRow]["CON_TOLTAL"]); strArray[iRow, 3] = Convert.ToString(dt.Rows[iRow]["CON_TALLY"]); strArray[iRow, 4] = Convert.ToString(dt.Rows[iRow]["CON_YB"]); strArray[iRow, 5] = Convert.ToString(dt.Rows[iRow]["FULLOREMPTY"]); } log.LogCatalogSuccess(); return(Result.Success(strArray, null)); }
/// <summary> /// 同步理箱单主子表 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string UpdateTallyList(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSqlGetConList = "select * from CON_TALLY_LIST where 1=0"; string sqlGetConDetail = "select * from CON_TALLY_DETAIL where 1=0"; string sqlGetConListNewID = "Select SQ_CON_TALLY_LIST_ID.Nextval NEWID from dual"; var dt_conList = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSqlGetConList, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步理箱单主子表异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步理箱单主子表异常:" + strErr); } var dt_conDetail = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(sqlGetConDetail, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步理箱单主子表异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步理箱单主子表异常:" + strErr); } string strConListNewID = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_String(sqlGetConListNewID, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步理箱单主子表异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步理箱单主子表异常:" + strErr); } //理箱单主表 DataRow drRow; drRow = dt_conList.NewRow(); drRow["ID"] = strConListNewID; drRow["SHIP_ID"] = tallyE.StrNewShip_Id; drRow["TEAM_NO"] = tallyE.StrTeam_No; drRow["NO"] = tallyE.StrBhno; drRow["WORKDATE"] = tallyE.StrTime; drRow["TIMEFROM"] = tallyE.StrEndTime; drRow["TIMETO"] = tallyE.StrEndTime; drRow["BERTHNO"] = tallyE.StrBerth_No; drRow["NIGHT_MARK"] = tallyE.StrNight_Mark; drRow["HOLIDAY"] = tallyE.StrHoliady_Mark; drRow["INOUT_MARK"] = "0"; drRow["RELOAD"] = "0"; if (tallyE.StrMovedMark.Equals("1")) { drRow["INOUT_MARK"] = "1"; } else if (tallyE.StrMovedMark.Equals("2")) { drRow["RELOAD"] = "1"; } drRow["TALLY_CLERK1"] = tallyE.StrWork_No; drRow["USER_NAME"] = tallyE.StrWork_No; dt_conList.Rows.Add(drRow); //子表 drRow = dt_conList.NewRow(); drRow["LIST_ID"] = strConListNewID; drRow["SHIP_ID"] = tallyE.StrNewShip_Id; drRow["CONTAINER_NO"] = tallyE.StrContainer_No; drRow["BAYNO"] = tallyE.StrBay_No; drRow["UNLOAD_MARK"] = "1"; string strSql = string.Format(@"select * from CON_IMAGE where ship_id='{0}' and container_no='{1}'", tallyE.StrNewShip_Id, tallyE.StrContainer_No); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步理箱单主子表异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步理箱单主子表异常:" + strErr); } if (dt.Rows.Count > 0) { drRow["SIZE_CON"] = dt.Rows[0]["SIZE_CON"]; drRow["CODE_EMPTY"] = dt.Rows[0]["FULLOREMPTY"]; string strWeight = string.Empty; if (tallyE.StrMovedMark.Equals("1") || tallyE.StrMovedMark.Equals("2")) { strWeight = dt.Rows[0]["WEIGHT"].ToString(); } else { strWeight = dt.Rows[0]["GROSSWEIGHT"].ToString(); ; } if (strWeight.Length > 0) drRow["WEIGHT"] = decimal.Parse(strWeight) / 1000; else drRow["WEIGHT"] = DBNull.Value; } dt_conDetail.Rows.Add(drRow); Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).UpdateTable(dt_conList, strSqlGetConList, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步理箱单主子表异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步理箱单主子表异常:" + strErr); } Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).UpdateTable(dt_conDetail, sqlGetConDetail, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步理箱单主子表异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步理箱单主子表异常:" + strErr); } return null; }
/// <summary> /// 获取理箱信息 /// </summary> /// <param name="strShip_Id">航次ID</param> /// <param name="strContainer_No">箱号</param> /// <param name="strWorkType">作业类型——0普通,1出舱,2重装,3调贝,4甩箱</param> /// <param name="strBLInstruction">指令标志</param> /// <returns>结果</returns> public string GetContainerInfo(string strShip_Id, string strContainer_No, string strWorkType, string strBLInstruction) { //错误提示 string strErr = string.Empty; //卸箱标志 string strUnloadMark = "1"; if (strWorkType.Equals("0") || strWorkType.Equals("1") || strWorkType.Equals("2")) { strUnloadMark = "0"; } //查询船图箱信息 string strSql_image = string.Format(@"select bayno,sealno,moved,code_unload_port,code_load_port,size_con,container_type,fullorempty from CON_IMAGE where ship_id='{0}' and container_no ='{1}' and unload_mark='{2}'", strShip_Id, strContainer_No, strUnloadMark); var dt_image = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql_image, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (dt_image.Rows.Count <= 0) { log.LogCatalogFailure("无理箱信息"); return(Result.Failure(null)); } string[] strArray = new string[8]; strArray[0] = Convert.ToString(dt_image.Rows[0]["bayno"]); strArray[1] = Convert.ToString(dt_image.Rows[0]["sealno"]); strArray[2] = Convert.ToString(dt_image.Rows[0]["moved"]); strArray[3] = Convert.ToString(dt_image.Rows[0]["code_unload_port"]); strArray[4] = Convert.ToString(dt_image.Rows[0]["code_load_port"]); strArray[5] = Convert.ToString(dt_image.Rows[0]["size_con"]); strArray[6] = Convert.ToString(dt_image.Rows[0]["container_type"]); strArray[7] = Convert.ToString(dt_image.Rows[0]["fullorempty"]); //指令校验 if (strBLInstruction.Equals("1") && strUnloadMark.Equals("0")) { string strSql_Instruction = string.Format(@"select ctn_no from TB_CON_INSTRUCTION where ship_id='{0}' and ctn_no ='{1}'", strShip_Id, strContainer_No); //需要在Oracle里新建指令表——查询指令升级需求 //string strCtn_no = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_String(strSql_Instruction, out strErr); string strCtn_no = SqlServer.DataAccess(RegistryKey.KeyPath_SqlServer_Tally).ExecuteQuery_String(strSql_Instruction, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (string.IsNullOrWhiteSpace(strCtn_no)) { log.LogCatalogSuccess("此箱无指令"); return(Result.Success(strArray, "此箱无指令")); } } log.LogCatalogSuccess(); return(Result.Success(strArray, null)); }
/// <summary> /// 下载船图 /// </summary> /// <param name="strShip_Id">航次ID</param> /// <param name="strBay_No">贝号</param> /// <returns>结果</returns> public string DownloadImageOfBay(string strShip_Id, string strBay_No) { //错误提示 string strErr = string.Empty; string strSql = string.Format(@"select SHIP_ID, CONTAINER_NO,CONTAINER_TYPE,SIZE_CON, FULLOREMPTY,SIZE_CON || CONTAINER_TYPE || '/' || FULLOREMPTY CONTYPE,BAYNO,BAYNO POS, SubStr(BAYNO,1,2) BAY,SubStr(BAYNO,3,2) BAYCOL,SubStr(BAYNO,5,2) BAYROW,SEALNO,BLNO,OLDBAYNO,AMOUNT,GROSSWEIGHT,GROSSWEIGHT/1000 WEIGHT, VOLUME,CODE_LOAD_PORT,CODE_UNLOAD_PORT,TPMARK,EDITBAYMARK,MOVED,PASS_MARK,SHORT_UNLOAD,UNLOAD_MARK,WORK_NO,WORK_DATE,CODE_CON_COMPANY,USER_NAME,OPER_TIME from CON_IMAGE where SHIP_ID='{0}' and SubStr(BAYNO,1,2)='{1}'", strShip_Id, strBay_No); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("异常:" + strErr); return(Result.Failure("异常:" + strErr)); } if (dt.Rows.Count <= 0) { log.LogCatalogSuccess("无船图数据"); return(Result.Success(null, null)); } string[,] strArray = new string[dt.Rows.Count, 31]; for (int iRow = 0; iRow < dt.Rows.Count; iRow++) { strArray[iRow, 0] = Convert.ToString(dt.Rows[iRow]["SHIP_ID"]); strArray[iRow, 1] = Convert.ToString(dt.Rows[iRow]["CONTAINER_NO"]); strArray[iRow, 2] = Convert.ToString(dt.Rows[iRow]["CONTAINER_TYPE"]); strArray[iRow, 3] = Convert.ToString(dt.Rows[iRow]["SIZE_CON"]); strArray[iRow, 4] = Convert.ToString(dt.Rows[iRow]["FULLOREMPTY"]); strArray[iRow, 5] = Convert.ToString(dt.Rows[iRow]["CONTYPE"]); strArray[iRow, 6] = Convert.ToString(dt.Rows[iRow]["BAYNO"]); strArray[iRow, 7] = Convert.ToString(dt.Rows[iRow]["POS"]); strArray[iRow, 8] = Convert.ToString(dt.Rows[iRow]["BAY"]); strArray[iRow, 9] = Convert.ToString(dt.Rows[iRow]["BAYCOL"]); strArray[iRow, 10] = Convert.ToString(dt.Rows[iRow]["BAYROW"]); strArray[iRow, 11] = Convert.ToString(dt.Rows[iRow]["SEALNO"]); strArray[iRow, 12] = Convert.ToString(dt.Rows[iRow]["BLNO"]); strArray[iRow, 13] = Convert.ToString(dt.Rows[iRow]["OLDBAYNO"]); strArray[iRow, 14] = Convert.ToString(dt.Rows[iRow]["AMOUNT"]); strArray[iRow, 15] = Convert.ToString(dt.Rows[iRow]["GROSSWEIGHT"]); strArray[iRow, 16] = Convert.ToString(dt.Rows[iRow]["WEIGHT"]); strArray[iRow, 17] = Convert.ToString(dt.Rows[iRow]["VOLUME"]); strArray[iRow, 18] = Convert.ToString(dt.Rows[iRow]["CODE_LOAD_PORT"]); strArray[iRow, 19] = Convert.ToString(dt.Rows[iRow]["CODE_UNLOAD_PORT"]); strArray[iRow, 20] = Convert.ToString(dt.Rows[iRow]["TPMARK"]); strArray[iRow, 21] = Convert.ToString(dt.Rows[iRow]["EDITBAYMARK"]); strArray[iRow, 22] = Convert.ToString(dt.Rows[iRow]["MOVED"]); strArray[iRow, 23] = Convert.ToString(dt.Rows[iRow]["PASS_MARK"]); strArray[iRow, 24] = Convert.ToString(dt.Rows[iRow]["SHORT_UNLOAD"]); strArray[iRow, 25] = Convert.ToString(dt.Rows[iRow]["UNLOAD_MARK"]); strArray[iRow, 26] = Convert.ToString(dt.Rows[iRow]["WORK_NO"]); strArray[iRow, 27] = Convert.ToString(dt.Rows[iRow]["WORK_DATE"]); strArray[iRow, 28] = Convert.ToString(dt.Rows[iRow]["CODE_CON_COMPANY"]); strArray[iRow, 29] = Convert.ToString(dt.Rows[iRow]["USER_NAME"]); strArray[iRow, 30] = Convert.ToString(dt.Rows[iRow]["OPER_TIME"]); } log.LogCatalogSuccess(); return(Result.Success(strArray, null)); }
/// <summary> /// 同步船图 /// </summary> /// <param name="tallyE">TallyE数据对象</param> /// <returns>结果</returns> public string UpdateImage(TallyE tallyE) { //错误提示 string strErr = string.Empty; string strSql_ImageAll = string.Format("select * from CON_IMAGE where 1=0"); string strSql = string.Format(@"select * from CON_IMAGE where ship_id='{0}' and container_no='{1}'", tallyE.StrNewShip_Id, tallyE.StrContainer_No); var dt = Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteQuery_DataTable(strSql, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步船图异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步船图异常:" + strErr); } if (dt.Rows.Count > 0) { dt.Rows[0]["UNLOAD_MARK"] = "1"; dt.Rows[0]["MOVED"] = "0"; //智能识别自动理货处理 if (tallyE.StrWork_No.Substring(0, 1) == "P" || tallyE.StrWork_No.Substring(0, 1) == "X") { dt.Rows[0]["WORK_NO"] = "9999"; dt.Rows[0]["TALLY_MARK"] = "A"; dt.Rows[0]["CODE_CRANE"] = tallyE.StrWork_No; } else { dt.Rows[0]["WORK_NO"] = tallyE.StrWork_No; } dt.Rows[0]["USER_CODE"] = tallyE.StrWork_No; if (tallyE.StrInOutType.Equals("I")) { if (Convert.IsDBNull(dt.Rows[0]["WORK_DATE"])) dt.Rows[0]["WORK_DATE"] = tallyE.StrTime; dt.Rows[0]["USER_NAME"] = tallyE.StrWork_No; } else { dt.Rows[0]["WORK_DATE"] = tallyE.StrTime; ; dt.Rows[0]["BAYNO"] = tallyE.StrBay_No; //如果新贝位目前存在箱号,则与当前箱所在贝位调换 string strSqlUpdate = "update CON_IMAGE set BayNo=nvl((select Max(BayNo) BayNo from con_image where SHIP_ID=" + tallyE.StrNewShip_Id + " and CONTAINER_NO ='" + tallyE.StrContainer_No + "'),'" + tallyE.StrBay_No + "')" + " where SHIP_ID=" + tallyE.StrNewShip_Id + " and BayNO='" + tallyE.StrBay_No + "' and CONTAINER_NO !='" + tallyE.StrContainer_No + "'"; Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).ExecuteNonQuery(strSqlUpdate, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步舱单异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步舱单异常:" + strErr); } Oracle.DataAccess(RegistryKey.KeyPath_Oracle_Tally).UpdateTable(dt, strSql_ImageAll, out strErr); if (!string.IsNullOrWhiteSpace(strErr)) { log.LogCatalogFailure("同步舱单异常:" + strErr); return Rollback(tallyE); //return Result.Failure("同步舱单异常:" + strErr); } } } return null; }