예제 #1
0
        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;
        }
예제 #2
0
 public void UpdatePositionStateToPicking(TagTaskInfo tagTaskInfo)
 {
     var ra = TransactionScopeManager[Global.THOK_WCS_DB_NAME].NewRelationAccesser();
     ra.DoCommand(string.Format(@"update wcs_position set current_task_id = {0},current_operate_quantity ={1}
                                  where tag_address = {2}", tagTaskInfo.TaskID, tagTaskInfo.Quantity,tagTaskInfo.Address));
 }
예제 #3
0
        public TagTaskInfo[] GetTagTaskInfoFromAbnormityTask()
        {
            var ra = TransactionScopeManager[Global.THOK_WCS_DB_NAME].NewRelationAccesser();
            string sql = string.Format(@"select a.id,b.tag_address,a.task_quantity from wcs_task a
	                                        left join wcs_position b on a.current_position_id = b.id
                                         where b.position_type = '04'");
            var set = ra.DoQuery(sql);
            if (set.Tables.Count == 1 && set.Tables[0].Rows.Count > 0)
            {
                var table = set.Tables[0];
                IList<TagTaskInfo> tagTaskInfos = new List<TagTaskInfo>();
                foreach (DataRow row in table.Rows)
                {
                    TagTaskInfo tagTaskInfo = new TagTaskInfo();
                    tagTaskInfo.TaskID = Convert.ToInt32(row["id"]);
                    tagTaskInfo.Address = row["tag_address"].ToString();
                    tagTaskInfo.Quantity = Convert.ToInt32(row["task_quantity"]);
                    tagTaskInfos.Add(tagTaskInfo);
                }

                return tagTaskInfos.ToArray();
            }
            return null;
        }