Пример #1
0
        private static List <Query_Stored> DoQuery(string sql_str)
        {
            List <Query_Stored> rtn = new List <Query_Stored>();

            try
            {
                DBHelper DBHelper_SqlServer = new DBLink();
                using (IDataReader dr = DBHelper_SqlServer.ExecuteReader(sql_str))
                {
                    while (dr.Read())
                    {
                        var p = new Query_Stored();
                        #region 逐个赋值
                        p.WAREHOUSENO = DBHelper_SqlServer.GetDataValue <string>(dr, "WAREHOUSENO");
                        p.PLACEID     = DBHelper_SqlServer.GetDataValue <string>(dr, "PLACEID");
                        p.CONTAINERID = DBHelper_SqlServer.GetDataValue <string>(dr, "CONTAINERID");
                        p.ITEMSKU     = DBHelper_SqlServer.GetDataValue <string>(dr, "ITEMSKU");
                        p.ITEMDESC    = DBHelper_SqlServer.GetDataValue <string>(dr, "ITEMDESC");
                        p.ITEMQTY     = DBHelper_SqlServer.GetDataValue <decimal>(dr, "ITEMQTY");

                        #endregion
                        rtn.Add(p);
                    }
                }
            }
            catch
            {
            }
            return(rtn);
        }
Пример #2
0
        private void btnUnLoad_Click(object sender, EventArgs e)
        {
            List <Query_Stored> unLoadLst = new List <Query_Stored>();
            string isEmptyContainer       = "N";
            string toPlace = "";

            if (dGVUnLoadItems.Rows.Count == 0)
            {
                return;
            }
            using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
            {
                int count = 0;
                foreach (DataGridViewRow p in dGVUnLoadItems.Rows)
                {
                    Query_Stored one = new Query_Stored();
                    one.WAREHOUSENO = p.Cells[0].Value == null ? "" : p.Cells[0].Value.ToString();
                    one.PLACEID     = p.Cells[1].Value.ToString();
                    one.CONTAINERID = p.Cells[2].Value.ToString();
                    one.ITEMDESC    = p.Cells[4].Value == null ? "" : p.Cells[4].Value.ToString();
                    one.ITEMQTY     = decimal.Parse(p.Cells[5].Value == null ? "0" : p.Cells[5].Value.ToString());
                    one.ITEMSKU     = p.Cells[3].Value == null ? "" : p.Cells[3].Value.ToString();

                    toPlace = p.Cells[6].Value.ToString();
                    switch (toPlace)
                    {
                    case "出入口10001":
                        toPlace = "10001";
                        break;

                    default:
                        toPlace = "10001";
                        break;
                    }
                    unLoadLst.Add(one);

                    if (unLoadLst.Count < 1)
                    {
                        return;
                    }
                    else
                    {
                        //foreach (var unLoadOne in unLoadLst)
                        //{
                        OD_Task taskSRM = new OD_Task();
                        //MessageBox.Show(unLoadLst[count].PLACEID);
                        #region newTask
                        taskSRM.TASKID              = Guid.NewGuid().ToString();
                        taskSRM.TASKNAME            = "堆垛机出库" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        taskSRM.TASKTYPE            = "SRM_Retrieve_Out"; //任务类型
                        taskSRM.TASKTYPEDESCRIPTION = "堆垛机出库";
                        taskSRM.TASKSTATUS          = "Out_Intention";    //想要入库
                        taskSRM.TASKLEVEL           = "Normal";
                        getTASKCONTENTSTRING(unLoadLst[count].CONTAINERID);
                        taskSRM.TASKCONTENTSTRING = itemDetails;
                        taskSRM.DODEVICEID        = "SRM_1";  //设备号
                        taskSRM.DODEVICENODEID    = "000011"; //设备节点号
                        taskSRM.DODEVICETYPE      = "SRM";    //设备类型
                        taskSRM.SOURCEPLACE       = unLoadLst[count].PLACEID;
                        taskSRM.TOPLACE           = toPlace;  //出库口
                        taskSRM.SENDTIMES         = 1;
                        taskSRM.RELEASESTATUS     = "N";
                        taskSRM.HADFINISH         = "N";
                        taskSRM.ORDERHEADID       = "";
                        taskSRM.ORDERDETAILSID    = "";
                        taskSRM.VOID               = 0;
                        taskSRM.UPDATEUSER         = FormLogin.user.USERNAME;
                        taskSRM.UPDATETIME         = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        taskSRM.ISCURRENTTASK      = "N";
                        taskSRM.ISLASTTASK         = "N";
                        taskSRM.CONTAINERNO        = unLoadLst[count].CONTAINERID;
                        taskSRM.INPUTLOCATIONLEVEL = 1;
                        taskSRM.ISEMPTYCONTAINER   = isEmptyContainer;
                        taskSRM.WAREHOUSENO        = "端拾器立体库";

                        IV_place_vs_container pvc = new IV_place_vs_container();
                        try
                        {
                            pvc = srv.Place_Vs_Container_GetRelationshipByContainer(taskSRM.CONTAINERNO)[0];

                            if (pvc.PLACEID.ToUpper().Contains("TEMP"))
                            {
                                MessageBox.Show("托盘:" + taskSRM.CONTAINERNO + "正在出库!");
                                return;
                            }
                        }

                        catch (Exception)
                        {
                            MessageBox.Show("托盘:" + taskSRM.CONTAINERNO + "已出库!");
                            return;
                        }

                        var undoTask = srv.Od_Task_GetNotFinishedTask_by_deviceID("SRM_1").ToList();
                        undoTask = undoTask.FindAll(x => (x.TOPLACE == "10001" || x.TOPLACE == "11601" || x.TOPLACE == "20001"));
                        var curtsk = srv.Od_Task_GetCurrentTaskByDeviceID("SRM_1");
                        if (curtsk.TOPLACE == "10001")
                        {
                            undoTask.Add(curtsk);
                        }
                        //foreach (var o in undoTask)//如果任务序列中的任务目标位和未完成任务目标位子冲突,不允许下发
                        //{
                        //    if (taskSRM.TOPLACE == o.TOPLACE)
                        //    {
                        //        MessageBox.Show(taskSRM.CONTAINERNO + "的出库口尚有出库任务执行中,请稍后再执行!");
                        //        return;
                        //    }
                        //}
                        #endregion
                        if (srv.Od_Task_InsertOne(taskSRM))
                        {
                            ///将库位号改为TEMP_OUT
                            pvc.PLACEID    = "TEMP_OUT";
                            pvc.UPDATETIME = DateTime.Now.ToString();
                            pvc.UPDATEUSER = FormLogin.user.USERNAME;
                            srv.Place_Vs_Container_UpdateOne(pvc);
                        }
                        //}
                    }
                    count++;
                }
                count = 0;
                dGVUnLoadItems.Rows.Clear();
                dGVUnLoadItems.Refresh();
                lsBGate.SelectedIndex   = -1;
                dGVItemQuery.DataSource = null;
                wait(1500);
                btnFind_Click(null, null);//出库后执行页面刷新
            }
        }