/// <summary> /// 接班时更新状态并且插入一条接班记录期同时插入mat和wip的记录初数量为接班时数量的期末数量 /// </summary> public void UpdateAndInsertWipMatHandOverBySaveJieBan(HandOverTheWatchCtrl handOverTheWatchCtrl) { if (MessageBox.Show(StringParser.Parse("确定要接班吗?"), StringParser.Parse("${res:Global.SystemInfo}"), MessageBoxButtons.OKCancel) == DialogResult.OK) { DataSet dsGetShangYiBanHandOver = new DataSet(); OperationHandover _operationHandover = new OperationHandover(); //获取上一班的交接记录 dsGetShangYiBanHandOver = _operationHandover.GetShangYiBanHandOver(handOverTheWatchCtrl.Shift, handOverTheWatchCtrl.Operation, handOverTheWatchCtrl.FactRoom); string handOverKey = dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][0].ToString(); Hashtable hashTable1 = new Hashtable(); hashTable1.Add("OPERATION_HANDOVER_KEY", handOverKey); hashTable1.Add("Receiveoperator", handOverTheWatchCtrl.Receiveoperator); hashTable1.Add("SHIFT", handOverTheWatchCtrl.Shift); hashTable1.Add("EDITOR", PropertyService.Get(PROPERTY_FIELDS.USER_NAME)); hashTable1.Add("EDIT_TIMEZONE", PropertyService.Get(PROPERTY_FIELDS.TIMEZONE)); DataTable tableParam1 = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(hashTable1); tableParam1.TableName = "HASH1"; DataSet dsSetIn1 = new DataSet(); dsSetIn1.Merge(tableParam1); _operationHandover.UpdateHandOver(dsSetIn1); //插入数据到工序交接班表 DataSet dsGetDangQianHandOver = _operationHandover.GetDangQianShiftHandover(handOverTheWatchCtrl.Shift, handOverTheWatchCtrl.Operation, handOverTheWatchCtrl.FactRoom); Hashtable hashTable = new Hashtable(); hashTable.Add("LOCATIOMKEY", handOverTheWatchCtrl.FactRoom); hashTable.Add("OPERATIONNAME", handOverTheWatchCtrl.Operation); hashTable.Add("SENDSHIFTVALUE", handOverTheWatchCtrl.Shift); hashTable.Add("DAY", dsGetDangQianHandOver.Tables["DAY"].Rows[0][0].ToString().Trim()); hashTable.Add("STATUS", "0"); hashTable.Add("SENDOPERATOR", handOverTheWatchCtrl.Sendoperator); hashTable.Add("CREATE_TIMEZONE", PropertyService.Get(PROPERTY_FIELDS.TIMEZONE)); hashTable.Add("CREATOR", PropertyService.Get(PROPERTY_FIELDS.USER_NAME)); DataTable tableParam = FanHai.Hemera.Share.Common.CommonUtils.ParseToDataTable(hashTable); tableParam.TableName = "HASH"; DataSet dsSetIn = new DataSet(); dsSetIn.Merge(tableParam); try { _operationHandover.InsertHandOver(dsSetIn); //插入数据到工序交接班表 DataSet dsGetDangQianHandOver1 = _operationHandover.GetDangQianShiftHandover(handOverTheWatchCtrl.Shift, handOverTheWatchCtrl.Operation, handOverTheWatchCtrl.FactRoom); string handDangqianOverKey = dsGetDangQianHandOver1.Tables["ShiftHandover"].Rows[0][0].ToString(); _operationHandover.InsertMatWipQiChu(handDangqianOverKey, handOverKey);//根据上一工序交接班主键获取上一工序交接班的期末数量插入到新生成的数据中的期初数量 MessageService.ShowMessage("保存成功", "系统提示"); } catch (Exception ex) { MessageService.ShowMessage(ex.Message, "系统提示"); } } }
/// <summary> /// HandOverTheWatchCtrl上接班按钮Click事件绑定窗体控件值 /// </summary> /// <param name="handOverTheWatchCtrl"></param> public void BindContralByJieBanClick(HandOverTheWatchCtrl handOverTheWatchCtrl) { DataSet dsGetShangYiBanHandOver = new DataSet(); OperationHandover _operationHandover = new OperationHandover(); //获取上一班的交接记录 dsGetShangYiBanHandOver = _operationHandover.GetShangYiBanHandOver(handOverTheWatchCtrl.Shift, handOverTheWatchCtrl.Operation, handOverTheWatchCtrl.FactRoom); string handOverKey = dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][0].ToString(); this.txtFacRoom.Text = dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][1].ToString(); this.txtGongXu.Text = dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][2].ToString(); this.txtJiaoBanShift.Text = dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][3].ToString(); this.txtJieBanShift.Text = handOverTheWatchCtrl.Shift;//dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][4].ToString(); this.txtJiaoBaoTime.Text = Convert.ToDateTime(dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][5].ToString()).ToString("yyyy-MM-dd"); this.txtZhuangTai.Text = dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][6].ToString(); this.txtJiaoBanJobNumber.Text = dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][7].ToString(); this.txtJieBanJobNumber.Text = handOverTheWatchCtrl.Receiveoperator; //dsGetShangYiBanHandOver.Tables["ShiftHandover"].Rows[0][8].ToString(); BindShuJuBiao(handOverKey); //绑定数据表通过工序交接班主键获取物料信息和WIP信息 gridView1.Columns["OUT_QTY_2"].OptionsColumn.AllowEdit = false; }