public bool UpdateSupplyState(SupplyInfo currentSupplyInfo)
 {
     var spa = TransactionScopeManager[Global.THOK_STOCK_DB_NAME].NewSPAccesser();
     IList<SPParameter> @params = new List<SPParameter>();
     SPParameter sPParameter1 = new SPParameter("product_code", ParameterDirection.Input, currentSupplyInfo.ProductCode);
     SPParameter sPParameter2 = new SPParameter("quantity", ParameterDirection.Input, currentSupplyInfo.Quantity);
     @params.Add(sPParameter1);
     @params.Add(sPParameter2);
     IDictionary<string, object> outVals = new Dictionary<string, object>();
     //todo:存储过程未实现;
     spa.ExecuteNoneQuery("pro_update_supply_Info", @params, out outVals);
     return true;
 }
 public SupplyInfo GetSupplyInfo()
 {
     var spa = TransactionScopeManager[Global.THOK_STOCK_DB_NAME].NewSPAccesser();
     IList<SPParameter> @params = new List<SPParameter>();
     IDictionary<string, object> outVals = new Dictionary<string, object>();
     //todo:存储过程未实现;
     var set = spa.ExecuteQuery("pro_get_supply_Info", @params, out outVals);
     if (set.Tables.Count == 1 && set.Tables[0].Rows.Count == 1)
     {
         var row = set.Tables[0].Rows[0];
         SupplyInfo supplyInfo = new SupplyInfo();
         supplyInfo.ProductCode = row["product_code"].ToString();
         supplyInfo.Quantity = Convert.ToInt32(row["quantity"]);
         return supplyInfo;
     }
     return null;
 }
        public TagTaskInfo GetTagTaskInfoFromSmallSpeciesTask(SupplyInfo supplyInfo)
        {
            var ra = TransactionScopeManager[Global.THOK_WCS_DB_NAME].NewRelationAccesser();
            string sql = string.Format(@"select a.id,b.tag_address,a.task_quantity -a.operate_quantity as task_quantity from wcs_task a
	                                        left join wcs_position b on a.current_position_id = b.id
                                         where b.position_type = '03' 
                                            and a.state = '01'
                                            and a.product_code = '{0}'", supplyInfo.ProductCode);
            var set = ra.DoQuery(sql);
            if (set.Tables.Count == 1 && set.Tables[0].Rows.Count == 1)
            {
                DataRow row = set.Tables[0].Rows[0];
                TagTaskInfo tagTaskInfo = new TagTaskInfo();
                tagTaskInfo.TaskID = Convert.ToInt32(row["id"]);
                tagTaskInfo.Address = row["tag_address"].ToString();
                tagTaskInfo.Quantity = Convert.ToInt32(row["task_quantity"]);
                if (supplyInfo.Quantity < tagTaskInfo.Quantity)
                {
                    tagTaskInfo.Quantity = supplyInfo.Quantity;
                }
                else
                {
                    supplyInfo.Quantity = tagTaskInfo.Quantity;
                }
                return tagTaskInfo;                
            }
            return null;
        }