Beispiel #1
0
 //stockid, warecode, deptid, eqid, num, unitcode, memo, choscode
 //库存主表  针对每一条入库细表信息,分别做一次判断 EQID 8    这里的drZ仍是指出库主表
 private void AddEQStockMainInfo(ActionLoad ac, Dictionary <string, ObjItem> drX, Dictionary <string, ObjItem> drZ)
 {
     //SELECT STOCKID,NUM FROM LKEQ.EQSTOCK  WHERE EQID=? AND WARECODE=? AND CHOSCODE=?
     GetStockIdAndNum = LData.LoadDataTable("IfHaveExistInEQStock", null, new object[] { drX["设备ID"].ToString(), drZ["出库目的库房"].ToString(), His.his.Choscode });
     if (GetStockIdAndNum == null || GetStockIdAndNum.Rows.Count <= 0)
     {
         //不存在 需插入
         ifHaveExsit = false;
         ac.Add("STOCKID", "");                        //服务端生成
         ac.Add("WARECODE", drZ["出库目的库房"].ToString()); //入库主表的入库库房编码=出库主表的目的库房编码
         ac.Add("EQID", drX["设备ID"].ToString());
         ac.Add("DEPTID", TargetWareDeptid);
         ac.Add("CHOSCODE", His.his.Choscode);
         ac.Add("UNITCODE", drX["单位编码"].ToString());
         ac.Add("MEMO", "");
         ac.Add("NUM", drX["数量"].ToString());
         BeforeNum = 0;
     }
     else
     {
         //存在  需更新库存数目 []
         ifHaveExsit = true;
         BeforeNum   = Convert.ToInt32(GetStockIdAndNum.Rows[0][1].ToString());//出库目的库房的库存总表更新
         LData.Exe("UpdateEQStockNumForTarget", null, new object[] { Convert.ToInt32(drX["数量"].ToString()), drX["设备ID"].ToString(), drZ["出库目的库房"].ToString(), His.his.Choscode.ToString() });
     }
 }
        private void YJFlagJudge()
        {
            this.dataGView1.IsAutoAddRow = false;
            int RowI = this.dataGView1.RowCount;

            if (RowI <= 0)
            {
                return;
            }
            for (int i = 0; i < RowI; i++)
            {
                DataTable StatusTable = LData.LoadDataTable("GetYJStatus_EQMonthAccountManag", null, new object[] { His.his.Choscode, this.dataGView1["QiJianIDColumn", i].Value.ToString() });
                if (StatusTable == null)
                {
                    this.dataGView1["YJFlagColumn", i].Value = "未月结";
                    continue;
                }
                foreach (DataRow dr in StatusTable.Rows)
                {
                    if (dr[0].ToString() == "1")
                    {
                        this.dataGView1["YJFlagColumn", i].Value = "已月结";
                        break;
                    }
                    this.dataGView1["YJFlagColumn", i].Value = "未月结";
                }
            }
        }
Beispiel #3
0
        //出库主表
        private void ChongXiaoCKZhuBiao(ActionLoad ac, Dictionary <string, ObjItem> drZhu)
        {
            //主表 22 主键为自动生成
            ac.Add("OUTID", null);//服务端生成
            ac.Add("IOID", drZhu["出库方式"].ToString());
            ac.Add("RECIPECODE", drZhu["单据号"].ToString());
            ac.Add("WARECODE", drZhu["出库库房"].ToString());
            ac.Add("TARGETWARECODE", drZhu["出库目的库房"].ToString());

            //ac.Add("DEPTID", LData.Es("FindDPTInEQInMain", null, new object[] { drZ["出库目的库房"].ToString(), His.his.Choscode.ToString() }));
            //ac.Add("TARGETDEPTID", LData.Es("FindDPTInEQInMain", null, new object[] { drZhu["出库目的库房"].ToString(), His.his.Choscode.ToString() }));  //在服务端查询后再插入

            ac.Add("TARGETDEPTID", TargetWareDeptid);
            ac.Add("TOTALMONEY", (drZhu["总金额"].ToDouble() * (-1)).ToString());
            ac.Add("OUTDATE", drZhu["制单日期"].ToDateTime());
            ac.Add("STATUS", "7");//状态全部为已冲销
            ac.Add("MEMO", drZhu["备注"].ToString());
            ac.Add("OPFLAG", drZhu["操作标志"].ToString());
            ac.Add("RECDATE", drZhu["修改时间"].ToDateTime());
            ac.Add("SHDATE", drZhu["审核日期"].ToDateTime());
            ac.Add("SHUSERID", drZhu["审核操作员ID"].ToString());
            ac.Add("SHUSERNAME", drZhu["审核操作员姓名"].ToString());
            DataTable dt = LData.LoadDataTable("FindChongXiaoYuanChuKuInfo", null, new object[] { His.his.Choscode.ToString(), drZhu["出库ID"].ToString() });
            DataRow   dr = dt.Rows[0];

            ac.Add("CXDATE", Convert.ToDateTime(dr["CXDATE"]));
            ac.Add("CXUSERID", dr["CXUSERID"].ToString());
            ac.Add("CXUSERNAME", dr["CXUSERNAME"].ToString());
            ac.Add("USERNAME", drZhu["操作员姓名"].ToString());
            ac.Add("USERID", drZhu["操作员ID"].ToString());
            ac.Add("INID", "");//由最新生成的更新
            ac.Add("CHOSCODE", drZhu["医疗机构编码"].ToString());
        }
Beispiel #4
0
        //说明文档加载
        void SMFormLoad(Dictionary <string, ObjItem> dr)
        {
            //这里的图片是个什么意思,我不是很懂  单独加载  不能用LoadDataTable  ↑
            LoadPicFile(dr);
            DataTable dtSM = LData.LoadDataTable("LoadSMInfoInCardEdit", null, new object[] { dr["卡片ID"].ToString(), His.his.Choscode.ToString() });

            if (dtSM != null)
            {
                if (dtSM.Rows.Count <= 0)
                {
                    return;
                }
                foreach (DataRow row in dtSM.Rows)
                {
                    SMcardid_textBox.Text      = row["CARDID"].ToString();
                    SMexplainNum_textBox.Text  = row["EXPLAINNUM"].ToString();
                    SMteachnum_textBox.Text    = row["TECHNUM"].ToString();
                    SMext_textBox.Text         = row["EXT"].ToString();
                    SMboxthing_textBox.Text    = row["BOXTHING"].ToString();
                    SMcertificate_textBox.Text = row["CERTIFICATE"].ToString();
                    SMother_textBox.Text       = row["OTHER"].ToString();
                    SMusername_textBox.Text    = row["USERNAME"].ToString();
                    SMusrtid_textBox.Text      = row["USERID"].ToString();
                    SMchoscode_textBox.Text    = row["CHOSCODE"].ToString();
                    dateTimePicker1.Text       = row["RECDATE"].ToString();
                }
            }
        }
