/// <summary> /// 将之前扣减过的lot卡清单和数量写回待入仓结存 /// </summary> /// <param name="tran">当前数据库事务</param> /// <param name="strLotCardList">待写入的lot卡清单</param> /// <param name="productNum">当前样板编号</param> private void LotCardListToWaitInStoreBalance( SqlTransaction tran, string strLotCardList, string productNum ) { //检测之前输入的内容 string strReg = "[^>]+(?=</div>)"; MatchCollection matchs = Regex.Matches(strLotCardList, strReg); //写入lot卡结存到待入仓成品仓 using (var da = new DAL.ChengPinCang.DataSetCompleteWaitTableAdapters.t_complete_lot_card_waitTableAdapter()) { //设置连接对象 da.Connection = tran.Connection; //设置事务 da.Transaction = tran; //取出匹配到的数据 foreach (Match match in matchs) { //通过冒号分出lot卡号和数量 string[] strs = match.Value.Split(new char[] { ':' }, 2, StringSplitOptions.RemoveEmptyEntries); string strLotId = strs[0]; int iQty = int.Parse(strs[1]); //部门名称 string deptName = "成品仓"; da.Insert( "样板", deptName, strLotId, productNum, 0, iQty, "送货单写回", Session["user_name"].ToString(), DateTime.Now, DateTime.Now ); } } }
/// <summary> /// 将之前扣减过的批量卡清单和数量写回待入仓结存 /// </summary> /// <param name="tran">当前数据库事务</param> /// <param name="billNum">单据编号</param> /// <param name="rowId">当前单据行号,行号传null则为全部行</param> /// <param name="strLotCardList">待写入的批量卡清单</param> /// <param name="productNum">当前生产编号</param> private void LotCardListToWaitInStoreBalance( SqlTransaction tran, string billNum, byte? rowId, string strLotCardList, string productNum ) { //检测之前输入的内容 string strReg = "[^>]+(?=</div>)"; MatchCollection matchs = Regex.Matches(strLotCardList, strReg); //写入批量卡结存到待入仓成品仓 using (var da = new DAL.ChengPinCang.DataSetCompleteWaitTableAdapters.t_complete_lot_card_waitTableAdapter()) using (var daLotCard = new DAL.Market.DataSetDeliveryBillMgrTableAdapters.t_delivery_bill_lot_cardTableAdapter()) { //设置连接对象 da.Connection = daLotCard.Connection = tran.Connection; //设置事务 da.Transaction = daLotCard.Transaction = tran; //取出匹配到的数据 foreach (Match match in matchs) { //通过冒号分出批量卡号和数量 string[] strs = match.Value.Split(new char[] { ':' }, 2, StringSplitOptions.RemoveEmptyEntries); string strLotId = strs[0]; int iQty = int.Parse(strs[1]); //部门名称 string procName = "成品仓"; da.Insert( "市场", procName, strLotId, productNum, 0, iQty, "送货单写回", Session["user_name"].ToString(), DateTime.Now, DateTime.Now ); } //删除送货单扣数的批量卡记录 if (rowId.HasValue) { daLotCard.DeleteByBillNumAndRowId(billNum, rowId.Value); } else { daLotCard.DeleteByBillNum(billNum); } } }