public ActionResult <string> Post([FromBody] Assign assign) { string errMess = ""; if (assign.deviceId.Trim() == "") { errMess += "deviceId不完整"; } AssignResult r = new AssignResult(); if (errMess != "") { r.code = 400; r.Des = errMess; return(Ok(r)); } var result = Core.Core.QueryInfo(assign.deviceId, "1"); if (result == "201") { r.code = 200; } else { r.code = 400; r.Des = result; } return(Ok(r)); }
private void ConnectResult(AssignResult e) { if (this.InvokeRequired) { Invoke(new ConnectResultDeleg(ConnectResult), new object[] { e }); return; } switch (e) { case AssignResult.ACCEPTED: //MessageBox.Show("Connect success"); DialogResult = DialogResult.OK; byte[] ipb = lv_device.devicelist[lv_device.SelectedIndex].IPAddress.Address; byte[] mac = lv_device.devicelist[lv_device.SelectedIndex].MACAddress.Address; ConnectIP = String.Format("{0}.{1}.{2}.{3}", ipb[0], ipb[1], ipb[2], ipb[3]); MAC = string.Format("{0:X2}:{1:X2}:{2:X2}:{3:X2}:{4:X2}:{5:X2}", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); this.Close(); break; case AssignResult.REJECTED: MessageBox.Show("Connect rejected"); break; case AssignResult.UNKNOWN: MessageBox.Show("Connect fail"); break; case AssignResult.TIMEOUT: MessageBox.Show("Connect timeout"); break; } }
private void CreateUpdateButtonClicked(object sender, RoutedEventArgs e) { string makeModel = tbMakeModel.Text; double engineSize = sliderEngineSize.Value; Enum.TryParse(comboFuelType.SelectedItem.ToString(), out FuelTypeEnum fuelType); try { if (car == null) //create { car = new Car(makeModel, engineSize, fuelType); } if (car != null) //update { car.MakeModel = tbMakeModel.Text; car.EngineSize = sliderEngineSize.Value; Enum.TryParse(comboFuelType.SelectedItem.ToString(), out FuelTypeEnum fuelT); car.FuelType = fuelT; } } catch (DataInvalidException ex) { MessageBox.Show("Error: " + ex.Message, "Input error", MessageBoxButton.OK, MessageBoxImage.Error); return; } AssignResult?.Invoke(car); DialogResult = true; }
private void ShowMsg(AssignResult e) { if (this.InvokeRequired) { Invoke(new ShowMsgDeleg(ShowMsg), new object[] { e }); return; } switch (e) { case AssignResult.ACCEPTED: MessageBox.Show("Assign completed"); btn_clear_Click(null, null); btn_start_Click(null, null); break; case AssignResult.REJECTED: MessageBox.Show("Assign rejected"); break; case AssignResult.UNKNOWN: MessageBox.Show("Assign fail"); break; case AssignResult.TIMEOUT: MessageBox.Show("Assign timeout"); break; } }
private void btnAction_Click(object sender, RoutedEventArgs e) { make = tBoxMake.Text; size = sliderEngine.Value; fuel = comboFuel.SelectedItem.ToString(); AssignResult?.Invoke(make, size, fuel); DialogResult = true; // close the current dialog }
private AssignResult AssignOrderPost(string deviceId, string orderID, string carNo, string parkNo) { string errMess = ""; if (deviceId == null && deviceId.Trim() == "") { errMess += "deviceId不完整"; } if (orderID == null && orderID.Length != 22) { errMess += "orderID 不完整"; } if (carNo == null && carNo.Trim() == "" && ZHHelper.CheckZhLength(carNo) > 20) { errMess += "carNo 长度异常"; } else { carNo = ZHHelper.ZH_Fill(carNo, 20); } if (parkNo.Trim() == "" && ZHHelper.CheckZhLength(parkNo) > 50) { errMess += "parkNo 长度异常"; } else { parkNo = ZHHelper.ZH_Fill(parkNo, 50); } AssignResult r = new AssignResult(); if (errMess != "") { r.code = 400; r.Des = errMess; return(r); } if (Core.Core.GetOrderConfirm(deviceId, orderID)) { var asss = Core.Core.PlaceOrder(deviceId, orderID, carNo, parkNo); if (asss == "201") { r.code = 200; } else { r.code = 400; r.Des = asss; } } else { // ZHHelper.ConsoleOut($"AssignOrderPost 当前设备已再下发订单列表中{deviceId},orderID:{orderID}"); Console.WriteLine($"AssignOrderPost list existed {deviceId},orderID:{orderID}"); r.code = 400; r.Des = $"当前设备已在下发订单列表中{deviceId},orderID:{orderID}"; } return(r); }
private void btOK_Click(object sender, RoutedEventArgs e) { int age; int.TryParse(tbAge.Text, out age); //FIXME or TODO for exception handling double rand = new Random().NextDouble(); AssignResult?.Invoke(age, rand); // execute call-back, if resultAge is not null, then call it and set it to age DialogResult = true; // without setting this, press ok button has no reaction, after setting this, ok button will also close the dialog, just like the cancel button, but the result return bool true }
public AssignResult HWGRToWorldAssign(long storeID, long world_id, long hwgr_id, DateTime beginTime, DateTime endTime) { AssignResult result = new AssignResult(); result.Result = AResult.Error; using (IDbCommand command = CreateCommand()) { command.CommandText = "spHWGR_World_Assign"; command.CommandType = CommandType.StoredProcedure; SqlParameter p1 = new SqlParameter("@StoreID", SqlDbType.BigInt, 8); p1.Value = storeID; command.Parameters.Add(p1); SqlParameter p2 = new SqlParameter("@World_ID", SqlDbType.BigInt, 8); p2.Value = world_id; command.Parameters.Add(p2); SqlParameter p3 = new SqlParameter("@HWGR_ID", SqlDbType.BigInt, 8); p3.Value = hwgr_id; command.Parameters.Add(p3); SqlParameter p4 = new SqlParameter("@BeginTime", SqlDbType.SmallDateTime, 4); p4.Value = beginTime; command.Parameters.Add(p4); SqlParameter p5 = new SqlParameter("@EndTime", SqlDbType.SmallDateTime, 4); p5.Value = endTime; command.Parameters.Add(p5); SqlParameter importResult = new SqlParameter("@result", SqlDbType.Int, 4); importResult.Direction = ParameterDirection.Output; command.Parameters.Add(importResult); using (IDataReader reader = command.ExecuteReader(CommandBehavior.SequentialAccess)) { List <WorldToHwgr> list = new List <WorldToHwgr>(); while (reader.Read()) { WorldToHwgr value = new WorldToHwgr(); value.ID = reader.GetInt64(0); value.StoreID = reader.GetInt64(1); value.WorldID = reader.GetInt64(2); value.HWGR_ID = reader.GetInt64(3); value.BeginTime = reader.GetDateTime(4); value.EndTime = reader.GetDateTime(5); value.Import = reader.GetBoolean(6); list.Add(value); } reader.NextResult(); int res = (int)importResult.Value; if (res < 0) { result.Result = AResult.Error; } result.Data = list; } } _WorldToHwgrDao.OnDaoInvalidateWholeCache(); return(result); }
private void SaveButtonClicked(object sender, RoutedEventArgs e) { //bread string bread = comboBread.Text; //veggies List <string> veggies = new List <string>(); if (cbVegLettuce.IsChecked == true) { veggies.Add("Lettuce"); } if (cbVegTomatoes.IsChecked == true) { veggies.Add("Tomatoes"); } if (cbVegCucubmers.IsChecked == true) { veggies.Add("Cucumbers"); } string vegs = string.Join(",", veggies); //meat string meat = ""; if (rbMeatChicken.IsChecked == true) { meat = "Chicken"; } else if (rbMeatTurkey.IsChecked == true) { meat = "Turkey"; } else if (rbMeatTofu.IsChecked == true) { meat = "Tofu"; } else { MessageBox.Show("Please choose meat", "Action required", MessageBoxButton.OK, MessageBoxImage.Error); } AssignResult?.Invoke(bread, vegs, meat); /* if (AssignResult != null) * { * AssignResult.Invoke(bread, vegs, meat); * } */ DialogResult = true; }
/// <summary> /// 审批单据,actionName为空时,自动寻找第一个同意审批项; /// 有多个类型为通过的审批项时,可用actionName指定审批项,如actionName="审批通过" /// </summary> /// <param name="formId">单据FormId</param> /// <param name="pKValue">单据主键</param> /// <param name="receiverName">处理人</param> /// <param name="disposition">审批意见</param> /// <param name="isApprovalFlow">是否为审批流</param> public string ApproveBill(Context ctx, string formId, string pKValue, string receiverName, string disposition, bool isApprovalFlow = false, string actionName = null) { string reason = ""; List <AssignResult> assignResults = GetApproveActions(ctx, formId, pKValue, receiverName); AssignResult approvalAssignResults = assignResults.FirstOrDefault(r => r.ApprovalType == AssignResultApprovalType.Forward); if (approvalAssignResults == null) { reason = "未找到审批项"; return(reason); } reason = SubmitWorkflow(ctx, formId, pKValue, receiverName, approvalAssignResults.Id, disposition, isApprovalFlow); return(reason); }
private void btSave_Click(object sender, RoutedEventArgs e) { string breadStr = cmbBread.SelectedItem.ToString(); List <CheckBox> checkBoxes = WpPanelVeggie.Children.OfType <CheckBox>().Where(c => c.IsChecked == true).ToList(); string veggieStr = string.Empty; foreach (CheckBox c in checkBoxes) { veggieStr += c.Content + ", "; } RadioButton rbTarget = WpPanelMeet.Children.OfType <RadioButton>().Where(r => r.IsChecked == true).First(); string meetStr = rbTarget.Content.ToString(); AssignResult?.Invoke(breadStr, veggieStr.Substring(0, veggieStr.Length - 2), meetStr); DialogResult = true; }
public void AssignCards(StationWing wing) { int idx = 0; while (hand.selected.Count > idx) { Card c = hand.selected[idx]; AssignResult res = wing.CanAssignCard(c); Debug.Log(res); if (res == AssignResult.Success) { wing.AddCard(hand.RemoveCard(c)); } else { ++idx; } } }
/// <summary> /// 审批单据,actionName为空时,自动寻找第一个同意审批项; /// 有多个类型为通过的审批项时,可用actionName指定审批项,如actionName="审批通过" /// </summary> /// <param name="formId">单据FormId</param> /// <param name="pKValue">单据主键</param> /// <param name="receiverName">处理人</param> /// <param name="disposition">审批意见</param> /// <param name="isApprovalFlow">是否为审批流</param> public string ApproveBill(Context ctx, string formId, string pKValue, string receiverName, string actionName, string disposition, bool isApprovalFlow = false) { string reason = ""; List <AssignResult> assignResults = GetApproveActions(ctx, formId, pKValue, receiverName); if (!string.IsNullOrEmpty(actionName)) { assignResults = assignResults.Where(r => r.Name.Any(p => p.Value == actionName)).ToList(); } AssignResult approvalAssignResults = assignResults[0]; //AssignResult approvalAssignResults = assignResults.FirstOrDefault(r => r.ApprovalType == AssignResultApprovalType.Forward); if (approvalAssignResults == null) { reason = "未找到审批项"; return(reason); } reason = SubmitWorkflow(ctx, formId, pKValue, receiverName, approvalAssignResults.Id, disposition, isApprovalFlow); return(reason); }
/// <summary> /// 驳回单据,actionName为空时,自动寻找一个驳回审批项; /// 有多个类型为驳回的审批项时(如驳回、打回发起人),可用actionName指定审批项,如actionName="打回发起人","终止流程" /// </summary> public string RejectBill(Context ctx, string formId, string pKValue, string receiverName, string disposition, bool isApprovalFlow = false, string actionName = null) { string reason = ""; List <AssignResult> assignResults = GetApproveActions(ctx, formId, pKValue, receiverName); if (!string.IsNullOrEmpty(actionName)) { assignResults = assignResults.Where(r => r.Name.Any(p => p.Value == actionName)).ToList(); } else { assignResults = assignResults.OrderBy(r => r.Name.Any(p => p.Value == "打回发起人")).ToList(); } AssignResult rejectAssignResults = assignResults.FirstOrDefault(r => r.ApprovalType == AssignResultApprovalType.Reject); if (rejectAssignResults == null) { reason = "未找到驳回审批项"; return(reason); } reason = SubmitWorkflow(ctx, formId, pKValue, receiverName, rejectAssignResults.Id, disposition, isApprovalFlow); return(reason); //string reason = ""; //List<AssignResult> assignResults = GetApproveActions(ctx, formId, pKValue, receiverName); //assignResults = assignResults.Where(r => r.Name.Any(p => p.Value == actionName)).ToList(); //if (!string.IsNullOrEmpty(actionName)) // assignResults = assignResults.Where(r => r.Name.Any(p => p.Value == actionName)).ToList(); //else // assignResults = assignResults.OrderBy(r => r.Name.Any(p => p.Value == "打回发起人")).ToList(); //AssignResult rejectAssignResults = assignResults.FirstOrDefault(r => r.ApprovalType == AssignResultApprovalType.Reject); //if (rejectAssignResults == null) //{ // reason = "未找到驳回审批项"; // return reason; //} //reason = SubmitWorkflow(ctx, formId, pKValue, receiverName, rejectAssignResults.Id, disposition, isApprovalFlow); //return reason; }
public ActionResult <string> Post([FromBody] Assign assign) { string errMess = ""; if (assign.deviceId.Trim() == "") { errMess += "deviceId不完整"; } if (assign.orderID.Length != 22) { errMess += "orderID 不完整"; } //if (check_order == "") //{ // errMess += "check_order 不完整"; //} AssignResult r = new AssignResult(); if (errMess != "") { r.code = 400; r.Des = errMess; return(Ok(r)); } var result = Core.Core.ForcedOrder(assign.deviceId, assign.orderID, "1"); if (result == "201") { r.code = 200; } else { r.code = 400; r.Des = result; } return(Ok(r)); }
public ActionResult <string> Post([FromBody] MessageArrivals mess) { //Console.WriteLine($"接收到消息送达 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:{mess.orderID}"); //Core.Core.SetMessageArrivals(mess.deviceId, mess.orderID); AssignResult r = new AssignResult(); if (mess == null) { r.code = 200; r.Des = "传入的数据异常"; ZHHelper.ConsoleOut($"接收到消息送达 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); //MessageArrivals Console.WriteLine($"MessageArrivals {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); } else if (mess.deviceId == null || mess.deviceId == "") { r.code = 200; r.Des = "传入的deviceId数据异常"; //ZHHelper.ConsoleOut($"接收到消息送达 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); Console.WriteLine($"MessageArrivals {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); } else if (mess.orderID == null || mess.orderID == "") { r.code = 200; r.Des = "传入的orderID数据异常"; //ZHHelper.ConsoleOut($"接收到消息送达 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); Console.WriteLine($"MessageArrivals {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); } else { r.code = 200; r.Des = "MessageArrivals ok"; //ZHHelper.ConsoleOut($"接收到消息送达 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:{mess.orderID}"); Console.WriteLine($"MessageArrivals {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm {mess.orderID}"); Core.Core.SetMessageArrivals(mess.deviceId, mess.orderID); } return(Ok(r)); }
public ActionResult <string> Post([FromBody] Assign assign) { string errMess = ""; if (assign.deviceId != null && assign.deviceId.Trim() == "") { errMess += "deviceId不完整"; } if (assign.orderID != null && assign.orderID.Length != 22) { errMess += "orderID 不完整"; } AssignResult r = new AssignResult(); if (errMess != "") { r.code = 400; r.Des = errMess; //r.Des = System.Web.HttpUtility.UrlEncode(r.Des, System.Text.Encoding.GetEncoding("UTF-8")); return(Ok(r)); } var result = Core.Core.CancelOrder(assign.deviceId, assign.orderID); if (result == "201") { r.code = 200; } else { r.code = 400; r.Des = result; } return(Ok(r)); //return $"CancelOrder 收到订单{assign.orderID}处理结果:" + Core.Core.CancelOrder(assign.deviceId, assign.orderID); }
public ActionResult <string> Post([FromBody] OrderConfirm order) { //ZHHelper.ConsoleOut($"接收到订单确认 {DateTime.Now.ToString("hh:mm:ss,fff")} order confirm:{order.orderID}"); //Core.Core.GetOrderConfirm(order); //AssignResult r = new AssignResult(); //r.code = 200; //return Ok(r); AssignResult r = new AssignResult(); if (order == null) { r.code = 200; r.Des = "传入的数据异常"; ZHHelper.ConsoleOut($"接收到订单确认 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); } else if (order.deviceId == null || order.deviceId == "") { r.code = 200; r.Des = "传入的deviceId数据异常"; ZHHelper.ConsoleOut($"接收到订单确认 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); } else if (order.orderID == null || order.orderID == "") { r.code = 200; r.Des = "传入的orderID数据异常"; ZHHelper.ConsoleOut($"接收到订单确认 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:code:{r.code} Des:{r.code}"); } else { r.code = 200; ZHHelper.ConsoleOut($"接收到订单确认 {DateTime.Now.ToString("hh:mm:ss,fff")} message confirm:{order.orderID}"); Core.Core.DeleteOrderConfirm(order.deviceId, order.orderID); } return(Ok(r)); }
public Assignation(AssignResult result) { WeedFSFile = result.GetWeedFSFile(); Location = result.GetLocation(); _versionCount = result.count; }
private string SubmitWorkflow(Context ctx, string formId, string pKValue, string receiverName, string actionResult, string disposition, bool isApprovalFlow) { string reason = ""; DataSet ds = DBUtils.ExecuteDataSet(ctx, @"select b.FASSIGNID,b.FAPPROVALASSIGNID,a.FACTINSTID,a.FRECEIVERNAMES from t_wf_assign a join T_WF_APPROVALASSIGN b on a.fassignid=b.fassignid where b.Fobjecttypeid=@FormID and b.Fkeyvalue=@pKValue and a.FSTATUS=0", new List <SqlParam> { new SqlParam("@FormID", DbType.String, formId), new SqlParam("@pKValue", DbType.String, pKValue) }); DataRow row = ds.Tables[0].Rows.Cast <DataRow>().FirstOrDefault(dr => dr["FRECEIVERNAMES"].ToString().Split(',').Any(r => r == receiverName)); if (row == null) { reason = "未找到待办任务"; return(reason); } string assignId = row["FASSIGNID"].ToString(); string approvalAssignId = row["FAPPROVALASSIGNID"].ToString(); string _approvalItemId = AssignmentServiceHelper.OpenApprovalItem(ctx, ctx.UserId, assignId, false); FormMetadata formMetadata = MetaDataServiceHelper.GetFormMetaData(ctx, formId); DynamicObject ObjData = BusinessDataServiceHelper.LoadSingle(ctx, pKValue, formMetadata.BusinessInfo.GetDynamicObjectType()); BusinessInfo businessInfo = formMetadata.BusinessInfo; var _approvalItem = AssignmentServiceHelper.GetApprovalItemById(ctx, _approvalItemId); if (_approvalItem == null) { reason = "待办任务所在的流程实例不在运行中,不能进行处理!"; return(reason); } _approvalItem.ObjData = ObjData; _approvalItem.ReceiverPostId = 0; _approvalItem.ActionResult = actionResult; _approvalItem.Disposition = disposition.ToString(); AssignResult assignResult = _approvalItem.Actions != null?_approvalItem.Actions.FirstOrDefault(i => i.Id == actionResult) : null; AssignResultApprovalType approvalType = assignResult != null ? assignResult.ApprovalType : AssignResultApprovalType.None; _approvalItem.ActionResultType = approvalType; _approvalItem.Status = ApprovalItemStatus.Completed; DateTime timeNow = TimeServiceHelper.GetSystemDateTime(ctx); _approvalItem.CompletedTime = timeNow; ObjectActivityInstance _activityInstance = AssignmentServiceHelper.ConvertActivityModel( ctx, businessInfo, approvalAssignId, _approvalItem); var option = OperateOption.Create(); if (isApprovalFlow) { ApprovalAssignmentContext assignCtx = new ApprovalAssignmentContext() { ApprovalItems = new List <ApprovalItem>() { _approvalItem }, Info = businessInfo, Option = option }; assignCtx.NextActHandler = null; assignCtx.RejectReturn = false; assignCtx.ActivityInstance = _activityInstance; if (actionResult == AssignResultApprovalType.Reject.ToString()) { var _policy = AssignmentServiceHelper.GetApprovalAssignByAssignId(ctx, assignId); var nextHandleWrapper = new Kingdee.BOS.ApprovalFlow.PlugIns.Mobile.MobNextHandleWrapper(assignId, ctx, _policy); assignCtx.Target = nextHandleWrapper.RejectActivityModel.ActivityId; } ApprovalAssignmentServiceHelper.SubmitApprovalItem(ctx, assignCtx); reason = ""; return(reason); } else { ApprovalAssignmentContext assignCtx = new ApprovalAssignmentContext() { ApprovalItems = new List <ApprovalItem>() { _approvalItem }, Info = businessInfo, Option = option }; assignCtx.NextActHandler = null; assignCtx.RejectReturn = false; assignCtx.ActivityInstance = _activityInstance; ApprovalAssignmentServiceHelper.SubmitApprovalItem(ctx, assignCtx); reason = ""; return(reason); } //if (actionResult == AssignResultApprovalType.Reject.ToString()) //{ // string actInstId = row["FACTINSTID"].ToString(); // Kingdee.BOS.Workflow.App.Core.ProcInstService procInstService = new Kingdee.BOS.Workflow.App.Core.ProcInstService(); // var rejectActivityIds = procInstService.GetBackActInstList(ctx, actInstId, true).Select(r => r.ActivityId); // if (!rejectActivityIds.Any()) // { // reason = "无驳回节点"; // return reason; // } // assignCtx.Target = rejectActivityIds.FirstOrDefault(); //} }
/// <summary> /// Constructor /// </summary> /// <param name="Result"></param> public ResultArgs(AssignResult Result) { m_Result = Result; }