Beispiel #5
0
        private DataTable GetZJWork_EQDepre(string CardId_EQDepre)
        {
            DataTable dt = LData.LoadDataTable("GetZJWork_EQDepreInEdit", null, new object[] { His.his.Choscode, CardId_EQDepre });

            if (dt != null && dt.Rows.Count > 0)
            {
                return(dt);
            }
            return(null);
        }
Beispiel #6
0
        private void GetDeptid(string Warecode)
        {
            DataTable dt = LData.LoadDataTable("FindDeptIDName", null, new object[] { Warecode, His.his.Choscode });

            if (dt != null)
            {
                DataRow dr = dt.Rows[0];
                ware_selTextInpt.Text  = dr[1].ToString();
                ware_selTextInpt.Value = dr[0].ToString();
            }
        }
Beispiel #7
0
        private void UpdateMoney(int row)
        {
            //数量不为0 或者空
            //成本单价>=<单价>+<运杂费>/<数量>
            //运杂费>= 所选库存流水记录里的运杂费/库存流水记录里的数量*本次出库数量;
            //<成本金额>=<成本单价>×<数量>
            DataGridViewRow r = this.dataGView1.Rows[row];

            if (r.Cells["EqIdName_Column"].Value == null)
            {
                return;
            }
            double result;

            if (!WJs.IsNum(r.Cells["shuliang_Column"].Value.ToString()) || !WJs.IsD0Zs(r.Cells["shuliang_Column"].Value.ToString()))
            {
                WJs.alert("数量必须为正整数,已设置为默认值1 !");
                r.Cells["shuliang_Column"].Value = 1;
                return;
            }

            DataTable YunZaShuLiang = LData.LoadDataTable("FindYunZaFeiInEQDiaoBO", null, new object[] { dataGView1.Rows[row].Cells["KuCunLiuShui_Column"].Value, His.his.Choscode });

            if (YunZaShuLiang == null)
            {
                WJs.alert("该库存流水记录内不包含运杂费,设备数量等数据,无法继续操作!");
                return;
            }

            DataRow drr = YunZaShuLiang.Rows[0];
            double  ChangeYunZaFei;

            //分别为对应的库存流水里面的数量和对应的运杂费       运杂费>= 所选库存流水记录里的运杂费/库存流水记录里的数量*本次出库数量;
            if (double.TryParse(drr["NUM"].ToString(), out result) && double.TryParse(drr["OTHERMONEY"].ToString(), out ChangeYunZaFei))
            {
                if (r.Cells["shuliang_Column"].Value != null && WJs.IsZs(r.Cells["shuliang_Column"].Value.ToString().Trim()) && r.Cells["danjia_Column"].Value != null)
                {
                    this.dataGView1.jsBds("金额=数量*单价");
                    r.Cells["yunzafei_Column"].Value = (ChangeYunZaFei * (Convert.ToDouble(r.Cells["shuliang_Column"].Value.ToString().Trim())) / result).ToString("f" + XiaoShuWei);
                    this.dataGView1.jsBds("成本单价=单价+运杂费/数量");
                    this.dataGView1.jsBds("成本金额=成本单价*数量");
                }
                else
                {
                    r.Cells["jine_Column"].Value     = 0.ToString("f" + XiaoShuWei);
                    r.Cells["danjia_Column"].Value   = 0.ToString("f" + XiaoShuWei);
                    r.Cells["yunzafei_Column"].Value = 0.ToString("f" + XiaoShuWei);
                }
            }
            this.TotalMoney_textBox1.Text = this.dataGView1.Sum("金额").ToString();
        }
Beispiel #8
0
        private void UnitCodeBind()
        {
            DataTable dtUCB = LData.LoadDataTable("FindUnitNameInEQDiaoBo", null, null);
            TvList    tv    = TvList.newBind();

            ((DataGridViewComboBoxColumn)this.Unitcode_Column).Items.Clear();
            if (dtUCB != null)
            {
                foreach (DataRow item in dtUCB.Rows)
                {
                    tv.add(item[1].ToString(), item[0].ToString());
                }
                tv.Bind(Unitcode_Column);
            }
        }
Beispiel #9
0
        //科室ID的绑定
        void DeptidBind()
        {
            DataTable dt = LData.LoadDataTable("FindDeptIDNameInBuildCard", null, new object[] { His.his.Choscode.ToString() });
            TvList    tv = TvList.newBind();

            ((DataGridViewComboBoxColumn)this.Deptid_Column).Items.Clear();
            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    tv.add(dr[1].ToString(), dr[0].ToString());
                }
                tv.Bind(this.Deptid_Column);
            }
        }
Beispiel #10
0
        void selTextInpt_EQID_TextChanged(object sender, EventArgs e)
        {
            DataTable dt = LData.LoadDataTable("EQIDOtherAskBuy_Add", new object[] { His.his.Choscode, this.selTextInpt_EQID.Text });

            if (dt != null)
            {
                DataRow dr = dt.Rows[0];
                if (dr != null)
                {
                    this.yTextBox_Name.Text        = dr["EQNAME"].ToString();
                    this.yTextBox_GuiG.Text        = dr["GG"].ToString();
                    this.yTextBox_XH.Text          = dr["XH"].ToString();
                    this.ytComboBox_Unitcode.Value = dr["UNITCODE"].ToString();
                }
            }
        }
Beispiel #11
0
        void WarecodeToWareName()
        {
            DataTable EQWareInfo = LData.LoadDataTable("FindWareNameInEQDiaoBo", null, new object[] { His.his.Choscode });
            TvList    tv         = TvList.newBind();

            ((DataGridViewComboBoxColumn)this.ware1Cloumn).Items.Clear();
            ((DataGridViewComboBoxColumn)this.TargetWarecodeColumn).Items.Clear();

            if (EQWareInfo != null)
            {
                foreach (DataRow r in EQWareInfo.Rows)
                {
                    tv.add(r[1].ToString(), r[0].ToString());
                }
            }
            tv.Bind(TargetWarecodeColumn);
            tv.Bind(this.ware1Cloumn);
        }
