示例#1
0
        private void biSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (beidDate.EditValue == null)
            {
                beidDate.EditValue = DateTime.Now.Date;
            }
            var      cdDate = beidDate.EditValue.ToString();
            DateTime dDate;

            if (!DateTime.TryParse(cdDate, out dDate))
            {
                dDate = DateTime.Now.Date;
            }
            //通过WebService获取报单系统数据
            var js = new CompareService.EasAndWmsCompareReport();

            var easData = js.GetMoveMaterialReq(dDate);

            var wf    = new WmsFunction(BaseStructure.WmsCon);
            var cGuid = Guid.NewGuid();

            //写临时表
            for (var i = 0; i < easData.Rows.Count; i++)
            {
                var cmdInsertTemp = new SqlCommand("insert into Tmp_Compare(cInvCode,cInvName,iQuantity,cUnit,cGuid,cOrderNumber) " +
                                                   "Values(@cInvCode,@cInvName,@iQuantity,@cUnit,@cGuid,@cOrderNumber)");
                cmdInsertTemp.Parameters.AddWithValue("@cInvCode", easData.Rows[i]["cInvCode"].ToString());
                cmdInsertTemp.Parameters.AddWithValue("@cInvName", easData.Rows[i]["cInvName"].ToString());
                cmdInsertTemp.Parameters.AddWithValue("@iQuantity", easData.Rows[i]["iSumQuantity"].ToString());
                cmdInsertTemp.Parameters.AddWithValue("@cUnit", easData.Rows[i]["cUnit"].ToString());
                cmdInsertTemp.Parameters.AddWithValue("@cGuid", cGuid);
                cmdInsertTemp.Parameters.AddWithValue("@cOrderNumber", easData.Rows[i]["cOrderNumber"].ToString());
                wf.ExecSqlCmd(cmdInsertTemp);
            }

            var cmd = new SqlCommand("CompareProduceDetail")
            {
                CommandType = CommandType.StoredProcedure
            };

            cmd.Parameters.AddWithValue("@dDate", dDate);
            cmd.Parameters.AddWithValue("@cGuid", cGuid);

            uGridProBoxBarCode.DataSource = wf.GetSqlTable(cmd);

            var cmdDelete = new SqlCommand("Delete from Tmp_Compare where cGuid=@cGuid");

            cmdDelete.Parameters.AddWithValue("@cGuid", cGuid);
            wf.ExecSqlCmd(cmdDelete);

            tsgfMain.GetGridStyle(tsgfMain.FormId);
        }
        private void biSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (beidDate.EditValue == null)
            {
                beidDate.EditValue = DateTime.Now.Date;
            }
            if (beiEndDate.EditValue == null)
            {
                beiEndDate.EditValue = DateTime.Now.Date;
            }
            var      cdDate      = beidDate.EditValue.ToString();
            var      cdEndDate   = beiEndDate.EditValue.ToString();
            var      orderPrefix = txtOrderPrefix.EditValue.ToString();
            DateTime dDate;
            DateTime dEndDate;

            if (!DateTime.TryParse(cdDate, out dDate))
            {
                dDate = DateTime.Now.Date.AddDays(-10);
            }
            if (!DateTime.TryParse(cdEndDate, out dEndDate))
            {
                dEndDate = DateTime.Now.Date.AddDays(10);
            }
            //通过WebService获取报单系统数据
            var js = new CompareService.EasAndWmsCompareReport();

            //var easData = js.GetSaleOrder(dDate, dEndDate);
            var easData = js.GetSaleOrder(dDate, dEndDate, orderPrefix);

            var wf    = new WmsFunction(BaseStructure.WmsCon);
            var cGuid = Guid.NewGuid();

            //写临时表
            for (var i = 0; i < easData.Rows.Count; i++)
            {
                var cmdInsertTemp = new SqlCommand("insert into Tmp_Compare(cOrderNumber,cGuid) " +
                                                   "Values(@cOrderNumber,@cGuid)");
                cmdInsertTemp.Parameters.AddWithValue("@cOrderNumber", easData.Rows[i]["cOrderNumber"].ToString());
                cmdInsertTemp.Parameters.AddWithValue("@cGuid", cGuid);
                wf.ExecSqlCmd(cmdInsertTemp);
            }

            var cmd = new SqlCommand("CompareSaleDeliveryOrder")
            {
                CommandType = CommandType.StoredProcedure
            };

            cmd.Parameters.AddWithValue("@dDate", dDate);
            cmd.Parameters.AddWithValue("@dEndDate", dEndDate);
            cmd.Parameters.AddWithValue("@cGuid", cGuid);
            cmd.Parameters.AddWithValue("@cOrderPrefix", orderPrefix);
            cmd.Parameters.AddWithValue("@isDifference", chkDifference.Checked ? 1 : 0);

            uGridProBoxBarCode.DataSource = wf.GetSqlTable(cmd);

            //var cmdDelete = new SqlCommand("Delete from Tmp_Compare where cGuid=@cGuid");
            //cmdDelete.Parameters.AddWithValue("@cGuid", cGuid);
            //wf.ExecSqlCmd(cmdDelete);
            tsgfMain.GetGridStyle(tsgfMain.FormId);
        }