private void Event_Log(string jobNo, string level, int c, int id, string status) { string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; if (level == "JOB") { elog.ActionLevel_isJOB(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Job, c, status); } if (level == "QUOTATION") { elog.ActionLevel_isJOB(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Quotation, c, status); } if (level == "CONT") { elog.ActionLevel_isCONT(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Container, c, status); } if (level == "TRIP") { elog.ActionLevel_isTRIP(id); elog.setActionLevel(id, CtmJobEventLogRemark.Level.Trip, c, status); } elog.log_edi(); }
public void FSL_Container_ReadyReturn(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); int contId = SafeValue.SafeInt(job["contId"], 0); string Time = SafeValue.SafeString(job["Time"]); string Location = SafeValue.SafeString(job["Location"]); string user = SafeValue.SafeString(job["user"]); C2.CtmJobDet1Biz det1Bz = new C2.CtmJobDet1Biz(contId); C2.CtmJobDet1 det1 = det1Bz.getData(); bool status = false; string context = Common.StringToJson(""); if (det1 != null) { try { det1.WhsReadyInd = "Y"; det1.WhsReadyTime = Time; det1.WhsReadyLocation = Location; C2.Manager.ORManager.StartTracking(det1, Wilson.ORMapper.InitialState.Updated); C2.Manager.ORManager.PersistChanges(det1); status = true; #region lot alert string sql = string.Format(@"select ClientId,EmailAddress from CTM_JobDet1 as det1 left outer join CTM_Job as job on det1.JobNo=job.JobNo where det1.Id=@contId"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@contId", contId, SqlDbType.Int)); string client = ""; string EmailAddress = ""; DataTable dt = ConnectSql_mb.GetDataTable(sql, list); if (dt.Rows.Count > 0) { client = SafeValue.SafeString(dt.Rows[0]["ClientId"]); EmailAddress = SafeValue.SafeString(dt.Rows[0]["EmailAddress"]); } C2.CtmJobEventLog log = new C2.CtmJobEventLog(); log.Platform_isMobile(); log.Controller = user; log.ActionLevel_isCONT(contId); log.isAlert(client); log.setRemark(CtmJobEventLogRemark.Level.Container, -1, user + " set ready to return [" + Time + "]"); log.log(); #endregion C2.Email.SendEmail(EmailAddress, "[email protected],[email protected]", "", "TSL Customer Alert", "Dear Customer:Container:[" + det1.ContainerNo + "] is ready to return.", ""); context = "{\"Client\":\"" + client + "\",\"text\":\"" + det1.ContainerNo + " ready to return\"}"; } catch { } } Common.WriteJsonP(status, context); }
private void update_ContStatus_trip(int contId, string type, string statucCode) { string JobNo = SafeValue.SafeString(Request.QueryString["JobNo"]); string isWarehouse = SafeValue.SafeString(Request.QueryString["isWarehouse"]); string sql = ""; string status = ""; if (isWarehouse == "Yes") { if (type == "IMP") { status = "WHS-LD"; } if (type == "EXP") { status = "WHS-MT"; } if (type == "RET") { status = "Return"; } sql = string.Format(@"update ctm_jobdet1 set StatusCode='{1}' where Id={0}", contId, status); ConnectSql_mb.ExecuteNonQuery(sql); } if (isWarehouse == "No") { if (type == "IMP") { status = "Customer-LD"; } if (type == "EXP") { status = "Customer-MT"; } if (type == "RET") { status = "Return"; } sql = string.Format(@"update ctm_jobdet1 set StatusCode='{1}' where Id={0}", contId, status); ConnectSql_mb.ExecuteNonQuery(sql); } string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.ActionLevel_isCONT(contId); elog.setActionLevel(contId, CtmJobEventLogRemark.Level.Container, 4, status); elog.log(); }
public void ContainerTrips_Save(string info) { JObject job = (JObject)JsonConvert.DeserializeObject(HttpUtility.UrlDecode(Server.UrlDecode(info))); string context = Common.StringToJson(""); string sql = string.Format(@"update ctm_jobdet1 set ContainerNo=@ContainerNo,SealNo=@SealNo where Id=@contId"); List <ConnectSql_mb.cmdParameters> list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@contId", SafeValue.SafeInt(job["Id"], 0), SqlDbType.Int)); list.Add(new ConnectSql_mb.cmdParameters("@ContainerNo", job["ContainerNo"], SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@SealNo", job["SealNo"], SqlDbType.NVarChar, 100)); ConnectSql_mb.ExecuteNonQuery(sql, list); sql = string.Format(@"update ctm_job set PickupFrom=@PickupFrom,DeliveryTo=@DeliveryTo,YardRef=@YardRef, SpecialInstruction=@SpecialInstruction,Remark=@Remark,PermitNo=@PermitNo where JobNo=@JobNo"); list = new List <ConnectSql_mb.cmdParameters>(); list.Add(new ConnectSql_mb.cmdParameters("@JobNo", job["JobNo"], SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@PickupFrom", job["PickupFrom"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@DeliveryTo", job["DeliveryTo"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@YardRef", job["YardRef"], SqlDbType.NVarChar, 100)); list.Add(new ConnectSql_mb.cmdParameters("@SpecialInstruction", job["SpecialInstruction"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@Remark", job["Remark"], SqlDbType.NVarChar, 300)); list.Add(new ConnectSql_mb.cmdParameters("@PermitNo", job["PermitNo"], SqlDbType.NVarChar, 100)); bool status = ConnectSql_mb.ExecuteNonQuery(sql, list).status; if (status) { //===========log C2.CtmJobEventLog lg = new C2.CtmJobEventLog(); lg.Platform_isMobile(); lg.Controller = SafeValue.SafeString(job["user"]); lg.Lat = SafeValue.SafeString(job["Lat"]); lg.Lng = SafeValue.SafeString(job["Lng"]); lg.ActionLevel_isCONT(SafeValue.SafeInt(job["Id"], 0)); lg.Remark = "Container Update"; lg.log(); } Common.WriteJsonP(status, context); }
protected void grid_wh_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string para = e.Parameters; if (Request.QueryString["no"] != null) { try { #region list if (list.Count > 0) { string no = SafeValue.SafeString(Request.QueryString["no"]); string jobType = SafeValue.SafeString(Request.QueryString["type"]); string client = SafeValue.SafeString(Request.QueryString["clientId"]); #region OK if (para == "OK") { string jobNo = ""; string refType = ""; bool action = false; Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(C2.CtmJob), "JobNo='" + no + "'"); C2.CtmJob job = C2.Manager.ORManager.GetObject(query) as C2.CtmJob; C2.CtmJobDet2 trip = null; if (job != null) { refType = SafeValue.SafeString(Request.QueryString["action"]); jobNo = C2Setup.GetNextNo("", "CTM_Job_" + refType, DateTime.Today); job.JobNo = jobNo; job.QuoteNo = jobNo; job.JobType = refType; job.JobDate = DateTime.Now; job.JobStatus = "Confirmed"; job.QuoteStatus = "None"; C2.Manager.ORManager.StartTracking(job, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(job); C2Setup.SetNextNo("", "CTM_Job_" + refType, jobNo, DateTime.Today); #region Trip trip = new C2.CtmJobDet2(); string sql = string.Format(@"select max(TripIndex) from CTM_JobDet2 where JobType=@JobType and JobNo=@JobNo"); List <ConnectSql_mb.cmdParameters> list_cmd = new List <ConnectSql_mb.cmdParameters>(); list_cmd.Add(new ConnectSql_mb.cmdParameters("@JobNo", jobNo, SqlDbType.NVarChar, 100)); list_cmd.Add(new ConnectSql_mb.cmdParameters("@JobType", refType, SqlDbType.NVarChar, 100)); string maxIdex = SafeValue.SafeString(ConnectSql_mb.ExecuteScalar(sql, list_cmd).context, "//00"); int n = SafeValue.SafeInt(maxIdex.Substring(maxIdex.LastIndexOf("/") + 1), 0) + 1; string str = (100 + n).ToString().Substring(1); trip.BookingDate = DateTime.Today; trip.TripIndex = jobNo + "/" + refType + "/" + str; trip.JobNo = jobNo; trip.FromDate = DateTime.Today; trip.ToDate = DateTime.Today; trip.CreateUser = HttpContext.Current.User.Identity.Name; trip.CreateTime = DateTime.Now; trip.UpdateUser = HttpContext.Current.User.Identity.Name; trip.UpdateTime = DateTime.Now; trip.JobType = refType; trip.TripCode = refType; trip.Remark = job.Remark; trip.ToCode = job.DeliveryTo; trip.FromCode = job.PickupFrom; trip.Statuscode = "P"; C2.Manager.ORManager.StartTracking(trip, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(trip); string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.ActionLevel_isCONT(trip.Id); elog.setActionLevel(trip.Id, CtmJobEventLogRemark.Level.Container, 1, ""); elog.log(); #endregion } for (int i = 0; i < list.Count; i++) { int id = list[i].id; decimal qty = list[i].qty; decimal weight = list[i].weight; decimal volume = list[i].volume; decimal sku_qty = list[i].sku_qty; decimal l = list[i].l; decimal h = list[i].h; decimal w = list[i].w; string refNo = list[i].refNo; string toLoc = list[i].toLoc; if (qty > 0) { Wilson.ORMapper.OPathQuery query1 = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + id + ""); C2.JobHouse house = C2.Manager.ORManager.GetObject(query1) as C2.JobHouse; house.LineId = id; house.CargoType = "OUT"; house.JobNo = jobNo; house.ContNo = ""; house.JobType = refType; house.QtyOrig = qty; house.PackQty = sku_qty; house.Weight = weight; house.Volume = volume; house.WeightOrig = weight; house.VolumeOrig = volume; house.LandStatus = "Normal"; house.DgClass = "Normal"; house.DamagedStatus = "Normal"; house.LengthPack = l; house.WidthPack = w; house.HeightPack = h; house.RefNo = no; house.Qty = qty; house.OpsType = "Delivery"; house.ClientId = client; house.CargoStatus = "P"; house.TripId = trip.Id; house.TripIndex = trip.TripIndex; C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(house); int lineId = house.Id; if (refType == "TR") { house.LineId = lineId; house.Location = toLoc; house.JobNo = jobNo; house.TransferNo = jobNo; house.RefNo = refNo; house.CargoType = "IN"; house.RefNo = no; house.CargoStatus = "P"; C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(house); } action = true; } else { action = false; } } if (action) { e.Result = "Action Success! No is " + jobNo; } else { e.Result = "Action Error!"; } } #endregion #region New WDO Trip if (para == "NewTrip") { bool action = false; for (int i = 0; i < list.Count; i++) { int id = list[i].id; decimal qty = list[i].qty; decimal weight = list[i].weight; decimal volume = list[i].volume; decimal sku_qty = list[i].sku_qty; decimal l = list[i].l; decimal h = list[i].h; decimal w = list[i].w; string refNo = list[i].refNo; string toLoc = list[i].toLoc; if (qty > 0) { Wilson.ORMapper.OPathQuery query1 = new Wilson.ORMapper.OPathQuery(typeof(C2.JobHouse), "Id=" + id + ""); C2.JobHouse house = C2.Manager.ORManager.GetObject(query1) as C2.JobHouse; house.LineId = id; house.CargoType = "OUT"; house.JobNo = no; house.ContNo = ""; house.JobType = jobType; house.QtyOrig = qty; house.PackQty = sku_qty; house.Weight = weight; house.Volume = volume; house.WeightOrig = weight; house.VolumeOrig = volume; house.LandStatus = "Normal"; house.DgClass = "Normal"; house.DamagedStatus = "Normal"; house.LengthPack = l; house.WidthPack = w; house.HeightPack = h; house.RefNo = no; house.Qty = qty; house.OpsType = "Delivery"; house.ClientId = client; house.TripIndex = SafeValue.SafeString(cbb_TripNo.Text); house.TripId = SafeValue.SafeInt(cbb_TripNo.Value, 0); house.CargoStatus = "P"; C2.Manager.ORManager.StartTracking(house, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(house); } action = true; } if (action) { e.Result = "Success"; } else { e.Result = "Action Error!"; } } #endregion } else { e.Result = "Pls Select at least one Cargo"; } #endregion } catch { } } }