Beispiel #12
0
        //财产加载
        void CCFromLoad(Dictionary <string, ObjItem> dr)
        {
            dr = this.dataGView1.getRowData();
            DataTable dtCC = LData.LoadDataTable("LoadCCInfoInCardEdit", null, new object[] { His.his.Choscode.ToString(), dr["卡片ID"].ToString() });

            if (dtCC != null)
            {
                if (dtCC.Rows.Count <= 0)
                {
                    return;
                }
                foreach (DataRow row in dtCC.Rows)
                {
                    //12
                    CCcardid_textBox.Text = row["CARDID"].ToString();
                    CCprice_textBox.Text  = row["PRICE"].ToString();
                    CCcc_textBox.Text     = row["CCDATE"].ToString();
                    CCcsname_textBox.Text = row["CSNAME"].ToString();

                    DateTime result;
                    if (!DateTime.TryParse(row["BUYDATE"].ToString(), out result))
                    {
                        CCbuydate_textBox.Value = DateTime.Now;
                    }
                    else
                    {
                        CCbuydate_textBox.Value = result;
                    }
                    CCnewold_textBox.Text   = row["NEWOLD"].ToString();
                    CCsupply_textBox.Text   = row["SUPPLY"].ToString();
                    CCother_textBox.Text    = row["OTHER"].ToString();
                    CCuseridtextBox.Text    = row["USERID"].ToString();
                    CCusername_textBox.Text = row["USERNAME"].ToString();
                    CCrecdate_textBox.Text  = row["RECDATE"].ToString();
                    CCchosode_textBox.Text  = row["CHOSCODE"].ToString();
                }
            }
        }
Beispiel #13
0
        private void ShenHeGuoCheng(Dictionary <string, ObjItem> dr, List <Dictionary <string, ObjItem> > XiList)
        {
            //1.1 入库主表的操作
            ActionLoad acZRK = ActionLoad.Conn();

            acZRK.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
            acZRK.Sql    = "InsertInMain";
            AddRuKuZhuBiaoInfo(acZRK, dr);
            acZRK.Add("OUTID", dr["出库ID"].ToString());//专为更新对应的INID
            acZRK.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
            acZRK.Post();
            if (!isOk)
            {
                return;
            }

            //1.2 更新出库库房的相同设备各自数目  [库存主表]
            //select EQID, sum(Num) AS 数量 from lkeq.eqoutdetail  where outid=? and CHOSCODE=?  group by eqid    UPDATE LKEQ.EQSTOCK SET (NUM=NUM- ?) WHERE CHOSCODE=? AND WARECODE=? AND EQID=?
            //ActionLoad acDTNumForEQStock = ActionLoad.Conn();
            //DataTable DTNumForEQStock = acDTNumForEQStock.Find("GetStockNumInOutDetail", null, new object[] { dr["出库ID"].ToString(), His.his.Choscode });

            DataTable DTNumForEQStock = LData.LoadDataTable("GetStockNumInOutDetail", null, new object[] { dr["出库ID"].ToString(), His.his.Choscode });

            if (DTNumForEQStock != null)
            {
                foreach (DataRow itemRow in DTNumForEQStock.Rows)
                {
                    LData.Exe("UpdateStockNumInLingYong", null, new object[] { Convert.ToInt32(itemRow["数量"].ToString()), His.his.Choscode, dr["出库库房"].ToString(), itemRow["EQID"].ToString() });
                }
            }


            //就是主表某条信息  [出库数据] 对应细表的全部数据
            foreach (Dictionary <string, ObjItem> drXi in XiList)
            {
                if (LData.LoadDataTable("StockDetailSearchByLiuShuiHao", new object[] { drXi["库存流水号"].ToString(), His.his.Choscode.ToString() }) == null)
                {
                    continue;
                }
                //1更新出库库房数据[针对每条流水必须都更新]  UPDATE LKEQ.EQSTOCKDETAIL SET OUTNUM=(OUTNUM+?) WHERE FLOWNO=? AND CHOSCODE=?
                LData.Exe("UpdateEQStockDetailNum", null, new object[] { Convert.ToInt32(drXi["数量"].ToString()), drXi["库存流水号"].ToString(), His.his.Choscode });

                //2 先入库细表  1条[对应会生成一条库存流水]
                ActionLoad acXRK = ActionLoad.Conn();
                acXRK.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
                acXRK.Sql    = "InsertEQInDetail";
                AddRuKuXiBiaoInfo(acXRK, drXi);
                acXRK.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                acXRK.Post();
                if (!isOk)
                {
                    return;
                }

                //3 库存主表  [更新出库目的库房]   由于不存在目的库房,所以无需更新目的库房
                ActionLoad acKCZ = ActionLoad.Conn();
                acKCZ.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
                acKCZ.Sql    = "InsertStockMain";
                AddEQStockMainInfo(acKCZ, drXi, dr);
                if (!ifHaveExsit)  //不存在才需插入,存在则已经更新完毕
                {
                    acKCZ.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                    acKCZ.Post();
                }
                if (!isOk)
                {
                    return;
                }

                //4   库存流水表
                ActionLoad acKCX = ActionLoad.Conn();
                acKCX.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
                acKCX.Sql    = "InsertStockDetail";
                AddEQStockDetailInfo(acKCX, drXi, dr);
                acKCX.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                acKCX.Post();
                if (!isOk)
                {
                    return;
                }
            }
            if (isOk)
            {
                WJs.alert("设备调拨信息审核成功!");
                refresh_toolStrip_Click(null, null);
            }
        }
