/// <summary> /// 更新实际u坐标 /// </summary> public void UpdateSite() { string wms; switch (tasktype) { case TaskTypeEnum.入库: wms = givesite; break; case TaskTypeEnum.出库: wms = takesite; break; default: return; } WCS_CONFIG_LOC list = CommonSQL.GetLocInfo(wms); if (list == null) { return; } site = new JobSite { arfbuttfrt = CommonSQL.GetArfByFrt(dev), rgvsite1 = int.Parse(list.RGV_LOC_1 ?? "0"), rgvsite2 = int.Parse(list.RGV_LOC_2 ?? "0"), awcbuttRgv = list.AWC_LOC_TRACK ?? "", awcsite = list.AWC_LOC_STOCK ?? "" }; }
private void BtnSelect_Click(object sender, RoutedEventArgs e) { try { // 清空 TBawcX.Text = ""; TBawcYt.Text = ""; TBawcZt.Text = ""; TBawcYs.Text = ""; TBawcZs.Text = ""; TBrgv1.Text = ""; TBrgv2.Text = ""; string area = CBarea.Text; string x = TBx.Text; string y = TBy.Text; string z = TBz.Text; if (string.IsNullOrEmpty(area) || string.IsNullOrEmpty(x) || string.IsNullOrEmpty(y) || string.IsNullOrEmpty(z)) { Notice.Show("请完整填空!", "提示", 3, MessageBoxIcon.Info); return; } wmsloc = string.Format("{0}-{1}-{2}-{3}", area, x, y, z); WCS_CONFIG_LOC loc = CommonSQL.GetWcsLoc(wmsloc); if (string.IsNullOrEmpty(loc.WMS_LOC)) { Notice.Show("无对应坐标数据!", "提示", 3, MessageBoxIcon.Info); return; } string[] t = loc.AWC_LOC_TRACK.Split('-'); string[] s = loc.AWC_LOC_STOCK.Split('-'); TBawcX.Text = t[0]; TBawcYt.Text = t[1]; TBawcZt.Text = t[2]; TBawcYs.Text = s[1]; TBawcZs.Text = s[2]; TBrgv1.Text = loc.RGV_LOC_1; TBrgv2.Text = loc.RGV_LOC_2; BtnSave.IsEnabled = true; } catch (Exception ex) { Notice.Show(ex.Message, "错误", 3, MessageBoxIcon.Error); } }
/// <summary> /// 获取WCS坐标资讯 /// </summary> public static WCS_CONFIG_LOC GetWcsLoc(string wmsLoc) { try { string sql = string.Format(@"select * from wcs_config_loc where WMS_LOC = '{0}'", wmsLoc); DataTable dt = mysql.SelectAll(sql); if (IsNoData(dt)) { return(new WCS_CONFIG_LOC()); } WCS_CONFIG_LOC loc = dt.ToDataEntity <WCS_CONFIG_LOC>(); return(loc); } catch (Exception ex) { throw ex; } }
/// <summary> /// 获取WCS坐标资讯 /// </summary> public static WCS_CONFIG_LOC GetWcsLocByTask(string lockid) { try { string sql = string.Format(@"select * from wcs_config_loc where WMS_LOC = ( select case when TASK_TYPE = 2 then WMS_LOC_FROM else WMS_LOC_TO end from wcs_wms_task where TASK_ID = '{0}')", lockid); DataTable dt = mysql.SelectAll(sql); if (IsNoData(dt)) { return(new WCS_CONFIG_LOC()); } WCS_CONFIG_LOC loc = dt.ToDataEntity <WCS_CONFIG_LOC>(); return(loc); } catch (Exception ex) { throw ex; } }
/// <summary> /// 坐标是否处理 /// </summary> /// <returns></returns> public bool IsOkLoc(bool isDel) { try { bool res = false; if (isDel) { // 清坐标 lockLocWMS = ""; lockLocRGV1 = 0; lockLocRGV2 = 0; TakeSiteX = 0; TakeSiteY = 0; TakeSiteZ = 0; GiveSiteX = 0; GiveSiteY = 0; GiveSiteZ = 0; res = true; } else { if (string.IsNullOrEmpty(lockID)) { // 清坐标 lockLocWMS = ""; lockLocRGV1 = 0; lockLocRGV2 = 0; TakeSiteX = 0; TakeSiteY = 0; TakeSiteZ = 0; GiveSiteX = 0; GiveSiteY = 0; GiveSiteZ = 0; } else { if (string.IsNullOrEmpty(lockLocWMS) || lockLocRGV1 == 0 || lockLocRGV2 == 0 || TakeSiteX == 0 || TakeSiteY == 0 || TakeSiteZ == 0 || GiveSiteX == 0 || GiveSiteY == 0 || GiveSiteZ == 0) { WCS_CONFIG_LOC loc = CommonSQL.GetWcsLocByTask(lockID); if (loc == null || string.IsNullOrEmpty(loc.WMS_LOC) || string.IsNullOrEmpty(loc.RGV_LOC_1) || string.IsNullOrEmpty(loc.RGV_LOC_2) || string.IsNullOrEmpty(loc.AWC_LOC_TRACK) || string.IsNullOrEmpty(loc.AWC_LOC_STOCK)) { throw new Exception("无对应作业【" + lockID + "】坐标!"); } lockLocWMS = loc.WMS_LOC; lockLocRGV1 = int.Parse(loc.RGV_LOC_1); lockLocRGV2 = int.Parse(loc.RGV_LOC_2); string t = ""; string g = ""; switch (taskType) { case TaskTypeEnum.入库: t = loc.AWC_LOC_TRACK; g = loc.AWC_LOC_STOCK; break; case TaskTypeEnum.出库: t = loc.AWC_LOC_STOCK; g = loc.AWC_LOC_TRACK; break; default: break; } if (!string.IsNullOrEmpty(t)) { string[] ts = t.Split('-'); TakeSiteX = int.Parse(ts[0]) + gapX; TakeSiteY = int.Parse(ts[1]) + gapY; TakeSiteZ = int.Parse(ts[2]) + gapZ; } if (!string.IsNullOrEmpty(g)) { string[] gs = g.Split('-'); GiveSiteX = int.Parse(gs[0]) + gapX; GiveSiteY = int.Parse(gs[1]) + gapY; GiveSiteZ = int.Parse(gs[2]) + gapZ; } } else { res = true; } } } return(res); } catch (Exception ex) { throw ex; } }