Beispiel #1
0
        private void upLoadData()
        {
            if (uGridData.Rows.Count == 0)
            {
                lstHint2.Items.Add("错误:没有需要上传的数据!");
                return;
            }

            string strTmpMater, strTmpOrder, strTmpBatch1, strTmpBatch2;

            strTmpMater = "";
            string  strTmpNo = "";
            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();
                ArrayList listItem    = 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_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 + "-" + strTmpBatch1;
                        sapClass.strArrayUpload[6] = dTmpZl.ToString();
                        sTmp = "炉号为" + strTmpNo + "-凭证号" + sTmp + "-上传重量" + dTmpZl.ToString();;
                        //  sapClass.ins261Data(strTmpMater, dTmpZl.ToString(), strTmpNo, tmpRow[i]["FS_SAPSTORE"].ToString());
                        sapClass.uptDataFlag("IT_FP_TECHCARD", "FS_UPLOADFLAG='1'", "FS_GP_STOVENO like'%" + strTmpNo + "%'");
                        sapClass.uptSapLog(strTmpNo, sapClass.strArrayUpload);
                        sTmp += ",数据上传成功!";
                        lstHint2.Items.Add(sTmp);
                    }
                    else
                    {
                        lstHint2.Items.Add(sapClass.strSapError);
                    }
                    dTmpZl = 0;//清0
                    // lstHint2.Items.Add(sTmp);
                }
            }

            showGridInfo();
        }
Beispiel #2
0
        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();
        }