Beispiel #14
0
        private void Del_toolStrip_Click(object sender, EventArgs e)
        {
            Dictionary <string, ObjItem> dr = dataGView1.getRowData();

            if (dr != null)
            {
                if (dr["状态"].ToString() == "1")
                {
                    //更新对应的卡片表内信息
                    //SELECT CARDID,TOTALZJ,MONTHZJ,TOTALEDWORK,MONTHWORK FROM LKEQ.EQCARDDEPREDETAILREC WHERE CHOSCODE=? AND DEPREID=?
                    //UPDATE LKEQ.EQCARDREC SET TOTALZJ=TOTALZJ - ?,TOTALEDWORK=TOTALEDWORK - ? WHERE CARDID=? AND CHOSCODE=?
                    DataTable DetailTable = LData.LoadDataTable("FindAllDetailInfoForUpdateData_EQDepreManag", null, new object[] { His.his.Choscode, dr["折旧ID"].ToString() });
                    if (DetailTable != null && DetailTable.Rows.Count > 0)
                    {
                        foreach (DataRow item in DetailTable.Rows)
                        {
                            //就每一条卡片数据进行判断更新
                            DataTable ZJWorkdt = GetZJWork_EQDepre(item["CARDID"].ToString());
                            if (ZJWorkdt != null)
                            {
                                DataRow ZJWorkdr = ZJWorkdt.Rows[0];
                                double  Result;
                                //如果原本为Null,转换失败,则设置为0,否则肯定直接转换成功
                                if (!double.TryParse(ZJWorkdr["TOTALZJ"].ToString(), out Result))
                                {
                                    ZJWorkdr["TOTALZJ"] = "0.00";
                                }
                                if (!double.TryParse(ZJWorkdr["TOTALEDWORK"].ToString(), out Result))
                                {
                                    ZJWorkdr["TOTALEDWORK"] = "0.00";
                                }
                                if (Convert.ToDouble(ZJWorkdr["TOTALZJ"]) < Convert.ToDouble(item["MONTHZJ"]))
                                {
                                    WJs.alert("卡片" + ZJWorkdr["CARDID"].ToString() + ":累计折旧小于本月折旧,无法删除,否则出现折旧为负数!");
                                    return;
                                }
                                if (Convert.ToDouble(ZJWorkdr["TOTALEDWORK"]) < Convert.ToDouble(item["MONTHWORK"]))
                                {
                                    WJs.alert("卡片" + ZJWorkdr["CARDID"].ToString() + ":累计工作量小于本月工作量,无法删除,否则出现工作量为负数!");
                                    return;
                                }
                                LData.Exe("UpdateNumForDeleNotNull_EQDepreManag", null, new object[] { Convert.ToDouble(item["MONTHZJ"]), Convert.ToDouble(item["MONTHWORK"]), item["CARDID"].ToString(), His.his.Choscode });
                            }
                        }
                    }
                    else
                    {
                        WJs.alert("该条折旧信息无细表数据,无法删除!");
                        return;
                    }
                    //设为无效
                    LData.Exe("UpdateStatusInfo_EQDepreciationManag", null, new object[] { "0", dr["折旧ID"].ToString(), His.his.Choscode });
                    WJs.alert("删除成功!");
                    refresh_toolStrip_Click(null, null);
                }
                else
                {
                    WJs.alert("已经无效的数据无需删除!");
                }
            }
            else
            {
                WJs.alert("请选择需要删除的设备折旧信息!");
                return;
            }
        }
Beispiel #15
0
        private void ChongXiaoCaoZuo(Dictionary <string, ObjItem> drZ, List <Dictionary <string, ObjItem> > drXList)
        {
            //6个表的数据需要进行更新
            //我的意思是: 主表首先直接冲销  然后循环细表进行冲销
            //出库主表里面的INID 找到 入库主表信息  读取完了之后 修改重新插入冲销数据
            //由对应的INID 找到 对应的入库细表数据  读取完了之后 修改重新插入冲销数据

            //1.1,生成对应的出库主表  状态为7
            ActionLoad acCXZCK = ActionLoad.Conn();

            acCXZCK.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
            acCXZCK.Sql    = "ChongXiaoZhuChuKu";
            ChongXiaoCKZhuBiao(acCXZCK, drZ);
            acCXZCK.ServiceLoad += new YtClient.data.events.LoadEventHandle(acCX_ServiceLoad);
            acCXZCK.Post();
            if (!isOK2)
            {
                return;
            }

            //1.2  //将库存主表内的数目还原更新   出库库房的数目加回来
            //select EQID, sum(Num) AS 数量 from lkeq.eqoutdetail  where outid=? and CHOSCODE=?  group by eqid
            //UPDATE LKEQ.EQSTOCK SET NUM=NUM- ? WHERE CHOSCODE=? AND WARECODE=? AND EQID=?

            DataTable DTNumForEQStock = LData.LoadDataTable("GetStockNumInOutDetail", null, new object[] { drZ["出库ID"].ToString(), His.his.Choscode });

            if (DTNumForEQStock != null && DTNumForEQStock.Rows.Count != 0)
            {
                foreach (DataRow itemRow in DTNumForEQStock.Rows)
                {
                    LData.Exe("UpdateStockNumInLingYong", null, new object[] { Convert.ToInt32(itemRow["数量"].ToString()) * (-1), His.his.Choscode, drZ["出库库房"].ToString(), itemRow["EQID"].ToString() });
                }
            }

            foreach (Dictionary <string, ObjItem> drXiBiao in drXList)
            {
                //  出库细表  ac冲销细出库
                if (drXiBiao["出库ID"].IsNull == true || drXiBiao["出库ID"].ToString() == "")
                {
                    continue;
                }
                if (LData.LoadDataTable("StockDetailSearchByLiuShuiHao", new object[] { drXiBiao["库存流水号"].ToString(), His.his.Choscode.ToString() }) == null)
                {
                    continue;
                }
                //2.1更新出库库房数据[针对每条流水必须都更新]    UPDATE LKEQ.EQSTOCKDETAIL SET OUTNUM=(OUTNUM+?) WHERE FLOWNO=? AND CHOSCODE=?  流水表内的出库数目减回来
                LData.Exe("UpdateEQStockDetailNum", null, new object[] { Convert.ToInt32(drXiBiao["数量"].ToString()) * (-1), drXiBiao["库存流水号"].ToString(), His.his.Choscode });

                //2.2
                ActionLoad acCXXCK = ActionLoad.Conn();
                acCXXCK.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
                acCXXCK.Sql    = "ChongXiaoXiChuKu";
                ChongXiaoCKXiBiao(acCXXCK, drXiBiao);
                acCXXCK.ServiceLoad += new YtClient.data.events.LoadEventHandle(acCX_ServiceLoad);
                acCXXCK.Post();
            }
            if (!isOK2)
            {
                return;
            }

            //2.1  入库主表  状态为7
            ActionLoad acCXZRK = ActionLoad.Conn();

            acCXZRK.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
            acCXZRK.Sql    = "ChongXiaoZhuRuKu";

            //由原始INID 获取对应的 入库主表和细表的内容   根据这些内容生成冲销操作所需要的数据【前面已经验证了INID的存在】
            DataTable dt = LData.LoadDataTable("FindINMainInfo", null, new object[] { His.his.Choscode.ToString(), drZ["对应入库ID"].ToString() });

            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];//要冲销的调拨数据对应的入库主表信息
                ChongXiaoRKZhuBiao(acCXZRK, dr);
                acCXZRK.ServiceLoad += new YtClient.data.events.LoadEventHandle(acCX_ServiceLoad);
                acCXZRK.Post();
            }
            else
            {
                WJs.alert("没有对应的入库主表信息出错,冲销操作被终止!");
                isOK2 = false;
                return;
            }
            if (!isOK2)
            {
                return;
            }

            //2.2  //将库存主表内的数目还原更新  细表内   出库目的科室的数目减回来
            //select EQID, sum(Num) AS 数量 from lkeq.eqindetail  where inid=? and CHOSCODE=?  group by eqid
            //UPDATE LKEQ.EQSTOCK SET NUM=(NUM+?) WHERE EQID=? AND WARECODE IS NULL AND DEPTID=? AND CHOSCODE=?
            DataTable DTNumForEQStockCX = LData.LoadDataTable("GetStockNumInInDetail", null, new object[] { drZ["对应入库ID"].ToString(), His.his.Choscode });

            if (DTNumForEQStockCX != null)
            {
                foreach (DataRow itemRow in DTNumForEQStockCX.Rows)
                {
                    LData.Exe("UpdateEQStockNumForTarget_LingYong", null, new object[] { Convert.ToInt32(itemRow["数量"].ToString()) * (-1), itemRow["EQID"].ToString(), drZ["出库目的科室ID"].ToString(), His.his.Choscode });
                }
            }

            //2.3   入库细表
            DataTable dtDetail = LData.LoadDataTable("FindInDetailInfo", null, new object[] { His.his.Choscode.ToString(), drZ["对应入库ID"].ToString() });

            if (dtDetail != null && dtDetail.Rows.Count > 0)
            {
                foreach (DataRow dr in dtDetail.Rows)
                {
                    ActionLoad acCXXRK = ActionLoad.Conn();
                    acCXXRK.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
                    acCXXRK.Sql    = "ChongXiaoXiRuKu";
                    ChongXiaoRKXiBiao(acCXXRK, dr);
                    acCXXRK.ServiceLoad += new YtClient.data.events.LoadEventHandle(acCX_ServiceLoad);
                    acCXXRK.Post();
                    //2.1  更新对应的目的库房[入库流水每条流水必须都更新]   UPDATE LKEQ.EQSTOCKDETAIL SET NUM=(NUM+?) WHERE FLOWNO=? AND CHOSCODE=?  流水表内的入库数目没有那么多,减回来
                    LData.Exe("UpdateStockNumInLingYongForCX", null, new object[] { Convert.ToInt32(dr["NUM"]) * (-1), dr["STOCKFLOWNO"].ToString(), His.his.Choscode });
                }
            }
            if (!isOK2)
            {
                return;
            }
        }
