Esempio n. 1
0
        /// <summary>
        /// 处理入库任务
        /// </summary>
        /// <param name="currentTask"></param>
        /// <returns></returns>
        private bool DealFor_Srm_Store_In(OD_Task currentTask)
        {
            List <IV_place_vs_container> placeContnr = new List <IV_place_vs_container>();

            placeContnr = srv.Place_Vs_Container_GetRelationshipByContainer(currentTask.CONTAINERNO).ToList();
            if (placeContnr.Count > 0)
            {
                placeContnr[0].PLACEID = currentTask.TOPLACE;
                srv.Place_Vs_Container_UpdateOne(placeContnr[0]);
            }
            else
            {
                //插入新库位容器记录
                IV_place_vs_container ivp = new IV_place_vs_container();
                ivp.CONTAINERID      = currentTask.CONTAINERNO;
                ivp.PC_ID            = Guid.NewGuid().ToString();
                ivp.PLACEID          = currentTask.TOPLACE;
                ivp.VOID             = 0;
                ivp.WAREHOUSENO      = currentTask.WAREHOUSENO;
                ivp.INSERTUSER       = currentTask.CREATEUSER;
                ivp.UPDATEUSER       = currentTask.UPDATEUSER;
                ivp.ISEMPTYCONTAINER = currentTask.ISEMPTYCONTAINER == "Y" ? 1 : 0;
                ivp.UPDATETIME       = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                ivp.INSERTTIME       = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                srv.Place_Vs_Container_InsertOne(ivp);
            }
            bool a = srv.PL_PLACE_UpdateHadTaskDoing(currentTask.TOPLACE, 0);

            currentTask.TASKSTATUS = "In_Finished";
            srv.Od_Task_SetLastTaskVoidByDeviceID(currentTask.DODEVICEID);  // 废除上一次任务的有效性,当完成一个任务时,会先将以前的上一次任务(LastTask)作废,将刚刚完成的任务设置为最新上一次任务
            bool b = srv.Od_Task_UpdateOne(currentTask);

            return(a && b);
        }
Esempio n. 2
0
 private void DeleteTask(OD_Task tsk)
 {
     if (tsk.HADFINISH == "N" && tsk.RELEASESTATUS == "Y")
     {
         using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
         {
             string containerID = tsk.CONTAINERNO;
             if (srv.Od_Task_deleteOne(tsk.TASKID))  //删除当前任务
             {
                 srv.Place_Vs_Container_DeleteOne(containerID);
                 srv.Container_Vs_Items_DeleteOneByContainerID(containerID);
                 bool bl = srv.OPC_WritePoint("S7:[300]DB540,B1", 2);   //删除堆垛机任务
                 if (bl)
                 {
                     MessageBox.Show("删除成功!");
                 }
             }
         }
     }
     if (tsk.HADFINISH == "N" && tsk.RELEASESTATUS == "N")
     {
         if (tsk.TASKTYPEDESCRIPTION.Contains("出库"))   //如果出库的话
         {
             using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
             {
                 string placeId     = tsk.SOURCEPLACE;
                 string containerID = tsk.CONTAINERNO;
                 if (srv.Od_Task_deleteOne(tsk.TASKID))
                 {
                     List <IV_place_vs_container> lstPVC = srv.Place_Vs_Container_GetRelationshipByContainer(containerID).ToList();
                     IV_place_vs_container        pvc    = new IV_place_vs_container();
                     if (lstPVC.Count > 0)
                     {
                         pvc         = lstPVC[0];
                         pvc.PLACEID = placeId;
                         srv.Place_Vs_Container_UpdateOne(pvc);
                     }
                 }
             }
         }
         else if (tsk.TASKTYPEDESCRIPTION.Contains("入库")) //否则入库
         {
             using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
             {
                 string containerID = tsk.CONTAINERNO;
                 if (srv.Od_Task_deleteOne(tsk.TASKID))
                 {
                     srv.Place_Vs_Container_DeleteOne(containerID);
                     srv.Container_Vs_Items_DeleteOneByContainerID(containerID);
                 }
             }
         }
     }
 }
Esempio n. 3
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);//出库后执行页面刷新
            }
        }