public bool UploadDepot(DepotObject depotObject) { SqlAdapter.ConnectionString = _connstr; return(SqlAdapter.Run(string.Format(_isql, new object[] { depotObject.BatchNo + depotObject.BatchIndex, depotObject.Weight, depotObject.TheoryWeight, depotObject.Barcode, depotObject.Material }))); }
public bool UpWeight(DepotObject depotObject) { SqlAdapter.ConnectionString = _connstr; return(SqlAdapter.Run(string.Format(_uwsql, depotObject.Weight, depotObject.TheoryWeight, depotObject.BatchNo + depotObject.BatchIndex))); }
//public void ClearWeightFun() //{ // Thread.Sleep(3000); // m_MainThreadCloseLight = new CloseLight(CloseLight); // Invoke(m_MainThreadCloseLight); //用委托播放声音 //} //private void CloseLight() //{ // if (_measApp.IoLogik.ReadDO[0]) // { // _measApp.IoLogik.DO[0] = false; // _measApp.IoLogik.WriteDO(); // } //} /// <summary> /// 手工录入 /// </summary> private void SaveWeightDataByHand() { try { //DataRow dr = QueryPlanDataByBatchNo(txtZZBH.Text.Trim());//从预报内存表中查询某一批次的相关信息 //if (dr == null) //{ // MessageBox.Show("没有该批次的预报信息!", "提示", MessageBoxButtons.OK); //} string strMaterialCode = ""; if (cbWLMC.SelectedIndex > 0) { strMaterialCode = cbWLMC.SelectedValue.ToString(); } float p_FN_LENGTH = 0; string p_FS_BATCHNO = txtZZBH.Text.Trim();//批次号 m_szCurBatchNo = p_FS_BATCHNO; string p_FS_PRODUCTNO = txtDDH.Text.Trim();//订单号 if (p_FS_PRODUCTNO.Length == 9) { p_FS_PRODUCTNO = "000" + p_FS_PRODUCTNO; } string p_FS_ITEMNO = txtDDXMH.Text.Trim();//定单项目号 string p_FS_MATERIALNO = strMaterialCode;//物料代码 string p_FS_MATERIALNAME = cbWLMC.Text.Trim();//物料名称 string p_FS_MRP = ""; if (cbFHDW.SelectedIndex >= 0) { p_FS_MRP = cbFHDW.SelectedValue.ToString();//发货单位(车间名称) } string p_FS_STORE = ""; if (cbSHDW.SelectedIndex >= 0) { p_FS_STORE = cbSHDW.SelectedValue.ToString();//收货单位(库存点) } string p_FS_STEELTYPE = cbGZ.Text.Trim();//钢种 string p_FS_SPEC = cbGG.Text.Trim();//规格 WeightNo = Guid.NewGuid().ToString();//计量作业编号 string p_FS_WEIGHTNO = WeightNo; int p_FN_BANDBILLETCOUNT = 0;//支数 if (txtZS.Text.Trim().Length > 0) { p_FN_BANDBILLETCOUNT = Convert.ToInt32(txtZS.Text.Trim()); } string p_FS_TYPE = cbLXIN.Text.Trim();//类型 //if (cbDCCD.Text != "0") //p_FN_LENGTH = Convert.ToSingle(cbDCCD.Text.Trim()); if (!float.TryParse(cbDCCD.Text.Trim(), out p_FN_LENGTH)) { p_FN_LENGTH = 0; } //if (p_FS_TYPE == "非定尺" || p_FS_TYPE == "非定尺(3-6m)") //{ // p_FN_LENGTH = 0; // p_FN_BANDBILLETCOUNT = 0; //} double p_FN_WEIGHT = Convert.ToDouble(string.Format("{0:F3}", Single.Parse(this.tbx_hWeight.Text.Trim())));//重量 string p_FS_PERSON = m_szCurUser;//计量员 string p_FS_POINT = _measApp.Params.FS_POINTCODE;//计量点编号 string p_FS_SHIFT = m_szCurBC;//班次 string p_FS_TERM = m_szCurBZ; //string p_FS_LABELID = "00000000";//条码号 string p_FS_LABELID = p_FS_BATCHNO; string p_FS_FLOW = "";//流向 if (cbLX.SelectedIndex > 0) { p_FS_FLOW = cbLX.SelectedValue.ToString(); } float p_FN_DECWEIGHT = 0; if (txtYKL.Text.Trim().Length > 0) { p_FN_DECWEIGHT = Convert.ToSingle(string.Format("{0:F3}", Single.Parse(txtYKL.Text.Trim())));//应扣重量 } //判断重量是否超限 if (_weightStdManage != null) { try { _produtionWeightStd = _weightStdManage.GetStandard(p_FS_SPEC, p_FN_LENGTH.ToString()); if (_produtionWeightStd != null && (p_FN_WEIGHT * 1000 > _produtionWeightStd.MaxWeight || p_FN_WEIGHT * 1000 < _produtionWeightStd.MinWeight)) { messageForm.SetMessage("重量超出范围!"); } } catch (Exception ex) { } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "ygjzjl.bar.StoreageWeight_BC"; ccp.MethodName = "addBatchNo"; ccp.ServerParams = new object[] { p_FS_BATCHNO, p_FS_PRODUCTNO, p_FS_ITEMNO, p_FS_MATERIALNO, p_FS_MRP, p_FS_STORE, p_FS_STEELTYPE, p_FS_SPEC, p_FS_WEIGHTNO, p_FN_BANDBILLETCOUNT, p_FS_TYPE, p_FN_LENGTH, p_FN_WEIGHT, p_FS_PERSON, p_FS_POINT, p_FS_SHIFT, p_FS_TERM, p_FS_LABELID, p_FS_MATERIALNAME, p_FS_FLOW, p_FN_DECWEIGHT}; CoreClientParam ret = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); string reVal = ""; if (ret.ReturnCode != 0) { MessageBox.Show("数据保存失败!"); return; } else { reVal = ""; if (ccp.ReturnObject != null) { reVal = ccp.ReturnObject.ToString(); } //返回为空表示没有下一预报 if (reVal == "" || reVal != this.m_szCurBatchNo) { messageForm.SetMessage("批次" + txtZZBH.Text.Trim() + " 已完炉!"); this.bCompleteStove = true; ClearControl(); QueryWeightDataByBatchNo(); //自动跳到下一个预报,而不是第一条 for (int iNext = 0; iNext < ultraGrid1.Rows.Count; iNext++) { if (ultraGrid1.Rows[iNext].Cells["FS_BATCHNO"].Text.ToString() == m_szCurBatchNo) { if (iNext + 1 < ultraGrid1.Rows.Count) { m_szCurBatchNo = ultraGrid1.Rows[iNext+1].Cells["FS_BATCHNO"].Text.ToString(); } else { m_szCurBatchNo = ""; } break; } } m_WeightDataTable.Rows.Clear(); QueryLastStoveNo(); } else { messageForm.SetMessage("保存成功!"); QueryWeightDataByBatchNo(); bCompleteStove = false; } } QueryPlanData(); //存储图片 this._strBatchNo = p_FS_BATCHNO; this._strBandNo = GetMaxBandNoOfBatchNo(_strBatchNo); #region 自动播放语音 if (bCompleteStove) { m_AlarmVoicePath = Constant.RunPath + "\\sound\\计量完成 请离开秤台.wav"; } else { m_AlarmVoicePath = Constant.RunPath + "\\sound\\ProductComplete.wav"; } if (CustomInfo.Equals("BC01")) //只有棒材1#秤才播报计量结束 { if (chkAutoSave.Checked) { m_MainThreadAlarmVoice = new AlarmVoice(AutoAlarmVoice); Invoke(m_MainThreadAlarmVoice); //用委托播放声音 } else { AutoAlarmVoice(); } } #endregion #region 控制灯 if (_measApp.IoLogik != null && !_measApp.IoLogik.ReadDO()[0]) { _measApp.IoLogik.DO[0] = true; _measApp.IoLogik.WriteDO(); } #endregion #region 条码打印 DataRow dRow = QueryTheoryWeightByBatchNo(p_FS_WEIGHTNO); if (cbx_print.Checked) { if (_measApp.Printer != null) { _measApp.Printer.Data = new HgLable(); _measApp.Printer.PrinterName = new PrintDocument().PrinterSettings.PrinterName; _measApp.Printer.Data.BatchNo = p_FS_BATCHNO; //批次号 _measApp.Printer.Data.Spec = p_FS_SPEC;//规格 //_measApp.Printer.Data.Weight = (int)Math.Round((double.Parse(p_FN_WEIGHT.ToString().Trim()) * 1000)); //重量 _measApp.Printer.Data.Date = DateTime.Now; string strTerm = string.Empty; switch (UserInfo.GetUserGroup()) { case "1": strTerm = "A"; break; case "2": strTerm = "B"; break; case "3": strTerm = "C"; break; case "4": strTerm = "D"; break; default: strTerm = "A"; break; } _measApp.Printer.Data.Term = strTerm; //班别 _measApp.Printer.Data.PrintAddress = true; //地址 //查询标准 string sql = "select fs_Standard from BT_PRINTCARDSTANDARD t where t.fs_steeltype='" + p_FS_STEELTYPE.ToUpper() + "'"; CoreClientParam ccp9 = new CoreClientParam(); ccp9.ServerName = "ygjzjl.basedatamanage.OtherBaseInfo"; ccp9.MethodName = "ExcuteQuery"; ccp9.ServerParams = new object[] { sql }; DataTable db = new DataTable(); ccp9.SourceDataTable = db; this.ExecuteQueryToDataTable(ccp9, CoreInvokeType.Internal); if (db.Rows.Count > 0) { _measApp.Printer.Data.Standard = db.Rows[0][0].ToString(); } else { _measApp.Printer.Data.Standard = ""; } _measApp.Printer.Data.SteelType = p_FS_STEELTYPE; //牌号 _measApp.Printer.Data.Length = p_FN_LENGTH.ToString(); _measApp.Printer.Data.Count = p_FN_BANDBILLETCOUNT.ToString(); //支数 if (p_FS_TYPE == "非定尺" || p_FS_TYPE == "非定尺(3-6m)") { _measApp.Printer.Data.Count = "非"; } _measApp.Printer.Data.Type = LableType.BIG; string theoryWeight = "0"; //根据界面支数和规格 查询单捆重量 if (dRow != null) { _measApp.Printer.Data.BandNo = dRow["FN_BANDNO"].ToString(); theoryWeight = dRow["FN_THEORYWEIGHT"].ToString(); } else { _measApp.Printer.Data.BandNo = "1"; } _measApp.Printer.Data.BarCode = GetBarCode(p_FS_LABELID, _measApp.Printer.Data.BandNo); ; //条码号 //理重 if (checkBox1.Checked) { _measApp.Printer.Data.Weight = (double.Parse(theoryWeight.Trim()) * 1000).ToString(); _measApp.Printer.Copies = 2; _measApp.Printer.Print(); } if (checkBox2.Checked) { _measApp.Printer.Data.Weight = (p_FN_WEIGHT * 1000).ToString(); _measApp.Printer.Copies = 2; _measApp.Printer.Print(); } } } #endregion //上传垛帐系统 string strSql = "select e.fs_material from dt_productweightmain a, IT_PRODUCTDETAIL e where a.FS_PRODUCTNO = e.FS_PRODUCTNO(+) and a.fs_batchno='" + p_FS_BATCHNO + "'"; CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "ygjzjl.basedatamanage.OtherBaseInfo"; ccp2.MethodName = "ExcuteQuery"; ccp2.ServerParams = new object[] { strSql }; DataTable dt_materialno = new DataTable(); ccp2.SourceDataTable = dt_materialno; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); strMaterialno = dt_materialno.Rows[0][0].ToString(); DepotObject depotObj = new DepotObject(); depotObj.BatchNo = p_FS_BATCHNO; depotObj.BatchIndex = _strBandNo; depotObj.Weight = p_FN_WEIGHT.ToString(); depotObj.TheoryWeight = dRow["FN_THEORYWEIGHT"].ToString(); depotObj.Barcode = GetBarCode(p_FS_LABELID, _strBandNo); depotObj.Material = strMaterialno; _depotManage.UploadDepot(depotObj); } catch (System.Exception exp) { MessageBox.Show(exp.Message); } }
/// <summary> /// 保存计量信息 /// </summary> private void SaveWeightData() { //输入内容验证 if (CheckInput() == false) { return; } int i = m_iSelectedPound; try { double dbContent = 0; if (Convert.ToDouble(textMinWeight.Text) < Convert.ToDouble(txtXSZL.Text)) { dbContent = Convert.ToDouble(textMinWeight.Text) - Convert.ToDouble(txtXSZL.Text); dbContent = dbContent * 1000; if (DialogResult.No == MessageBox.Show("重量低于下限值" + dbContent.ToString() + "公斤,是否继续保存重量?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information)) { return; } } } catch { } //复磅 if (this.cbx_fb.CheckState == CheckState.Checked) { if (this.tb_zzbh_fb.Text.Trim() == "" || this.tb_bandno_fb.Text.Trim() == "") { MessageBox.Show("复磅信息不全!"); return; } if ((IsUpLoadForDetail(tb_zzbh_fb.Text.Trim(), this.tb_bandno_fb.Text.Trim())) == true) { MessageBox.Show("该数据已经上传,不允许复磅!"); return; } DoReWeightForBC(this.tb_zzbh_fb.Text.Trim(), this.tb_bandno_fb.Text.Trim(), this.txtXSZL.Text.Trim()); QueryPlanData(); #region 自动播放语音 m_AlarmVoicePath = Constant.RunPath + "\\sound\\ProductComplete.wav"; AutoAlarmVoice(); #endregion return; } //手工录入 if (this.cbx_Hand.CheckState == CheckState.Checked) { if (CheckIsNumber(this.tbx_hWeight.Text.Trim())) { SaveWeightDataByHand(); } else { MessageBox.Show("手工录入的重量不是有效的数字!"); } return; } if (_saved)//是否已经保存 { MessageBox.Show("数据已经保存过了,不允许再次保存!", "提示", MessageBoxButtons.OK); return; } if(txtXSZL.Text == "0.000") { MessageBox.Show("仪表数据为零,请联系管理员!"); return; } try { //DataRow dr = QueryPlanDataByBatchNo(txtZZBH.Text.Trim());//从预报内存表中查询某一批次的相关信息 //if (dr == null) //{ // MessageBox.Show("没有该批次的预报信息!", "提示", MessageBoxButtons.OK); //} string strMaterialCode = ""; if (cbWLMC.SelectedIndex > 0) { strMaterialCode = cbWLMC.SelectedValue.ToString(); } float p_FN_LENGTH = 0; string p_FS_BATCHNO = txtZZBH.Text.Trim();//批次号 m_szCurBatchNo = p_FS_BATCHNO; string p_FS_PRODUCTNO = txtDDH.Text.Trim();//订单号 if (p_FS_PRODUCTNO.Length == 9) { p_FS_PRODUCTNO = "000" + p_FS_PRODUCTNO; } string p_FS_ITEMNO = txtDDXMH.Text.Trim();//定单项目号 string p_FS_MATERIALNO = strMaterialCode;//物料代码 string p_FS_MATERIALNAME = cbWLMC.Text.Trim();//物料名称 string p_FS_MRP = ""; if (cbFHDW.SelectedIndex >= 0) { p_FS_MRP = cbFHDW.SelectedValue.ToString();//发货单位(车间名称) } string p_FS_STORE = ""; if (cbSHDW.SelectedIndex >= 0) { p_FS_STORE = cbSHDW.SelectedValue.ToString();//收货单位(库存点) } string p_FS_STEELTYPE = cbGZ.Text.Trim();//钢种 string p_FS_SPEC = cbGG.Text.Trim();//规格 WeightNo = Guid.NewGuid().ToString();//计量作业编号 string p_FS_WEIGHTNO = WeightNo; int p_FN_BANDBILLETCOUNT = 0;//支数 if (txtZS.Text.Trim().Length > 0) { p_FN_BANDBILLETCOUNT = Convert.ToInt32(txtZS.Text.Trim()); } string p_FS_TYPE = cbLXIN.Text.Trim();//类型 //if (cbDCCD.Text != "0") //p_FN_LENGTH = Convert.ToSingle(cbDCCD.Text.Trim()); if (!float.TryParse(cbDCCD.Text.Trim(), out p_FN_LENGTH)) { p_FN_LENGTH = 0; } //if (p_FS_TYPE == "非定尺" || p_FS_TYPE == "非定尺(3-6m)") //{ // p_FN_LENGTH = 0; // p_FN_BANDBILLETCOUNT = 0; //} double p_FN_WEIGHT = Convert.ToDouble(string.Format("{0:F3}", Single.Parse(this.txtZL.Text.Trim())));//重量 string p_FS_PERSON = UserInfo.GetUserName();//计量员 string p_FS_POINT = _measApp.Params.FS_POINTCODE;//计量点编号 string p_FS_SHIFT = UserInfo.GetUserOrder();//班次 string p_FS_TERM = UserInfo.GetUserGroup();//班别 //string p_FS_LABELID = "00000000";//条码号 string p_FS_LABELID = p_FS_BATCHNO; string strBarCode = GetBarCode(p_FS_BATCHNO,txtZS.Text); string p_FS_FLOW = "";//流向 if (cbLX.SelectedIndex > 0) { p_FS_FLOW = cbLX.SelectedValue.ToString(); } float p_FN_DECWEIGHT = 0; if (txtYKL.Text.Trim().Length > 0) { p_FN_DECWEIGHT = Convert.ToSingle(string.Format("{0:F3}", Single.Parse(txtYKL.Text.Trim())));//应扣重量 } //判断重量是否超限 if(_weightStdManage != null) { try { _produtionWeightStd = _weightStdManage.GetStandard(p_FS_SPEC, p_FN_LENGTH.ToString()); if (_produtionWeightStd != null && (p_FN_WEIGHT * 1000 > _produtionWeightStd.MaxWeight || p_FN_WEIGHT * 1000 < _produtionWeightStd.MinWeight)) { messageForm.SetMessage("重量超出范围!"); } } catch (Exception ex) { } } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "ygjzjl.bar.StoreageWeight_BC"; ccp.MethodName = "addBatchNo"; ccp.ServerParams = new object[] { p_FS_BATCHNO, p_FS_PRODUCTNO, p_FS_ITEMNO, p_FS_MATERIALNO, p_FS_MRP, p_FS_STORE, p_FS_STEELTYPE, p_FS_SPEC, p_FS_WEIGHTNO, p_FN_BANDBILLETCOUNT, p_FS_TYPE, p_FN_LENGTH, p_FN_WEIGHT, p_FS_PERSON, p_FS_POINT, p_FS_SHIFT, p_FS_TERM, strBarCode, p_FS_MATERIALNAME, p_FS_FLOW, p_FN_DECWEIGHT}; CoreClientParam ret = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); string reVal = ""; if (ret.ReturnCode != 0) { MessageBox.Show("数据保存失败!"); return; } else { reVal = ""; if (ccp.ReturnObject != null) { reVal = ccp.ReturnObject.ToString(); } //返回为空表示没有下一预报 if (reVal == "" || reVal != this.m_szCurBatchNo) { messageForm.SetMessage("批次" + txtZZBH.Text.Trim() + " 已完炉!"); bCompleteStove = true; ClearControl(); QueryWeightDataByBatchNo(); for (int iNext = 0; iNext < ultraGrid1.Rows.Count; iNext++) { if (ultraGrid1.Rows[iNext].Cells["FS_BATCHNO"].Text.ToString() == m_szCurBatchNo) { if (iNext + 1 < ultraGrid1.Rows.Count) { m_szCurBatchNo = ultraGrid1.Rows[iNext+1].Cells["FS_BATCHNO"].Text.ToString(); } else { m_szCurBatchNo = ""; } break; } } m_WeightDataTable.Rows.Clear(); //重新绑定新预报到界面 QueryLastStoveNo(); } else { messageForm.SetMessage("保存成功!"); QueryWeightDataByBatchNo(); bCompleteStove = false; } } //保存成功后保存和完炉按钮不可操作,直到下一吊上称后 //btnBC.Enabled = false; _saved = true; QueryPlanData(); //存储图片 this._strBatchNo = p_FS_BATCHNO; this._strBandNo = GetMaxBandNoOfBatchNo(_strBatchNo); GraspAndSaveImage(); #region RTU控制 try { //if (m_iSelectedPound >= 0 && _measApp.Rtu != null) //{ // _measApp.Rtu.SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xDF - 1), (byte)0x00, (byte)0); // _measApp.Rtu.SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xDD - 1), (byte)0xFF, (byte)0); // _measApp.Rtu.SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xE0 - 1), (byte)0x00, (byte)0); // _measApp.Rtu.SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xE0 - 1), (byte)0xFF, (byte)0); //} } catch (Exception e) { WriteLog("SaveWeightData RTU控制命令发送失败"); } #endregion #region 自动播放语音 if (bCompleteStove) //完炉 { m_AlarmVoicePath = Constant.RunPath + "\\sound\\计量完成 请离开秤台.wav"; } else { m_AlarmVoicePath = Constant.RunPath + "\\sound\\ProductComplete.wav"; } if (CustomInfo.Equals("BC01")) //只有棒材1#秤才播报计量结束 { if (chkAutoSave.Checked) { m_MainThreadAlarmVoice = new AlarmVoice(AutoAlarmVoice); Invoke(m_MainThreadAlarmVoice); //用委托播放声音 } else { AutoAlarmVoice(); } } #endregion #region 条码打印 DataRow dRow = QueryTheoryWeightByBatchNo(p_FS_WEIGHTNO); if (cbx_print.Checked) { if (_measApp.Printer != null) { _measApp.Printer.Data = new HgLable(); _measApp.Printer.Data.BatchNo = p_FS_BATCHNO; //批次号 _measApp.Printer.PrinterName = new PrintDocument().PrinterSettings.PrinterName; _measApp.Printer.Data.Spec = p_FS_SPEC;//规格 //_measApp.Printer.Data.Weight = (int)Math.Round((double.Parse(p_FN_WEIGHT.ToString().Trim()) * 1000)); //重量 _measApp.Printer.Data.Date = DateTime.Now; string strTerm = string.Empty; switch (UserInfo.GetUserGroup()) { case "1": strTerm = "A"; break; case "2": strTerm = "B"; break; case "3": strTerm = "C"; break; case "4": strTerm = "D"; break; default: strTerm = "A"; break; } _measApp.Printer.Data.Term = strTerm; //班别 _measApp.Printer.Data.PrintAddress = true; //地址 string sql = "select fs_Standard from BT_PRINTCARDSTANDARD t where t.fs_steeltype='" + p_FS_STEELTYPE.ToUpper() + "'"; CoreClientParam ccp9 = new CoreClientParam(); ccp9.ServerName = "ygjzjl.basedatamanage.OtherBaseInfo"; ccp9.MethodName = "ExcuteQuery"; ccp9.ServerParams = new object[] { sql }; DataTable db = new DataTable(); ccp9.SourceDataTable = db; this.ExecuteQueryToDataTable(ccp9, CoreInvokeType.Internal); if (db.Rows.Count > 0) { _measApp.Printer.Data.Standard = db.Rows[0][0].ToString(); } else { _measApp.Printer.Data.Standard = ""; } //if (p_FS_STEELTYPE.ToUpper() == "22MNB") //{ // _measApp.Printer.Data.Standard = "KGB.4 3001"; //} //else if (p_FS_STEELTYPE.ToUpper() == "18B") //{ // _measApp.Printer.Data.Standard = "KGB.3 3001"; //} //else //{ // _measApp.Printer.Data.Standard = ""; //标准 //} _measApp.Printer.Data.SteelType = p_FS_STEELTYPE; //牌号 _measApp.Printer.Data.Length = p_FN_LENGTH.ToString(); _measApp.Printer.Data.Count = p_FN_BANDBILLETCOUNT.ToString(); //支数 if (p_FS_TYPE == "非定尺" || p_FS_TYPE == "非定尺(3-6m)") { _measApp.Printer.Data.Count = "非"; } _measApp.Printer.Data.Type = LableType.BIG; string theoryWeight = "0"; //根据界面支数和规格 查询单捆重量 if (dRow != null) { _measApp.Printer.Data.BandNo = dRow["FN_BANDNO"].ToString(); theoryWeight = dRow["FN_THEORYWEIGHT"].ToString(); } else { _measApp.Printer.Data.BandNo = "1"; } _measApp.Printer.Data.BarCode = GetBarCode(p_FS_LABELID, _measApp.Printer.Data.BandNo); //条码号 //理重 if (checkBox1.Checked) { _measApp.Printer.Data.Weight = (double.Parse(theoryWeight.Trim()) * 1000).ToString(); _measApp.Printer.Copies = 2; _measApp.Printer.Print(); } if (checkBox2.Checked) { _measApp.Printer.Data.Weight = (p_FN_WEIGHT * 1000).ToString(); _measApp.Printer.Copies = 2; _measApp.Printer.Print(); } } } //上传垛帐系统 string strSql = "select e.fs_material from dt_productweightmain a, IT_PRODUCTDETAIL e where a.FS_PRODUCTNO = e.FS_PRODUCTNO(+) and a.fs_batchno='" + p_FS_BATCHNO + "'"; CoreClientParam ccp2 = new CoreClientParam(); ccp2.ServerName = "ygjzjl.basedatamanage.OtherBaseInfo"; ccp2.MethodName = "ExcuteQuery"; ccp2.ServerParams = new object[] { strSql }; DataTable dt_materialno = new DataTable(); ccp2.SourceDataTable = dt_materialno; this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal); strMaterialno = dt_materialno.Rows[0][0].ToString(); DepotObject depotObj = new DepotObject(); depotObj.BatchNo = p_FS_BATCHNO; depotObj.BatchIndex = _strBandNo; depotObj.Weight = p_FN_WEIGHT.ToString(); depotObj.TheoryWeight = dRow["FN_THEORYWEIGHT"].ToString(); depotObj.Barcode = GetBarCode(p_FS_LABELID, _strBandNo); depotObj.Material = strMaterialno; _depotManage.UploadDepot(depotObj); #endregion #region 自动下载新的订单信息 if (this.txtDDH.Text.Trim() != p_FS_PRODUCTNO) { //messageForm.SetMessage("已使用新的订单号,系统将自动下载新的订单信息!"); //Thread.Sleep(2000); //GetOrderInfo(this.txtDDH.Text.Trim()); } #endregion } catch (System.Exception exp) { MessageBox.Show(exp.Message); } }
private void upLoadData() { // downSprueflosInfo("5000452515", "20071481"); if (uGridData.Rows.Count == 0) { lstHint2.Items.Add("错误:没有需要上传的数据!"); return; } //if (!ckQR1.Checked) //{ // MessageBox.Show("只有查询模式为【已确认】,才允许进行上传操作!"); // return; //} //if (uGridData.Rows[0].Cells["FS_ISMATCH"].Value.ToString() == "0") //{ // MessageBox.Show("你可能没有执行数据修改操作!"); // return; //} string strTmpMater, strTmpOrder, strTmpBatch1, strTmpBatch2, strTmpValue, strTmpJzrq, strTmpPrebatch; strTmpMater = ""; string strTmpNo = ""; decimal dTmpZl = 0; System.Data.DataRow[] tmpRow; ArrayList listBatch = new ArrayList(); string[] strTmpHeader = new string[] { "", "", "" }; string[] strTmpUpload = new string[] { "", "", "", "", "", "", "", "", "", "", "", "" }; CoreClientParam ccp = new CoreClientParam(); String strTmpRfc = "BAPI_GOODSMVT_CREATE"; String strTmpCode = "02"; strTmpOrder = ""; tmpRow = dataSet1.Tables[0].Select("FS_ISMATCH='1' AND FS_UPLOADFLAG='0'", "FS_BATCHNO,FN_BANDNO"); DepotObject forWeight = new DepotObject(); DepotManage fw = new DepotManage(); for (int i = 0; i < tmpRow.Length; i++) { ArrayList listItem = new ArrayList(); ArrayList listSubItem = new ArrayList(); // if (tmpRow[i].Cells["FS_ISMATCH"].Value.ToString() == "0") continue; // if (!chkDataInfo(i)) continue; listBatch.Add(tmpRow[i]["FN_BANDNO"].ToString()); strTmpBatch1 = tmpRow[i]["FS_BATCHNO"].ToString().Substring(0, 8); strTmpBatch2 = (i < (tmpRow.Length - 1)) ? tmpRow[i + 1]["FS_BATCHNO"].ToString().Substring(0, 8) : tmpRow[i]["FS_BATCHNO"].ToString().Substring(0, 8); if (ckTheory.Checked) dTmpZl += Convert.ToDecimal(tmpRow[i]["FN_THEORYWEIGHT"]); else dTmpZl += Convert.ToDecimal(tmpRow[i]["FN_WEIGHT"]); ///////////////////////////////////2012-12-5 杨滔新增 在上传sap时,更新跺帐里面的重量 //try //{ // forWeight.BatchNo = strTmpBatch1; // forWeight.BatchIndex = tmpRow[i]["FN_BANDNO"].ToString(); // forWeight.Weight = tmpRow[i]["FN_WEIGHT"].ToString(); // forWeight.TheoryWeight = tmpRow[i]["FN_THEORYWEIGHT"].ToString(); // fw.UpWeight(forWeight); //} //catch (Exception e) //{ } ///////////////////////////////////// if ((strTmpBatch1 != strTmpBatch2) || (i == (tmpRow.Length - 1))) { strTmpJzrq = Convert.ToDateTime(tmpRow[i]["FS_ACCOUNTDATE"]).ToString("yyyy-MM-dd"); strTmpHeader[0] = Convert.ToDateTime(tmpRow[i]["FS_ACCOUNTDATE"]).ToString("yyyy.MM.dd"); strTmpHeader[1] = Convert.ToDateTime(tmpRow[i]["FS_ACCOUNTDATE"]).ToString("yyyy.MM.dd"); strTmpHeader[2] = tmpRow[i]["FS_HEADER"].ToString(); strTmpOrder = tmpRow[i]["FS_PRODUCTNO"].ToString(); strTmpMater = getMaterial(strTmpOrder); strTmpNo = tmpRow[i]["FS_BATCHNO"].ToString(); strTmpPrebatch = tmpRow[i]["FS_GP_STOVENO"].ToString(); listSubItem.Clear(); listItem.Clear(); listSubItem.Add(strTmpMater);//物料编号 listSubItem.Add("1100");//工厂 listSubItem.Add(tmpRow[i]["FS_SAPSTORE"].ToString());//库存地点 listSubItem.Add(strTmpNo);//批次 listSubItem.Add("101");//移动类型101 listSubItem.Add("");//库存类型 listSubItem.Add("");//特殊库存标识 listSubItem.Add(dTmpZl.ToString());//发货数量 listSubItem.Add("TON");//收货时的计量单位 listSubItem.Add("0001");//项目文本 listSubItem.Add(strTmpOrder);//生产订单编号 listSubItem.Add("F");//移动标识'F' listSubItem.Add("");//销售订单号 listSubItem.Add("");//销售订单行项目 listItem.Add(listSubItem); strTmpUpload[0] = strTmpMater; strTmpUpload[1] = "101"; strTmpUpload[3] = tmpRow[i]["FS_PRODUCTNO"].ToString(); strTmpUpload[4] = strTmpNo; strTmpUpload[5] = Convert.ToDateTime(this.GetServerTime()).ToString("yyyy-MM-dd HH:mm:ss"); strTmpUpload[7] = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(); strTmpUpload[8] = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserID(); strTmpUpload[9] = tmpRow[i]["FS_ITEMNO"].ToString(); strTmpUpload[10] = strTmpUpload[5]; ccp.ServerName = "ygjzjl.sap.UploadSapRfc"; ccp.MethodName = "up_Product"; ccp.ServerParams = new object[] { strTmpRfc, strTmpHeader, strTmpCode, listItem }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); string sTmp; if (ccp.ReturnCode == 0) { sTmp = ccp.ReturnObject.ToString(); strTmpValue = "FS_UPLOADFLAG='1',FS_SPRUEFLOS='" + sapClass.downSprueflosInfo(sTmp) + "'"; // downSprueflosInfo(sTmp, strTmpNo); upTheoryWt(strTmpNo, strTmpHeader[0], strTmpOrder, strTmpMater, Convert.ToDateTime(tmpRow[i]["GBSJ"]).ToString("yyyy.MM.dd"), tmpRow[i]["FS_SPEC"].ToString(), tmpRow[i]["FS_HEADER"].ToString()); //sapClass.insChemCopy(strTmpMater, tmpRow[i]["FS_PLANT"].ToString(), // strTmpNo, tmpRow[i]["FS_GP_STOVENO"].ToString()); strTmpUpload[2] = sTmp + "-" + tmpRow[i]["FS_BATCHNO"].ToString(); strTmpUpload[6] = dTmpZl.ToString(); sTmp = "炉号为" + strTmpNo + "-凭证号" + sTmp + "-上传重量" + dTmpZl.ToString(); sapClass.uptDataFlag("DT_PRODUCTWEIGHTMAIN", "FS_UPLOADFLAG='1',FS_MATERIALNO='" + strTmpMater + "'", "FS_BATCHNO='" + strTmpNo + "' AND FS_ACCOUNTDATE='" + strTmpJzrq + "'"); for (int j = 0; j < listBatch.Count; j++) { sapClass.uptDataFlag("DT_PRODUCTWEIGHTDETAIL", strTmpValue, "FS_BATCHNO='" + strTmpNo + "' AND FN_BANDNO=" + listBatch[j]); } listBatch.Clear(); // sapClass.uptSapLog(strTmpNo, sapClass.strArrayUpload); uptSapLog(strTmpNo, strTmpUpload); // sapClass.insMssqlData(1, "chemCopy", "PSTING_DATE,BATCH,PLANT,preBatch,MATERIAL", // "'" + strTmpJzrq + "','" + strTmpNo + "','1100','" + strTmpPrebatch + "','" + strTmpMater // + "'"); sTmp += ",数据上传成功!"; //垛帐接口 //垛帐接口 DepotManage dm = new DepotManage(); bool flag = dm.UpdateMaterial(strTmpNo, strTmpMater); } else { sTmp = ccp.ReturnInfo; } //upTheoryWt("20080556", "2010.08.08", "000200017617", "BHRB3E0320011", "2010.08.08","HRB335E", "丙早"); dTmpZl = 0;//清0 lstHint2.Items.Add(sTmp); } } showGridInfo(); }
public bool UpWeight(DepotObject depotObject) { SqlAdapter.ConnectionString = _connstr; return SqlAdapter.Run(string.Format(_uwsql, depotObject.Weight, depotObject.TheoryWeight, depotObject.BatchNo + depotObject.BatchIndex)); }
public bool UploadDepot(DepotObject depotObject) { SqlAdapter.ConnectionString = _connstr; return SqlAdapter.Run(string.Format(_isql, new object[] { depotObject.BatchNo + depotObject.BatchIndex, depotObject.Weight, depotObject.TheoryWeight, depotObject.Barcode, depotObject.Material })); }