Beispiel #16
0
        //void ac3_ServiceLoad(object sender, YtClient.data.events.LoadEvent e)
        //{

        //    //更新出库细表的库存流水号
        //    string flowno = e.Msg.Msg.Split('+')[0];
        //    string DETAILNO = e.Msg.Msg.Split('+')[1];
        //    ActionLoad ac2 = new ActionLoad();
        //    ac2.Action = "LKWZSVR.lkeq.EQWareManag.EQOutSvr";
        //    ac2.Sql = "UpdateEQInDetailInfo";
        //    ac2.Add("DETAILNO", DETAILNO);
        //    ac2.Add("STOCKFLOWNO", flowno);
        //    ac2.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac0_ServiceLoad);
        //    ac2.Post();
        //}
        private void toolStripButton_Pass_Click(object sender, EventArgs e)
        {
            DataTable datatable = LData.LoadDataTable("EQOutDetailSearch", new object[] { dr["出库ID"].ToString(), His.his.Choscode });

            if (datatable != null)
            {
                foreach (DataRow r in datatable.Rows)
                {
                    if (r != null)
                    {
                        //更新库存总表信息
                        decimal before_num = 0;
                        decimal num        = Convert.ToDecimal(r["NUM"]);
                        decimal after_num  = 0;

                        ActionLoad ac0 = new ActionLoad();
                        ac0.Action = "LKWZSVR.lkeq.EQWareManag.EQOutSvr";
                        ac0.Add("EQID", r["EQID"].ToString());
                        DataTable stock_table = LData.LoadDataTable("EQOut_GetSTOCKTable", new object[] { His.his.Choscode, r["EQID"].ToString(), dr["出库库房编码"].ToString() });
                        if (stock_table != null)
                        {
                            //库存总表中存在该库房对应的这种物资,只需更新库存量
                            before_num = Convert.ToDecimal(stock_table.Rows[0]["NUM"]);

                            after_num = before_num - num;
                            if (after_num < 0)
                            {
                                WJs.alert("设备" + r["设备"] + "的现有库存数已经低于出库数,审核应为不通过!");
                                return;
                            }
                            ac0.Sql = "UpdateEQStock";

                            ac0.Add("STOCKID", stock_table.Rows[0]["STOCKID"]);
                            ac0.Add("NUM", after_num);
                        }

                        ac0.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac0_ServiceLoad);
                        ac0.Post();
                        //LData.Exe("GetSTOCKID", null, new object[] { His.his.Choscode, r["WZID"].ToString(), dr["入库库房编码"].ToString() });
                        //string stockid_1 = LData.Es("GetSTOCKID", null, new object[] { His.his.Choscode, r["WZID"].ToString(), dr["入库库房编码"].ToString() });
                        // string dep =  r["DETAILNO"].ToString();

                        //更新库存流水表
                        ActionLoad ac1 = new ActionLoad();
                        ac1.Action = "LKWZSVR.lkeq.EQWareManag.EQInSvr";
                        ac1.Sql    = "SaveEQStockDetail";
                        ac1.Add("FLOWNO", r["STOCKFLOWNO"].ToString());
                        string  outnum = LData.Es("EQGetOutNum", null, new object[] { r["STOCKFLOWNO"].ToString() });
                        decimal num1   = Convert.ToDecimal(outnum) + num;
                        ac1.Add("OUTNUM", num1);

                        //ac1.Add("OUTID", r["OUTID"].ToString());
                        //ac1.Add("WARECODE", dr["出库库房编码"].ToString());
                        //string stockid_s;
                        //// string befornum = "0";
                        //if (stock_table != null)
                        //{
                        //    stockid_s = stock_table.Rows[0]["STOCKID"].ToString();

                        //}
                        //else
                        //{
                        //    stockid_s = LData.Es("EQGetSTOCKId", null, new object[] { His.his.Choscode, r["EQID"].ToString(), dr["出库库房编码"].ToString() });
                        //}
                        //ac1.Add("STOCKID", stockid_s);
                        //ac1.Add("BEFORENUM", before_num);
                        //ac1.Add("NUM", num);

                        //ac1.Add("UNITCODE", r["UNITCODE"]);
                        //ac1.Add("OUTNUM", 0);
                        //ac1.Add("CARDNUM",0);
                        //ac1.Add("GG", r["GG"]);
                        //ac1.Add("XH", r["XH"]);
                        //ac1.Add("CD", r["CD"]);
                        //ac1.Add("PRICE", r["PRICE"]);
                        //ac1.Add("MONEY", r["MONEY"]);
                        //ac1.Add("OTHERMONEY", r["OTHERMONEY"]);

                        //ac1.Add("TOTALPRICE", r["TOTALPRICE"]);
                        //ac1.Add("TOTALMONEY", r["TOTALMONEY"]);
                        //ac1.Add("SUPPLYID", r["SUPPLYID"]);
                        //ac1.Add("SUPPLYNAME", r["SUPPLYNAME"]);
                        //ac1.Add("PRODUCTDATE", Convert.ToDateTime(r["PRODUCTDATE"]));
                        //ac1.Add("VALIDDATE", Convert.ToDateTime(r["VALIDDATE"]));
                        //ac1.Add("MEMO", r["MEMO"]);
                        //ac1.Add("TXM", r["TXM"]);


                        //ac1.Add("RECIPECODE", dr["单据号"].ToString());
                        //ac1.Add("SHDH", dr["随货单号"].ToString());
                        //ac1.Add("GHSUPPLYID", dr["供货商ID"].ToString());
                        //ac1.Add("GHSUPPLYNAME", dr["供货商名称"].ToString());
                        //ac1.Add("INDATE", DateTime.Now);
                        //ac1.Add("CHOSCODE", His.his.Choscode);


                        //ac1.Add("DETAILNO", r["DETAILNO"]);//用于更新出库细表

                        ac1.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac0_ServiceLoad);
                        ac1.Post();
                        ////更新入库细表的库存流水号
                        //ActionLoad ac2 = new ActionLoad();
                        //ac2.Action = "LKWZSVR.lkwz.WZIn.WZInDan";
                        //ac2.Sql = "UpdateWZInDetailInfo";
                        //ac2.Add("DETAILNO", r["DETAILNO"].ToString());
                        //ac2.Add("STOCKFLOWNO", r["FLOWNO"].ToString());
                        //if (dr["采购计划流水号"] != null)
                        //{
                        //    ActionLoad ac3 = new ActionLoad();
                        //    ac3.Action = "LKWZSVR.lkwz.WZPlan.WZPlanMain";
                        //    ac3.Sql = "Save";
                        //    ac3.Add("PLANID", dr["采购计划流水号"].ToString());
                        //    ac3.Add("STATUS", 6);
                        //    ac3.Add("SHINDATE", DateTime.Now);
                        //    ac3.Add("SHINUSERID", His.his.UserId);
                        //    ac3.Add("SHINUSERNAME", His.his.UserName);
                        //    ac3.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                        //    ac3.Post();
                        //}
                    }
                }


                ActionLoad ac = new ActionLoad();
                ac.Action = "LKWZSVR.lkeq.EQWareManag.EQOutSvr";
                ac.Sql    = "ChuKuDanUpdate";
                ac.Add("SHINDATE", DateTime.Now);
                ac.Add("STATUS", 6);
                ac.Add("OUTID", dr["出库ID"].ToString());
                ac.Add("SHINUSERID", His.his.UserId);
                ac.Add("SHINUSERNAME", His.his.UserName);
                ac.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad_SHTG);
                ac.Post();
            }
        }
