/// <summary> /// 钢坯信息冲销 /// </summary> private void unLoadData() { string strTmpWhere; if ((uGridData.Selected.Rows.Count == 0) || (strOptNo == "")) { MessageBox.Show("请先双击要修改的数据行,只能单行操作,不支持批量修改!"); return; } if (DialogResult.Yes == MessageBox.Show("该操作将导致" + strOptNo + "上传标志被复位,可能导致SAP数据重复,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information)) { strTmpWhere = "FS_BATCHNO='" + strOptNo + "' AND FS_ACCOUNTDATE='" + strOptJzrq + "'"; string strTmpTable, strTmpField; strTmpTable = "DT_GX_STORAGEWEIGHTMAIN"; strTmpField = "FS_UPLOADFLAG='0'"; sapClass.uptDataFlag(strTmpTable, strTmpField, strTmpWhere); strTmpTable = "DT_GX_STORAGEWEIGHTDETAIL"; strTmpField = "FS_UPLOADFLAG='0',FS_ISMATCH='0',FS_UPFLAG='0'"; sapClass.uptDataFlag(strTmpTable, strTmpField, strTmpWhere); showGridInfo(); dataSet1.Tables[2].Clear(); lblScr.Text = ""; lblOpt.Text = "当前操作:"; } }
/// <summary> /// 钢坯信息冲销 /// </summary> private void unLoadData() { if ((uGridData.Selected.Rows.Count == 0) || (strOptNo == "")) { MessageBox.Show("请先双击要修改的数据行,只能单行操作,不支持批量修改!"); return; } string strTmpNo = ""; if (DialogResult.Yes == MessageBox.Show("该操作将导致" + strOptNo + "上传标志被复位,可能导致SAP数据重复,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information)) { strTmpNo = "FS_STOVENO='" + strOptNo + "'"; string strTmpTable, strTmpField; strTmpTable = "DT_CARWEIGHT_WEIGHT"; strTmpField = "FS_UPLOADFLAG='0'"; sapClass.uptDataFlag(strTmpTable, strTmpField, strTmpNo); showGridInfo(); lblScr.Text = ""; lblOpt.Text = "当前操作:"; } }
private void upLoadData() { if (uGridData.Rows.Count == 0) { lstHint2.Items.Add("错误:没有需要上传的数据!"); return; } string strTmpMater, strTmpOrder, strTmpBatch1, strTmpBatch2, strTmpValue, strTmpJzrq, strTmpPrebatch; strTmpMater = ""; string strTmpNo = ""; decimal dTmpZl = 0; string[] strTmpHeader = new string[] { "", "", "" }; ArrayList listSubItem = new ArrayList(); ArrayList listBatch = new ArrayList(); strTmpOrder = ""; dTmpZl = 0; System.Data.DataRow[] tmpRow; //edit tmpRow = dataSet1.Tables[0].Select("FS_ISMATCH='1' AND FS_UPLOADFLAG='0'", "FS_BATCHNO,FN_BANDNO"); for (int i = 0; i < tmpRow.Length; i++) { //strTmpOrder = tmpRow[i]["FS_PRODUCTNO"].ToString(); //strTmpMater = sapClass.getMaterial(strTmpOrder); //strTmpNo = (tmpRow[i]["FS_BATCHNO"].ToString()); ////strTmpNo = (tmpRow[i]["FN_BANDNO"].ToString().Length == 1) //// ? tmpRow[i]["FS_BATCHNO"].ToString() + "0" + tmpRow[i]["FN_BANDNO"].ToString() //// : tmpRow[i]["FS_BATCHNO"].ToString() + tmpRow[i]["FN_BANDNO"].ToString(); //sapClass.batchValueUp(strTmpMater, strTmpNo, "8000"); //break; 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); dTmpZl += Convert.ToDecimal(tmpRow[i]["FN_WEIGHT"]); 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 = sapClass.getMaterial(strTmpOrder); strTmpNo = tmpRow[i]["FS_BATCHNO"].ToString(); strTmpPrebatch = tmpRow[i]["FS_GP_STOVENO"].ToString(); listSubItem.Clear(); listSubItem.Add(strTmpMater); //物料编号 listSubItem.Add(tmpRow[i]["FS_PLANT"].ToString()); //工厂 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(""); //销售订单行项目 string sTmp = sapClass.BAPI_GOODSMVT_CREATE("02", strTmpHeader, listSubItem); if (sTmp != "") { strTmpValue = "FS_UPLOADFLAG='1',FS_SPRUEFLOS='" + sapClass.downSprueflosInfo(sTmp) + "'"; sapClass.strArrayUpload[2] = sTmp + "-" + tmpRow[i]["FS_BATCHNO"].ToString(); sapClass.strArrayUpload[6] = dTmpZl.ToString(); sTmp = "炉号为" + strTmpBatch1 + "-凭证号" + sTmp + "-上传重量" + dTmpZl.ToString(); // sapClass.insChemCopy(strTmpMater, tmpRow[i]["FS_PLANT"].ToString(), // strTmpNo, tmpRow[i]["FS_GP_STOVENO"].ToString()); sapClass.uptDataFlag("DT_GX_STORAGEWEIGHTMAIN", "FS_UPLOADFLAG='1',FS_MATERIALNO='" + strTmpMater + "'", "FS_BATCHNO='" + strTmpNo + "' AND FS_ACCOUNTDATE='" + strTmpJzrq + "'"); //sapClass.uptDataFlag("DT_GX_STORAGEWEIGHTDETAIL", "FS_UPLOADFLAG='1'", "FS_BATCHNO='" + strTmpNo //+ "' AND FS_ACCOUNTDATE='" + strTmpJzrq + "'"); for (int j = 0; j < listBatch.Count; j++) { sapClass.uptDataFlag("DT_GX_STORAGEWEIGHTDETAIL", strTmpValue, "FS_BATCHNO='" + strTmpNo + "' AND FN_BANDNO=" + listBatch[j]); } listBatch.Clear(); sapClass.uptSapLog(strTmpNo, sapClass.strArrayUpload); // sapClass.insMssqlData(1, "chemCopy", "PSTING_DATE,BATCH,PLANT,preBatch,MATERIAL", // "'" + strTmpJzrq + "','" + strTmpBatch1 + "','" // + "1100','" + strTmpPrebatch + "','" + strTmpMater + "'"); sTmp += ",数据上传成功!"; //垛帐接口 DepotManage dm = new DepotManage(); bool flag = dm.UpdateMaterial(strTmpNo, strTmpMater); //dTmpZl = 0;//清0 lstHint2.Items.Add(sTmp); } else { lstHint2.Items.Add(sapClass.strSapError); } dTmpZl = 0; } } showGridInfo(); }
private void upLoadData() { if (uGridData.Rows.Count == 0) { lstHint2.Items.Add("错误:没有需要上传的数据!"); return; } string strTmpMater, strTmpOrder, strTmpValue; strTmpMater = ""; string strTmpNo = ""; decimal dTmpZl = 0; string[] strTmpHeader = new string[] { "", "", "" }; ArrayList listSubItem = new ArrayList(); strTmpOrder = ""; dTmpZl = 0; for (int i = 0; i < uGridData.Rows.Count; i++) { if (!chkDataInfo(i)) { continue; } if (uGridData.Rows[i].Cells["FS_UPLOADFLAG"].Value.ToString() == "0") { strTmpHeader[0] = Convert.ToDateTime(uGridData.Rows[i].Cells["FS_ACCOUNTDATE"].Value).ToString("yyyy.MM.dd"); strTmpHeader[1] = Convert.ToDateTime(uGridData.Rows[i].Cells["FS_ACCOUNTDATE"].Value).ToString("yyyy.MM.dd"); strTmpHeader[2] = uGridData.Rows[i].Cells["FS_HEADER"].Value.ToString(); strTmpOrder = uGridData.Rows[i].Cells["FS_PRODUCTNO"].Value.ToString(); strTmpMater = uGridData.Rows[i].Cells["FS_MATERIAL"].Value.ToString(); strTmpNo = uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString(); dTmpZl = Convert.ToDecimal(uGridData.Rows[i].Cells["FN_NETWEIGHT"].Value); //sapClass.execute261(strTmpPrebatch); listSubItem.Clear(); listSubItem.Add(strTmpMater); //物料编号 listSubItem.Add(uGridData.Rows[i].Cells["FS_PLANT"].Value.ToString()); //工厂 listSubItem.Add(uGridData.Rows[i].Cells["FS_SAPSTORE"].Value.ToString()); //库存地点 listSubItem.Add(strTmpNo); //批次 listSubItem.Add("261"); //移动类型101 listSubItem.Add(dTmpZl.ToString()); //发货数量 listSubItem.Add("TON"); //收货时的计量单位 listSubItem.Add(strTmpOrder); //生产订单编号 listSubItem.Add("0001"); //生产订单行项目号 string sTmp = sapClass.BAPI_GOODSMVT_CREATE("03", strTmpHeader, listSubItem); if (sTmp != "") { strTmpValue = "FS_UPLOADFLAG='1',FD_TOCENTERTIME=sysdate"; sapClass.strArrayUpload[2] = sTmp + "-" + uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString(); sapClass.strArrayUpload[6] = dTmpZl.ToString(); sTmp = "炉号" + uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString() + "-凭证号" + sTmp + "-上传重量" + dTmpZl.ToString(); sapClass.uptDataFlag("DT_SAP261", strTmpValue, "FS_STOVENO='" + strTmpNo + "' AND FS_PRODUCTNO='" + strTmpOrder + "'"); sapClass.uptSapLog(strTmpNo, sapClass.strArrayUpload); sTmp += ",发料成功!"; lstHint2.Items.Add(sTmp); } else { lstHint2.Items.Add(sapClass.strSapError); } } } showGridInfo(); }
private void upLoadData() { if (uGridData.Rows.Count == 0) { lstHint2.Items.Add("错误:没有需要上传的数据!"); return; } string strTmpMater, strTmpOrder; strTmpMater = ""; string strTmpNo = "", strTmpBatch1, strTmpBatch2; decimal dTmpZl = 0; System.Data.DataRow[] tmpRow; string[] strTmpHeader = new string[] { "", "", "" }; strTmpOrder = ""; tmpRow = dataSet1.Tables[0].Select("FS_ISMATCH='1' AND FS_UPLOADFLAG='0'", "FS_STOVENO"); for (int i = 0; i < tmpRow.Length; i++) { ArrayList listSubItem = new ArrayList(); strTmpBatch1 = tmpRow[i]["FS_STOVENO"].ToString().Substring(0, 9); strTmpBatch2 = (i < (tmpRow.Length - 1)) ? tmpRow[i + 1]["FS_STOVENO"].ToString().Substring(0, 9) : tmpRow[i]["FS_STOVENO"].ToString().Substring(0, 9); dTmpZl += Convert.ToDecimal(tmpRow[i]["FN_NETWEIGHT"]); // if (!chkDataInfo(i)) continue; if ((strTmpBatch1 != strTmpBatch2) || (i == (tmpRow.Length - 1))) { 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] = ""; // dTmpZl = Convert.ToDecimal(tmpRow[i]["FN_NETWEIGHT"]); strTmpOrder = tmpRow[i]["FS_PRODUCTNO"].ToString(); strTmpMater = sapClass.getMaterial(strTmpOrder); // strTmpNo = tmpRow[i]["FS_STOVENO"].ToString(); strTmpNo = strTmpBatch1; listSubItem.Add(strTmpMater); //物料编号 listSubItem.Add(tmpRow[i]["FS_PLANT"].ToString()); //工厂 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(""); //销售订单行项目 //string sTmp = sapClass.BAPI_GOODSMVT_CREATE(strTmpHeader, listSubItem); string sTmp = sapClass.BAPI_GOODSMVT_CREATE("02", strTmpHeader, listSubItem); if (sTmp != "") { // sapClass.strArrayUpload[2] = sTmp + "-" + tmpRow[i]["FS_STOVENO"].ToString(); sapClass.strArrayUpload[2] = sTmp + "-" + strTmpNo; sapClass.strArrayUpload[6] = dTmpZl.ToString(); // sTmp = "炉号为" + tmpRow[i]["FS_STOVENO"].ToString() + "-凭证号" + sTmp; sTmp = "炉号为" + strTmpNo + "-凭证号" + sTmp + "-上传重量" + dTmpZl.ToString();; // sapClass.ins261Data(strTmpMater, dTmpZl.ToString(), strTmpNo, uGridData.Rows[i].Cells["FS_SAPSTORE"].ToString()); //sapClass.uptDataFlag("DT_SteelWeightMain", "FS_UPLOADFLAG='1'", "FS_STOVENO='" + strTmpNo + "'"); sapClass.uptDataFlag("DT_SteelWeightMain", "FS_UPLOADFLAG='1'", "FS_STOVENO like '%" + strTmpNo + "%'"); sapClass.uptSapLog(strTmpNo, sapClass.strArrayUpload); sTmp += ",数据上传成功!"; lstHint2.Items.Add(sTmp); } else { lstHint2.Items.Add(sapClass.strSapError); } dTmpZl = 0; //清0 } } showGridInfo(); }
private void upLoadData() { if (uGridData.Rows.Count == 0) { lstHint2.Items.Add("错误:没有需要上传的数据!"); return; } string strTmpMater, strTmpOrder; strTmpMater = ""; string strTmpNo = ""; decimal dTmpZl = 0; string[] strTmpHeader = new string[] { "", "", "" }; strTmpOrder = ""; string[] strCovertStoveno; string strTmpBatch1 = ""; for (int i = 0; i < uGridData.Rows.Count; i++) { ArrayList listSubItem = new ArrayList(); if (!chkDataInfo(i)) { continue; } if (uGridData.Rows[i].Cells["FS_UPLOADFLAG"].Value.ToString() == "0") { strTmpHeader[0] = Convert.ToDateTime(uGridData.Rows[i].Cells["FS_ACCOUNTDATE"].Value).ToString("yyyy.MM.dd"); strTmpHeader[1] = Convert.ToDateTime(uGridData.Rows[i].Cells["FS_ACCOUNTDATE"].Value).ToString("yyyy.MM.dd"); strTmpHeader[2] = ""; dTmpZl = Convert.ToDecimal(uGridData.Rows[i].Cells["FN_NETWEIGHT"].Value); strTmpOrder = uGridData.Rows[i].Cells["FS_PRODUCTNO"].Value.ToString(); strTmpMater = sapClass.getMaterial(strTmpOrder); //strTmpNo = uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString(); strTmpBatch1 = uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString(); strTmpNo = strTmpBatch1; strCovertStoveno = strTmpBatch1.Split('-'); if (strCovertStoveno.Length > 1) { int inBlock = int.Parse(strCovertStoveno[1]); if (inBlock >= 10) { //string strBlock = inBlock.ToString(); strTmpNo = strCovertStoveno[0].ToString() + ((char)(inBlock + 55)).ToString();//将10以上的块号转换为大写字母 } else { strTmpNo = strCovertStoveno[0].ToString() + strCovertStoveno[1].ToString(); } } listSubItem.Add(strTmpMater); //物料编号 listSubItem.Add(uGridData.Rows[i].Cells["FS_PLANT"].Value.ToString()); //工厂 listSubItem.Add(uGridData.Rows[i].Cells["FS_SAPSTORE"].Value.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(""); //销售订单行项目 //string sTmp = sapClass.BAPI_GOODSMVT_CREATE(strTmpHeader, listSubItem); string sTmp = sapClass.BAPI_GOODSMVT_CREATE("02", strTmpHeader, listSubItem); if (sTmp != "") { sapClass.strArrayUpload[2] = sTmp + "-" + uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString(); sapClass.strArrayUpload[6] = dTmpZl.ToString(); sTmp = "炉号为" + uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString() + "-凭证号" + sTmp; // sapClass.ins261Data(strTmpMater, dTmpZl.ToString(), strTmpNo, uGridData.Rows[i].Cells["FS_SAPSTORE"].Value.ToString()); sapClass.uptDataFlag("DT_CARWEIGHT_WEIGHT", "FS_UPLOADFLAG='1'", "FS_STOVENO='" + strTmpBatch1 + "'"); sapClass.uptSapLog(strTmpNo, sapClass.strArrayUpload); sTmp += ",数据上传成功!"; lstHint2.Items.Add(sTmp); } else { lstHint2.Items.Add(sapClass.strSapError); } } } showGridInfo(); }
private void upLoadData() { if (uGridData.Rows.Count == 0) { lstHint2.Items.Add("错误:没有需要上传的数据!"); return; } string strTmpMater, strTmpOrder; strTmpMater = ""; string strTmpNo = ""; string strXmh = ""; decimal dTmpZl = 0; string[] strTmpHeader = new string[] { "", "", "" }; CoreClientParam ccp = new CoreClientParam(); strTmpOrder = ""; String strTmpRfc = "BAPI_GOODSMVT_CREATE"; String strTmpCode = "01"; for (int i = 0; i < uGridData.Rows.Count; i++) { ArrayList listItem = new ArrayList(); ArrayList listSubItem = new ArrayList(); if (!chkDataInfo(i)) { continue; } if (uGridData.Rows[i].Cells["FS_UPLOADFLAG"].Value.ToString() == "0") { strTmpHeader[0] = Convert.ToDateTime(uGridData.Rows[i].Cells["FS_ACCOUNTDATE"].Value).ToString("yyyy.MM.dd"); strTmpHeader[1] = Convert.ToDateTime(uGridData.Rows[i].Cells["FS_ACCOUNTDATE"].Value).ToString("yyyy.MM.dd"); strTmpHeader[2] = ""; dTmpZl = Convert.ToDecimal(uGridData.Rows[i].Cells["FN_NETWEIGHT"].Value); strTmpOrder = uGridData.Rows[i].Cells["FS_PRODUCTNO"].Value.ToString(); strTmpMater = uGridData.Rows[i].Cells["FS_MATERIALNO"].Value.ToString(); strTmpNo = uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString(); strXmh = uGridData.Rows[i].Cells["FS_ITEMNO"].Value.ToString(); listItem.Clear(); listSubItem.Clear(); listSubItem.Add(strTmpMater); //物料编号 listSubItem.Add(uGridData.Rows[i].Cells["FS_PLANT"].Value.ToString()); //工厂 listSubItem.Add(uGridData.Rows[i].Cells["FS_SAPSTORE"].Value.ToString()); //库存地点 listSubItem.Add(strTmpNo); //批次 listSubItem.Add("101"); //移动类型101 listSubItem.Add(""); //库存类型 listSubItem.Add(""); //特殊库存标识 listSubItem.Add(dTmpZl.ToString()); //发货数量 listSubItem.Add("TON"); //收货时的计量单位 listSubItem.Add(strXmh); //项目文本 listSubItem.Add(strTmpOrder); //生产订单编号 listSubItem.Add("B"); //移动标识'F' listSubItem.Add(""); //销售订单号 listSubItem.Add(""); //销售订单行项目 listItem.Add(listSubItem); ccp.ServerName = "ygjzjl.sap.UploadSapRfc"; ccp.MethodName = "up_ContractForZG"; //string sTmp = sapClass.BAPI_GOODSMVT_CREATE(strTmpHeader, listSubItem); //string sTmp = sapClass.BAPI_GOODSMVT_CREATE("01",strTmpHeader, listSubItem); ccp.ServerParams = new object[] { strTmpRfc, strTmpHeader, strTmpCode, listItem }; this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); string sTmp; sTmp = ccp.ReturnObject.ToString(); if (sTmp != "") { sTmp = ccp.ReturnObject.ToString(); sapClass.strArrayUpload[2] = sTmp + "-" + uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString(); sapClass.strArrayUpload[6] = dTmpZl.ToString(); sTmp = "炉号为" + uGridData.Rows[i].Cells["FS_STOVENO"].Value.ToString() + "-凭证号" + sTmp; // sapClass.ins261Data(strTmpMater, dTmpZl.ToString(), strTmpNo, uGridData.Rows[i].Cells["FS_SAPSTORE"].Value.ToString()); sapClass.uptDataFlag("DT_CARWEIGHT_WEIGHT", "FS_UPLOADFLAG='1'", "FS_STOVENO='" + strTmpNo + "'"); sapClass.uptSapLog(strTmpNo, sapClass.strArrayUpload); sTmp += ",数据上传成功!"; lstHint2.Items.Add(sTmp); } else { lstHint2.Items.Add(sapClass.strSapError); } } } showGridInfo(); }