/// <summary> /// 物料入库 /// </summary> public void InputStorage() { Models.MaterialDetailModel.DataModel model = materialDetailModel.data.SingleOrDefault(item => item.GetMaterialDetail.PartCode.Equals(producePlanInfoModel.GetProducePlanInfo.PartCode)); //string json = Helpers.HttpHelper.PostJSON("http://localhost:26888/api/Mms/WinFormClient/PostMaterialInputStorage", new string json = Helpers.HttpHelper.PostJSON("http://" + Program.IP + "/api/Mms/WinFormClient/PostMaterialInputStorage", new { mainData = new { ContractCode = producePlanInfoModel.GetProducePlanInfo.ContractCode, ProjectName = producePlanInfoModel.GetProject.ProjectName, WarehouseCode = Program.WorkGroupInfo.data.GetWarehouse.WarehouseCode, WarehouseName = Program.WorkGroupInfo.data.GetWarehouse.WarehouseName }, detailData = new { InventoryCode = model.GetPart.InventoryCode, InventoryName = model.GetPart.InventoryName, Specs = model.GetPart.Model, Unit = model.GetPart.QuantityUnit, MateNum = producePlanInfoModel.GetProducePlanInfo.Quantity, ConfirmNum = producePlanInfoModel.GetProducePlanInfo.Quantity } }); }
private void txtPartCode_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar.Equals((char)13)) { TextBox textBox = sender as TextBox; if (string.IsNullOrEmpty(textBox.Text)) { return; } Panel panel = (Panel)textBox.Parent; int n = Convert.ToInt32(textBox.Tag); Models.MaterialDetailModel.DataModel model = panel.Tag as Models.MaterialDetailModel.DataModel; if (n.Equals(model.GetMaterialDetail.PartQuantity)) { if (MessageBox.Show("已录入正确的数量,是否继续录入?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } } n++; textBox.Tag = n; panel.Controls[5].Text = string.Format("{0}/{1}", n, model.GetMaterialDetail.PartQuantity); if (n.Equals(model.GetMaterialDetail.PartQuantity)) { panel.BackColor = Color.FromArgb(220, 255, 220); } if (n > model.GetMaterialDetail.PartQuantity) { panel.BackColor = Color.FromArgb(255, 220, 220); } bool verify = false; foreach (var item in pnlVerifyProductMaterial.Controls) { if (item is Panel) { Panel pnl = item as Panel; foreach (var control in pnl.Controls) { if ((pnl.Tag as Models.MaterialDetailModel.DataModel).GetMaterialDetail.PartQuantity.Equals(Convert.ToInt32(((TextBox)pnl.Controls[6]).Tag))) { verify = true; } else { verify = false; return; } } } } if (verify) { DialogResult dr = MessageBox.Show("验证通过!是否立即开始?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { //录入计划实际开始时间 string json = Helpers.HttpHelper.GetJSON("http://" + Program.IP + "/api/Mms/WinFormClient/GetPlanActualStartTime?ppdID=" + ID + "&dTime=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); var data = JsonConvert.DeserializeObject <dynamic>(json); if (Convert.ToBoolean(data["result"])) { //物料出库 OutputStorage(); } DrawingsShowForm form = new DrawingsShowForm(ID); DialogResult drB = form.ShowDialog(); if (drB == DialogResult.OK) { string str = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; System.Diagnostics.Process.Start(str, Program.WorkGroupInfo.data.GetWorkGroupInfo.TeamCode); Application.Exit(); } } } } }