Beispiel #17
0
        private void ChongXiaoCaoZuo(Dictionary <string, ObjItem> drZhu, List <Dictionary <string, ObjItem> > drXibiaoList)
        {
            //6个表的数据需要进行更新
            //我的意思是: 主表首先直接冲销  然后循环细表进行冲销
            //出库主表里面的INID 找到 入库主表信息  读取完了之后 修改重新插入冲销数据
            //由对应的INID 找到 对应的入库细表数据  读取完了之后 修改重新插入冲销数据

            //1,生成对应的出库主表  状态为7
            ActionLoad acChongXiaoZhuChuKu = ActionLoad.Conn();

            acChongXiaoZhuChuKu.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
            acChongXiaoZhuChuKu.Sql    = "ChongXiaoZhuChuKu";
            ChongXiaoCKZhuBiao(acChongXiaoZhuChuKu, drZhu);
            acChongXiaoZhuChuKu.ServiceLoad += new YtClient.data.events.LoadEventHandle(acChongXiao_ServiceLoad);
            acChongXiaoZhuChuKu.Post();
            if (!isOK2)
            {
                return;
            }


            //这里是根据EQID 和WARECODE 来更新总表  比在内部循环的次数要少
            //select EQID, sum(Num) AS 数量 from lkeq.eqoutdetail  where outid=? and CHOSCODE=?  group by eqid;
            DataTable XiGroupbyEQIdTB = LData.LoadDataTable("GetEQIdNumGroupBy_EQDiaoBoManag", null, new object[] { drZhu["出库ID"].ToString(), His.his.Choscode });

            if (XiGroupbyEQIdTB != null && XiGroupbyEQIdTB.Rows.Count != 0)
            {
                foreach (DataRow item in XiGroupbyEQIdTB.Rows)
                {
                    //UPDATE LKEQ.EQSTOCK SET NUM=(NUM-?) WHERE WARECODE=? AND EQID=? AND CHOSCODE=?
                    LData.Exe("UpdataEQStockNumInfo_EQDiaoBoManag", null, new object[] { Convert.ToInt32(item["数量"]) * (-1), drZhu["出库库房"].ToString(), item["EQID"].ToString(), His.his.Choscode });
                }
            }

            // 1.2 出库细表
            foreach (Dictionary <string, ObjItem> drXiBiao in drXibiaoList)
            {
                if (drXiBiao["出库ID"] == null || drXiBiao["出库ID"].ToString() == "")
                {
                    // WJs.alert("该条出库细表内无数据!");  直接跳过,不要提示,体验性不好
                    continue;
                }
                ActionLoad acChongXiaoXiChuKu = ActionLoad.Conn();
                acChongXiaoXiChuKu.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
                acChongXiaoXiChuKu.Sql    = "ChongXiaoXiChuKu";
                ChongXiaoCKXiBiao(acChongXiaoXiChuKu, drXiBiao);
                acChongXiaoXiChuKu.ServiceLoad += new YtClient.data.events.LoadEventHandle(acChongXiao_ServiceLoad);
                acChongXiaoXiChuKu.Post();
                //对 出库库房 和对应的设备数量进行更新   [单条数据,细表对应的库存流水号, 对应一个STOCKID]    UPDATE LKEQ.EQSTOCKDETAIL SET OUTNUM=(OUTNUM+?) WHERE FLOWNO=? AND CHOSCODE=?
                LData.Exe("UpdateEQStockDetailNum", null, new object[] { drXiBiao["数量"].ToInt() * (-1), drXiBiao["库存流水号"].ToString(), His.his.Choscode });
            }
            if (!isOK2)
            {
                return;
            }

            //2,生成对应的入库主表  状态为7
            ActionLoad acChongXiaoZhuRuKu = ActionLoad.Conn();

            acChongXiaoZhuRuKu.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
            acChongXiaoZhuRuKu.Sql    = "ChongXiaoZhuRuKu";
            //由原始INID 获取对应的 入库主表和细表的内容   根据这些内容生成冲销操作所需要的数据  冲销的时候INID已经存在
            DataTable dt = LData.LoadDataTable("FindINMainInfo", null, new object[] { His.his.Choscode, drZhu["对应入库ID"].ToString() });

            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow dr = dt.Rows[0];//要冲销的调拨数据对应的入库主表信息
                ChongXiaoRKZhuBiao(acChongXiaoZhuRuKu, dr);
                acChongXiaoZhuRuKu.ServiceLoad += new YtClient.data.events.LoadEventHandle(acChongXiao_ServiceLoad);
                acChongXiaoZhuRuKu.Post();
            }
            else
            {
                WJs.alert("入库主表信息出错,冲销操作被终止!");
                isOK2 = false;
                return;
            }
            if (!isOK2)
            {
                return;
            }

            //select EQID, sum(Num) AS 数量 from lkeq.eqindetail  where inid=? and CHOSCODE=?  group by eqid
            DataTable DTNumForEQStockCX = LData.LoadDataTable("GetStockNumInInDetail", null, new object[] { drZhu["对应入库ID"].ToString(), His.his.Choscode });

            if (DTNumForEQStockCX != null)
            {
                foreach (DataRow itemRow in DTNumForEQStockCX.Rows)
                {
                    //UPDATE LKEQ.EQSTOCK SET NUM=(NUM+?) WHERE EQID=? AND WARECODE=? AND CHOSCODE=?
                    LData.Exe("UpdateEQStockNumForTarget", null, new object[] { Convert.ToInt32(itemRow["数量"].ToString()) * (-1), itemRow["EQID"].ToString(), drZhu["出库目的库房"].ToString(), His.his.Choscode });
                }
            }

            //2.2   入库细表
            DataTable dtDetail = LData.LoadDataTable("FindInDetailInfo", null, new object[] { His.his.Choscode.ToString(), drZhu["对应入库ID"].ToString() });

            if (dtDetail != null && dtDetail.Rows.Count > 0)
            {
                foreach (DataRow dr in dtDetail.Rows)
                {
                    ActionLoad acChongXiaoXiRuKu = ActionLoad.Conn();
                    acChongXiaoXiRuKu.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
                    acChongXiaoXiRuKu.Sql    = "ChongXiaoXiRuKu";
                    ChongXiaoRKXiBiao(acChongXiaoXiRuKu, dr);
                    acChongXiaoXiRuKu.ServiceLoad += new YtClient.data.events.LoadEventHandle(acChongXiao_ServiceLoad);
                    acChongXiaoXiRuKu.Post();
                    LData.Exe("UpdateEQStockDetailNum_InBiao", null, new object[] { Convert.ToInt32(dr["NUM"]) * (-1), dr["STOCKFLOWNO"].ToString(), His.his.Choscode });
                }
            }
            if (!isOK2)
            {
                return;
            }
        }
