Esempio n. 1
0
        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,strPriBatchNo;
            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");
            for (int i = 0; i < tmpRow.Length; i++)
            {
                ArrayList listItem = new ArrayList();
                ArrayList listSubItem = new ArrayList();
                ArrayList listItem2 = 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"]);

                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();
                    strPriBatchNo=tmpRow[i]["FS_PRIBATCHNO"].ToString();

                    listSubItem.Clear();
                    listItem.Clear();
                    listSubItem.Add(strTmpMater);//物料编号
                    listSubItem.Add("8500");//工厂
                    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);

                    //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++杨滔增上传上工序批次号功能
                    listItem2.Add(strPriBatchNo);
                    ccp.MethodName = "upBatchValue";
                    ccp.ServerParams = new object[] { strTmpMater, strTmpNo, "8500", listItem2 };
                    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_pipeweightmain", "FS_UPLOADFLAG='1',FS_MATERIALNO='" + strTmpMater + "'", "FS_BATCHNO='" + strTmpNo
                         + "' AND FS_ACCOUNTDATE='" + strTmpJzrq + "'");

                        for (int j = 0; j < listBatch.Count; j++)
                        {
                            sapClass.uptDataFlag("dt_pipeweightdetail", 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();
        }
Esempio n. 2
0
        private void Weight_BC_Load(object sender, EventArgs e)
        {
            b.ob = this.ob;
            //if (CustomInfo.Equals("JQ01"))
            //{
            //    strStoreCode = "SH000301";
            //    m_DefaultSender = "卷取秤1#";
            //}
            //if (CustomInfo.Equals("JQ02"))
            //{
            //    strStoreCode = "SH000302";
            //    m_DefaultSender = "卷取秤2#";
            //}
            //else if (CustomInfo.Equals("DSH"))
            //{
            //    strStoreCode = "SH000303";
            //    m_DefaultSender = "地上衡";
            //}
            stRunPath = System.Environment.CurrentDirectory;

            if (Constant.RunPath == "")
            {

                Constant.RunPath = System.Environment.CurrentDirectory;
            }

            //查询计量点信息,并启动所有查得的计量点的后台采集工作,和汽车衡不一样的是不需要管理员分配,直接接管
            QueryJLDData();

            //初始化计量点
            //WeighPoint wp = new WeighPoint(this.ob);
            string pointCode = "";
            //if (CustomInfo.Equals("JQ01"))
            //{
            //    pointCode = "K23";
            //}
            //if (CustomInfo.Equals("JQ02"))
            //{
            //    pointCode = "K24";
            //}
            //else if(CustomInfo.Equals("DSH"))
            //{
            //    pointCode = "K25";
            //}
            WeighPoint wp = new WeighPoint(this.ob);
            m_Points = wp.GetPoints("ZKD");
            if (m_Points != null)
            {
                m_nPointCount = m_Points.Length;
            }


            m_GetBaseInfo = new YGJZJL.PublicComponent.GetBaseInfo();
            m_GetBaseInfo.ob = this.ob;


            InitConfig();
            this.BuildMyTable();//构建内存表格式
            this.DownLoadMaterial(); //下载磅房对应物料信息到内存表
            this.DownLoadReceiver();  //下载磅房对应收货单位信息到内存表
            this.DownLoadSender();  //下载磅房对应发货单位信息到内存表
            this.DownLoadSteelType();  //下载磅房对应承运单位信息到内存表
            this.DownLoadSepc(); //下载磅房对应车号信息到内存表
            this.DownLoadFlow();  //下载流向信息

            //获得登录用户信息并显示到控件
            m_szCurUser = UserInfo.GetUserName();// CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName().ToString().Trim();
            m_szCurBC = UserInfo.GetUserOrder(); //Table_CA02_UserOrder.Static_T_CA02_UserOrder.GetUserOrderName(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserOrder());
            m_szCurBZ = UserInfo.GetUserGroup();// Table_CA02_UserGroup.Static_T_CA02_UserGroup.GetUserGroupName(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserGroup());

            txtJLY.Text = m_szCurUser;
            txtBC.Text = m_szCurBC;

            //控件初始化
            ClearControl();

            //控件事件和属性设置
            ControlInit();

            //获取语音信息
            GetYYBBData();
           
            //预报数据Grid初始化
            PlanDataGridInit();

            //创建计量数据表的结构
            BuildWeightDataTable();

            m_hDataUpThread = new Thread(new System.Threading.ThreadStart(DoDataUp));
            //m_hDataUpThread.Start();
            m_hRunning = true;


            //复磅
            this.tb_zzbh_fb.Enabled = false;
            this.tb_bandno_fb.Enabled = false;

            //手工录入
            this.cbx_Hand.CheckState = CheckState.Unchecked;
            this.tbx_hWeight.Enabled = false;

            this.txtBC.Text = GetOrderGroupName(OperationInfo.order, UserInfo.GetUserOrder());
            this.txtBZ.Text = GetOrderGroupName(OperationInfo.group, UserInfo.GetUserGroup());

            this.cbWLMC.Text = "中宽带成品";//物料名称

            this.cbFHDW.Text = "中宽带厂";//发货单位

            this.cbSHDW.Text = "生产订单收货";//收货单位

            //初始化标准管理对象
            _weightStdManage = new WeightStdManage(this.ob);
            _depotManage = new DepotManage();
        }
Esempio n. 3
0
        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();
        }