1
lu
2024-11-29 0bab28c7959335969f6d07c3cb33acbeffed1de5
DevApp/Gs.DevApp/DevFrm/WOM/Frm_Wompba.cs
@@ -1,3 +1,5 @@
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
@@ -46,12 +48,18 @@
                Rectangle r = new Rectangle(gridView1.GridControl.Width / 2 - 100, e.Bounds.Top + 45, e.Bounds.Right - 5, e.Bounds.Height - 5);
                e.Graphics.DrawString(str, f, Brushes.Gray, r);
            };
            txt_pba013.EditChanged += (s, e) =>
            {
                string workGuid = this.txt_pba013.GetGuid();
                txt_pba016.getSuppler(workGuid);
                _getListJybz(workGuid);
            };
            //选择需要入库的明细
            btnSelect.Click += (s, e) =>
            {
                if (string.IsNullOrEmpty(this.txt_pba013.Text))
                if (string.IsNullOrEmpty(this.txt_pba013.GetId()))
                {
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择供应商,才能选择来料明细!");
                    Gs.DevApp.ToolBox.MsgHelper.ShowError("请先选择车间,才能选择任务单!");
                    return;
                }
                var frm = new SelectWompba(this.txt_pba013.Text);
@@ -85,6 +93,8 @@
                };
                frm.ShowDialog();
            };
        }
        /// <summary>
@@ -138,14 +148,15 @@
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_hNo, gridView1);
                lbGuid, txt_hNo, gridView1, "hNo");
            //toolBarMenu1.guidKey = rowGuid;
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            //MsgHelper.Warning(rowGuid);
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定审核吗?"))
                return;
            UcLoading _loading = new UcLoading();
            var _obj = new
            {
@@ -157,16 +168,13 @@
                    _webServiceName + "EditModelSubmit",
                    JsonConvert.SerializeObject(_obj));
                var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                MsgHelper.Warning(_rtn.rtnData.outMsg.ToString());
                if (_rtn.rtnCode > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                        getModel(lbGuid.Text.Trim(), false, 999);
                    else
                        getPageList(1, UtilityHelper.GetPageSize());
                }
                else
                {
                    MsgHelper.Warning(_rtn.rtnMsg);
                }
            }
            catch (Exception ex)
@@ -244,7 +252,7 @@
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_hNo, gridView1,"hNo");
                lbGuid, txt_hNo, gridView1, "hNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
@@ -327,19 +335,32 @@
        private void ToolBarMenu1_btnSaveClick(object sender, EventArgs e)
        {
            toolBarMenu1.isSetBtn = false;
            //if (string.IsNullOrEmpty(txt_account.Text.Trim()))
            //{
            //    Gs.DevApp.ToolBox.MsgHelper.Warning("登录账号不能为空!");
            //    txt_account.Focus();
            //    return;
            //}
            var _sb = new StringBuilder();
            string workId = txt_pba013.GetId();
            if (string.IsNullOrEmpty(workId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择车间!");
                txt_pba013.Focus();
                return;
            }
            string lineId = txt_pba016.GetId();
            if (string.IsNullOrEmpty(lineId.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("请选择产线!");
                txt_pba016.Focus();
                return;
            }
            if (string.IsNullOrEmpty(txt_pba015.Text.Trim()))
            {
                Gs.DevApp.ToolBox.MsgHelper.Warning("计划人数不能为空!");
                txt_pba015.Focus();
                return;
            }
            var _obj = new
            {
                guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建
                bz = txt_pba009.Text.Trim(),
                cjId = 1,
                cxId = 1,
                cjId = workId,
                cxId = lineId,
                jhrs = txt_pba015.Text.Trim(),
                list = new List<dynamic>(),
            };
@@ -365,12 +386,12 @@
                    _obj.list.Add(new
                    {
                        Guid = _guid,
                        AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["aboutGuid"].ToString()),
                        AboutGuid = Gs.DevApp.ToolBox.UtilityHelper.ToGuid(row["caaGuid"].ToString()),
                        LineId = int.Parse(row["daa015"].ToString()),//产线id
                        Yjkgsj = (row["mesStartProd"].ToString()),//预计开工时间
                        Jhrs = row["daa015"].ToString(),//计划人数
                        Jhrs = row["planPersonnel"].ToString(),//计划人数
                        Hxsj = row["changeLinetime"].ToString(),//换线时间
                        Bz = row["daa009"].ToString(),//换线时间
                        Bz = row["daa009"].ToString(),//备注
                        Blsj = row["prepareTime"].ToString(),//预计备料时间
                        Pcsl = row["daa008"].ToString()//排产数量
                    });
@@ -524,5 +545,51 @@
                }
            }
        }
        private void _getListJybz(string workGuid)
        {
            if (string.IsNullOrEmpty(workGuid))
                return;
            var _obj = new
            {
                guid = workGuid //主建
            };
            var json = JsonConvert.SerializeObject(_obj);
            try
            {
                var strReturn = UtilityHelper.HttpPost("",
                    "SysDepartmentManager/GetModel", json);
                var _job = JObject.Parse(strReturn);
                var array = new JArray();
                var d = _job["rtnData"]["list"];
                foreach (var a in d) array.Add(a);
                var dt = JsonConvert.DeserializeObject<DataTable>(array.ToString());
                foreach (DataRow dr in dt.Rows)
                {
                    rptJYBZ.Items.Add((new CboItemEntity(dr["id"].ToString(), dr["name"].ToString())));
                }
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        private void rptJYBZ_SelectedIndexChanged(object sender, EventArgs e)
        {
            ComboBoxEdit comboBox = sender as ComboBoxEdit;
            if (comboBox != null)
            {
                GridView myView = (gcMx1.MainView as GridView);
                int dataIndex = myView.GetDataSourceRowIndex(myView.FocusedRowHandle);
                CboItemEntity _itm = comboBox.EditValue as CboItemEntity;
                string _val = _itm.Value.ToString();
                string _txt = _itm.Text.ToString();
                gvMx1.CloseEditor();
                gvMx1.UpdateCurrentRow();
                gvMx1.SetRowCellValue(dataIndex, "daa015LineName", _txt);
                gvMx1.SetRowCellValue(dataIndex, "daa015", _val);
            }
        }
    }
}