Beispiel #18
0
        private void ShenHeCaoZuo(Dictionary <string, ObjItem> drZhuBiao, List <Dictionary <string, ObjItem> > drXiBiao)
        {
            //这里的出库数据 相对应与  入库数据  再修改库存总表和流水表的数据
            //联系 : EQOUTMAIN :WARECODE ---- EQSTOCK:WARECODE   EQOUTDETAIL:STOCKFLOWNO----EQSTOCKDETAIL:FLOWNO
            //        EQOUTMAIN:INID OPFLAG IOID(IOFLAG=1) ---- EQINMAIN: INID OPFLAG
            if (drXiBiao != null && drXiBiao.Count > 0)
            {
                //1 入库主表的插入
                ActionLoad ac1 = ActionLoad.Conn();
                ac1.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
                ac1.Sql    = "InsertInMain";
                AddRuKuZhuBiaoInfo(ac1, drZhuBiao);
                ac1.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                ac1.Post();
                if (!isOk)
                {
                    return;
                }

                //这里是根据EQID 和WARECODE 来更新总表  比在内部循环的次数要少
                //select EQID, sum(Num) AS 数量 from lkeq.eqoutdetail  where outid=? and CHOSCODE=?  group by eqid;
                DataTable XiGroupbyEQIdTB = LData.LoadDataTable("GetEQIdNumGroupBy_EQDiaoBoManag", null, new object[] { drZhuBiao["出库ID"].ToString(), His.his.Choscode });
                if (XiGroupbyEQIdTB != null && XiGroupbyEQIdTB.Rows.Count != 0)
                {
                    foreach (DataRow item in XiGroupbyEQIdTB.Rows)
                    {
                        //UPDATE LKEQ.EQSTOCK SET NUM=(NUM-?) WHERE WARECODE=? AND EQID=? AND CHOSCODE=?
                        LData.Exe("UpdataEQStockNumInfo_EQDiaoBoManag", null, new object[] { Convert.ToInt32(item["数量"]), drZhuBiao["出库库房"].ToString(), item["EQID"].ToString(), His.his.Choscode });
                    }
                }

                //就是主表某条信息   对应细表的全部数据
                foreach (Dictionary <string, ObjItem> drXi in drXiBiao)
                {
                    //防止自动增加行
                    if (drXi["流水号"].IsNull == true || drXi["库存流水号"].IsNull == true || drXi["流水号"].ToString().Equals("") || drXi["库存流水号"].ToString().Equals(""))
                    {
                        continue;
                    }

                    //2 更新出库库房数据   UPDATE LKEQ.EQSTOCKDETAIL SET OUTNUM=(OUTNUM+?) WHERE FLOWNO=? AND CHOSCODE=?
                    LData.Exe("UpdateEQStockDetailNum", null, new object[] { Convert.ToInt32(drXi["数量"].ToString()), drXi["库存流水号"].ToString(), His.his.Choscode });

                    //3 更新或插入信息至库存主表  [更新出库目的库房]
                    ActionLoad acStockMain = ActionLoad.Conn();
                    acStockMain.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
                    acStockMain.Sql    = "InsertStockMain";
                    AddEQStockMainInfo(acStockMain, drXi, drZhuBiao);
                    if (!ifHaveExsit)  //不存在才需插入,存在则已经更新完毕
                    {
                        acStockMain.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                        acStockMain.Post();
                    }
                    if (!isOk)
                    {
                        return;
                    }

                    //4   库存流水表  [直接新建的库存流水入库单,所以不存在更新数据]
                    ActionLoad acStockDetail = ActionLoad.Conn();
                    acStockDetail.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
                    acStockDetail.Sql    = "InsertStockDetail";
                    AddEQStockDetailInfo(acStockDetail, drXi, drZhuBiao);
                    acStockDetail.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                    acStockDetail.Post();
                    if (!isOk)
                    {
                        return;
                    }

                    //5  入库细表
                    ActionLoad acInDetail = ActionLoad.Conn();
                    acInDetail.Action = "LKWZSVR.lkeq.WareManag.EQDiaoBoSvr";
                    acInDetail.Sql    = "InsertEQInDetail";
                    AddRuKuXiBiaoInfo(acInDetail, drXi, drZhuBiao);
                    acInDetail.ServiceLoad += new YtClient.data.events.LoadEventHandle(ac_ServiceLoad);
                    acInDetail.Post();
                    if (!isOk)
                    {
                        return;
                    }
                }
                if (isOk)
                {
                    WJs.alert("设备调拨信息审核成功!");
                    refresh_toolStrip_Click(null, null);
                }
            }
            else
            {
                WJs.alert("出库细表无任何内容,不会生成任何库存记录!");
                return;
            }
        }
Beispiel #19
0
        private void Chongxiao_toolStrip_Click(object sender, EventArgs e)
        {
            dataGView2.IsAutoAddRow = false;
            Dictionary <string, ObjItem> drZhu = this.dataGView1.getRowData();

            if (drZhu != null)
            {
                if (drZhu["对应入库ID"].IsNull == true || drZhu["对应入库ID"].ToString() == "")
                {
                    WJs.alert("没有包含该条设备领用信息的入库信息,无法进行冲销操作!");
                    return;
                }
                if (drZhu["状态"].ToString() == "6")
                {
                    if (WJs.confirm("确认对已审核的数据进行冲销操作?"))
                    {
                        //更改状态   是不是可以同时适应出库和入库呢?
                        ActionLoad acCX = ActionLoad.Conn();
                        acCX.Action = "LKWZSVR.lkeq.WareManag.EQLingYongSvr";
                        acCX.Sql    = "ChongXiaoRuChu";
                        acCX.Add("STATUS", "0");
                        acCX.Add("CXUSERNAME", His.his.UserName);
                        acCX.Add("CXUSERID", His.his.UserId.ToString());
                        acCX.Add("CXDATE", DateTime.Now);
                        acCX.Add("INID", drZhu["对应入库ID"].ToString());
                        acCX.Add("OUTID", drZhu["出库ID"].ToString());
                        acCX.Add("CHOSCODE", drZhu["医疗机构编码"].ToString());
                        acCX.ServiceLoad += new YtClient.data.events.LoadEventHandle(acCX_ServiceLoad);
                        acCX.Post();

                        //执行冲销操作
                        List <Dictionary <string, ObjItem> > XBList = this.dataGView2.GetData();
                        ChongXiaoCaoZuo(drZhu, XBList);
                        if (!isOK2)
                        {
                            WJs.alert("冲销失败!");
                            return;
                        }

                        //判断是否建卡?【循环细表内容】
                        foreach (Dictionary <string, ObjItem> item in XBList)
                        {
                            CXJKNum++;
                            // SELECT FLOWNO,DEPTID,STOCKID,EQID FROM LKEQ.EQSTOCKDETAIL WHERE CARDNUM &gt;= ? AND CHOSCODE=? AND FLOWNO=?
                            DataTable cxCard = LData.LoadDataTable("IfHaveBuildCardInLingYong", null, new object[] { item["数量"].ToInt(), His.his.Choscode, item["库存流水号"].ToString() });
                            if (cxCard == null || cxCard.Rows.Count <= 0)
                            {
                                continue;
                            }
                            else
                            {
                                DataRow dr = cxCard.Rows[0];//只包含一行
                                if (WJs.confirm("该领用单上的第" + CXJKNum + "条数据,建立了卡片,是否要将卡片进行冲销?"))
                                {
                                    //冲销掉对应的卡片   第一,减少对应的库存流水内的卡片数量;第二,在卡片表格内更改状态为7
                                    //UPDATE LKEQ.EQSTOCKDETAIL SET CARDNUM=CARDNUM-? WHERE FLOWNO=? AND CHOSCODE=?

                                    //UPDATE  LKEQ.EQCARDREC SET  STATUS=7
                                    //WHERE CARDID IN ( SELECT CARDID  FROM (SELECT *  FROM LKEQ.EQCARDREC
                                    //WHERE  STOCKID=? AND STOCKFLOWNO=?  AND DEPTID=?  ORDER BY CARDID DESC) WHERE ROWNUM<=?)
                                    isHaveCard = true;
                                    LData.Exe("ChongXiaoKaPianNumLingYong", null, new object[] { item["数量"].ToInt(), dr["FLOWNO"].ToString(), His.his.Choscode });
                                    //LData.Exe("ChongXiaoKaPianInLingYong", null, new object[] { dr["STOCKID"].ToString(), dr["FLOWNO"].ToString(), dr["DEPTID"].ToString(), His.his.Choscode, dr["EQID"].ToString(), item["数量"].ToInt() });
                                    LData.Exe("ChongXiaoKaPianInLingYong", null, new object[] { dr["STOCKID"].ToString(), dr["FLOWNO"].ToString(), drZhu["出库目的科室ID"].ToString(), His.his.Choscode, dr["EQID"].ToString(), item["数量"].ToInt() });
                                }
                            }
                        }
                        if (isHaveCard)
                        {
                            WJs.alert("卡片冲销成功!");
                        }
                    }
                    if (isOK2)
                    {
                        WJs.alert("冲销该条调拨记录成功!");
                        refresh_toolStrip_Click(null, null);
                    }
                }
                else
                {
                    WJs.alert("只能对状态为已审核的数据进行冲销操作!");
                }
            }
            else
            {
                WJs.alert("请选择需要进行冲销操作的调拨信息!");
            }
        }