Ejemplo n.º 1
0
        /// <summary>
        /// 处理当前任务
        /// </summary>
        /// <param name="currentTask"></param>
        /// <returns></returns>
        private bool DealWithCurrentTask(OD_Task currentTask)
        {
            currentTask.ISCURRENTTASK = "N";
            currentTask.HADFINISH     = "Y";
            currentTask.ISLASTTASK    = "Y";
            bool rtn = false;

            switch (currentTask.TASKTYPE)
            {
            case "SRM_Store_In":
                rtn = DealFor_Srm_Store_In(currentTask);    //入库执行后增加库存
                break;

            case "SRM_Retrieve_Out":
                rtn = DealFor_Srm_Retrieve_Out(currentTask);    //出库执行后清除库存
                break;

            case "SRM_Inventory_Out":
                break;

            case "SRM_Inventory_In":
                break;
            }
            return(rtn);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        private void btn_TaskCancel_Click(object sender, EventArgs e)
        {
            OD_Task currentTask = srv.Od_Task_GetCurrentTaskByDeviceID("SRM_1");

            if (currentTask.SOURCEPLACE == "10301" || currentTask.SOURCEPLACE == "11901")
            {
                //入库任务无需撤回
                return;
            }

            string placeid            = currentTask.SOURCEPLACE;
            string isEmptyContainer   = currentTask.ISEMPTYCONTAINER;
            IV_place_vs_container pvc = new IV_place_vs_container();

            pvc.CONTAINERID      = currentTask.CONTAINERNO;
            pvc.INSERTTIME       = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            pvc.INSERTUSER       = "";
            pvc.ISEMPTYCONTAINER = isEmptyContainer == "Y"?1:0;
            pvc.ISEMPTYPLACE     = 0;
            pvc.PC_ID            = Guid.NewGuid().ToString();
            pvc.PLACEID          = placeid;
            pvc.VOID             = 0;
            pvc.UPDATETIME       = pvc.INSERTTIME;
            pvc.UPDATEUSER       = "";
            pvc.WAREHOUSENO      = "吉利沃尔沃立体库";
            if (!srv.Place_Vs_Container_InsertOne(pvc))
            {
                MessageBox.Show(this, "撤回失败!");
                return;
            }
            btnCancle_Click(null, null);//删除堆垛机指令
        }
Ejemplo n.º 4
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);
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
        public static OD_Task GetLastTaskByDeviceID(string DeviceID)
        {
            OD_Task t      = new OD_Task();
            string  getstr = string.Format("select * from od_task where DoDeviceID='" + DeviceID + "' and  IsCurrentTask='N' and IsLastTask='Y' and  HadFinish='N' order by UPDATETIME asc ");

            try
            {
                t = DoQuery(getstr)[0];
            }
            catch (Exception)
            {
            }
            return(t);
        }
Ejemplo n.º 6
0
        private static List <OD_Task> DoQuery(string sql_str)
        {
            List <OD_Task> rtn = new List <OD_Task>();

            try
            {
                DBHelper DBHelper_SqlServer = new DBLink();
                using (IDataReader dr = DBHelper_SqlServer.ExecuteReader(sql_str))
                {
                    while (dr.Read())
                    {
                        var p = new OD_Task();
                        #region 逐个赋值
                        p.TASKID              = DBHelper_SqlServer.GetDataValue <string>(dr, "TASKID");
                        p.TASKNAME            = DBHelper_SqlServer.GetDataValue <string>(dr, "TASKNAME");
                        p.DODEVICEID          = DBHelper_SqlServer.GetDataValue <string>(dr, "DODEVICEID");
                        p.DODEVICENODEID      = DBHelper_SqlServer.GetDataValue <string>(dr, "DODEVICENODEID");
                        p.DODEVICETYPE        = DBHelper_SqlServer.GetDataValue <string>(dr, "DODEVICETYPE");
                        p.TASKTYPE            = DBHelper_SqlServer.GetDataValue <string>(dr, "TASKTYPE");
                        p.TASKLEVEL           = DBHelper_SqlServer.GetDataValue <string>(dr, "TASKLEVEL");
                        p.TASKSTATUS          = DBHelper_SqlServer.GetDataValue <string>(dr, "TASKSTATUS");
                        p.TASKCONTENTSTRING   = DBHelper_SqlServer.GetDataValue <string>(dr, "TASKCONTENTSTRING");
                        p.TASKTYPEDESCRIPTION = DBHelper_SqlServer.GetDataValue <string>(dr, "TASKTYPEDESCRIPTION");
                        p.CONTAINERNO         = DBHelper_SqlServer.GetDataValue <string>(dr, "CONTAINERNO");
                        p.SOURCEPLACE         = DBHelper_SqlServer.GetDataValue <string>(dr, "SOURCEPLACE");
                        p.TOPLACE             = DBHelper_SqlServer.GetDataValue <string>(dr, "TOPLACE");
                        p.ORDERDETAILSID      = DBHelper_SqlServer.GetDataValue <string>(dr, "ORDERDETAILSID");
                        p.ORDERHEADID         = DBHelper_SqlServer.GetDataValue <string>(dr, "ORDERHEADID");
                        p.SENDTIMES           = DBHelper_SqlServer.GetDataValue <int>(dr, "SENDTIMES");
                        p.RELEASESTATUS       = DBHelper_SqlServer.GetDataValue <string>(dr, "RELEASESTATUS");
                        p.HADFINISH           = DBHelper_SqlServer.GetDataValue <string>(dr, "HADFINISH");
                        p.VOID               = DBHelper_SqlServer.GetDataValue <int>(dr, "VOID");
                        p.UPDATETIME         = DBHelper_SqlServer.GetDataValue <string>(dr, "UPDATETIME");
                        p.UPDATEUSER         = DBHelper_SqlServer.GetDataValue <string>(dr, "UPDATEUSER");
                        p.WAREHOUSENO        = DBHelper_SqlServer.GetDataValue <string>(dr, "WAREHOUSENO");
                        p.ISCURRENTTASK      = DBHelper_SqlServer.GetDataValue <string>(dr, "ISCURRENTTASK");
                        p.INPUTLOCATIONLEVEL = DBHelper_SqlServer.GetDataValue <int>(dr, "INPUTLOCATIONLEVEL");
                        p.ISLASTTASK         = DBHelper_SqlServer.GetDataValue <string>(dr, "ISLASTTASK");
                        p.ISEMPTYCONTAINER   = DBHelper_SqlServer.GetDataValue <string>(dr, "ISEMPTYCONTAINER");

                        #endregion
                        rtn.Add(p);
                    }
                }
            }
            catch
            {
            }
            return(rtn);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 处理出库任务
        /// </summary>
        /// <param name="currentTask"></param>
        /// <returns></returns>
        private bool DealFor_Srm_Retrieve_Out(OD_Task currentTask)
        {
            IV_place_vs_container placeContnr = new IV_place_vs_container();

            placeContnr = srv.Place_Vs_Container_GetRelationshipByContainer(currentTask.CONTAINERNO)[0];

            srv.Place_Vs_Container_DeleteOne(placeContnr.CONTAINERID);     //清除库存
            currentTask.TASKSTATUS = "Out_Finished";
            srv.Od_Task_SetLastTaskVoidByDeviceID(currentTask.DODEVICEID); // 废除上一次任务的有效性,当完成一个任务时,会先将以前的上一次任务(LastTask)作废,将刚刚完成的任务设置为最新上一次任务

            bool b = srv.Od_Task_UpdateOne(currentTask);

            return(b);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 插入任务表
        /// </summary>
        /// <param name="fromPlace"></param>
        /// <param name="toPlace"></param>
        private bool GreateTask(string fromPlace, string toPlace)
        {
            //string nowTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            using (ASRS_ServiceSoapClient srv = new ASRS_ServiceSoapClient())
            {
                string  nowTime = srv.CommonMethod_GetServerTime().ToUniversalTime().AddHours(8).ToString("yyyy-MM-dd HH:mm:ss");
                OD_Task taskSRM = new OD_Task();
                taskSRM.TASKID              = Guid.NewGuid().ToString();
                taskSRM.TASKNAME            = "堆垛机入库" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
                taskSRM.TASKTYPE            = "SRM_Store_In"; //任务类型
                taskSRM.TASKTYPEDESCRIPTION = "堆垛机入库";
                taskSRM.TASKSTATUS          = "In_Intention"; //想要入库
                taskSRM.TASKLEVEL           = "Normal";
                taskSRM.TASKCONTENTSTRING   = itemDetails;
                taskSRM.DODEVICEID          = "SRM_1";  //设备号
                taskSRM.DODEVICENODEID      = "000011"; //设备节点号
                taskSRM.DODEVICETYPE        = "SRM";    //设备类型
                taskSRM.SOURCEPLACE         = fromPlace;
                taskSRM.TOPLACE             = toPlace;  //入库口和目标库位
                taskSRM.SENDTIMES           = 1;
                taskSRM.RELEASESTATUS       = "N";
                taskSRM.HADFINISH           = "N";
                taskSRM.ORDERHEADID         = "";
                taskSRM.ORDERDETAILSID      = "";
                taskSRM.VOID               = 0;
                taskSRM.UPDATEUSER         = "";
                taskSRM.UPDATETIME         = nowTime;
                taskSRM.ISCURRENTTASK      = "N";
                taskSRM.ISLASTTASK         = "N";
                taskSRM.CONTAINERNO        = tBContainer.Text.Trim();
                taskSRM.INPUTLOCATIONLEVEL = 1;
                taskSRM.WAREHOUSENO        = "端拾器立体库";

                if (srv.Od_Task_InsertOne(taskSRM))
                {
                    itemDetails = string.Empty;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Ejemplo n.º 9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            OD_Task tsk = new OD_Task();

            if (dgvNoFinOd.SelectedRows.Count > 0 && dgvNoFinOd.SelectedRows[0].Selected == true)
            {
                int index = dgvNoFinOd.SelectedRows[0].Index;
                tsk = (dgvNoFinOd.DataSource as List <OD_Task>)[index];
            }
            else if (dGVReleaseOd.SelectedRows.Count > 0 && dGVReleaseOd.SelectedRows[0].Selected == true)
            {
                tsk = (dGVReleaseOd.DataSource as List <OD_Task>)[0];
            }
            if (!string.IsNullOrEmpty(tsk.TASKID))
            {
                DeleteTask(tsk);
            }
            btn_Refresh_Click(null, null);
        }
Ejemplo n.º 10
0
 private void Task_Img(object obj)
 {
     while (true)
     {
         if (stk.workMode != null && TanslateWorkMode(int.Parse(stk.workMode)) != "空闲")
         {
             try
             {
                 OD_Task currentTask = srv.Od_Task_GetCurrentTaskByDeviceID("SRM_1");
                 lbContainerID.Text = "托盘号:" + currentTask.CONTAINERNO;
                 lbDestination.Text = "目标地址" + currentTask.TOPLACE;
                 lbSourcePlace.Text = "起始地址" + currentTask.SOURCEPLACE;
                 lbItemName.Text    = "物料名称:";
                 lbSku.Text         = "物料号:";
                 lbTaskType.Text    = "作业指令:" + currentTask.TASKTYPEDESCRIPTION;
                 if (currentTask.ISEMPTYCONTAINER == "N")
                 {
                     var itemsLst = srv.Container_Vs_Items_GetItemsByContainerID(currentTask.CONTAINERNO).ToList();
                     foreach (var p in itemsLst)
                     {
                         lbItemName.Text += p.ITEMDESC + "; ";
                         lbSku.Text      += p.ITEMSKU + "; ";
                     }
                 }
             }
             catch (Exception)
             {
             }
         }
         else
         {
             lbContainerID.Text = "托盘号:";
             lbDestination.Text = "目标地址";
             lbSourcePlace.Text = "起始地址";
             lbItemName.Text    = "物料名称:";
             lbSku.Text         = "物料号:";
             lbTaskType.Text    = "作业指令:";
         }
         wait(3000);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 插入一条数据
        /// </summary>
        /// <param name="t_new"></param>
        /// <returns></returns>
        public static bool InsertNew(OD_Task t_new)
        {
            try
            {
                OD_Task       tt = t_new;
                StringBuilder sb = new StringBuilder();
                sb.Append(" Insert into OD_Task (  ");
                sb.Append("TASKID, ");
                sb.Append("TASKNAME, ");
                sb.Append("DODEVICEID, ");
                sb.Append("DODEVICENODEID, ");
                sb.Append("DODEVICETYPE, ");
                sb.Append("TASKTYPE, ");
                sb.Append("TASKLEVEL, ");
                sb.Append("TASKSTATUS, ");
                sb.Append("TASKCONTENTSTRING, ");
                sb.Append("TASKTYPEDESCRIPTION, ");
                sb.Append("CONTAINERNO, ");
                sb.Append("SOURCEPLACE, ");
                sb.Append("TOPLACE, ");
                sb.Append("ORDERDETAILSID, ");
                sb.Append("ORDERHEADID, ");
                sb.Append("SENDTIMES, ");
                sb.Append("RELEASESTATUS, ");
                sb.Append("HADFINISH, ");
                sb.Append("VOID, ");
                sb.Append("UPDATETIME, ");
                sb.Append("UPDATEUSER, ");
                sb.Append("WAREHOUSENO, ");
                sb.Append("ISCURRENTTASK, ");
                sb.Append("INPUTLOCATIONLEVEL, ");
                sb.Append("ISLASTTASK, ");
                sb.Append("ISEMPTYCONTAINER )");
                sb.Append(" values ( ");
                sb.Append("@TASKID,");
                sb.Append("@TASKNAME,");
                sb.Append("@DODEVICEID,");
                sb.Append("@DODEVICENODEID,");
                sb.Append("@DODEVICETYPE,");
                sb.Append("@TASKTYPE,");
                sb.Append("@TASKLEVEL,");
                sb.Append("@TASKSTATUS,");
                sb.Append("@TASKCONTENTSTRING,");
                sb.Append("@TASKTYPEDESCRIPTION,");
                sb.Append("@CONTAINERNO,");
                sb.Append("@SOURCEPLACE,");
                sb.Append("@TOPLACE,");
                sb.Append("@ORDERDETAILSID,");
                sb.Append("@ORDERHEADID,");
                sb.Append("@SENDTIMES,");
                sb.Append("@RELEASESTATUS,");
                sb.Append("@HADFINISH,");
                sb.Append("@VOID,");
                sb.Append("@UPDATETIME,");
                sb.Append("@UPDATEUSER,");
                sb.Append("@WAREHOUSENO,");
                sb.Append("@ISCURRENTTASK,");
                sb.Append("@INPUTLOCATIONLEVEL,");
                sb.Append("@ISLASTTASK,");
                sb.Append(" @ISEMPTYCONTAINER )");
                DbCommand cmd = new SqlCommand();
                cmd.CommandText = sb.ToString();
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add(new SqlParameter("@TASKID", DbType.String)
                {
                    Value = tt.TASKID
                });
                cmd.Parameters.Add(new SqlParameter("@TASKNAME", DbType.String)
                {
                    Value = tt.TASKNAME
                });
                cmd.Parameters.Add(new SqlParameter("@DODEVICEID", DbType.String)
                {
                    Value = tt.DODEVICEID
                });
                cmd.Parameters.Add(new SqlParameter("@DODEVICENODEID", DbType.String)
                {
                    Value = tt.DODEVICENODEID
                });
                cmd.Parameters.Add(new SqlParameter("@DODEVICETYPE", DbType.String)
                {
                    Value = tt.DODEVICETYPE
                });
                cmd.Parameters.Add(new SqlParameter("@TASKTYPE", DbType.String)
                {
                    Value = tt.TASKTYPE
                });
                cmd.Parameters.Add(new SqlParameter("@TASKLEVEL", DbType.String)
                {
                    Value = tt.TASKLEVEL
                });
                cmd.Parameters.Add(new SqlParameter("@TASKSTATUS", DbType.String)
                {
                    Value = tt.TASKSTATUS
                });
                cmd.Parameters.Add(new SqlParameter("@TASKCONTENTSTRING", DbType.String)
                {
                    Value = tt.TASKCONTENTSTRING
                });
                cmd.Parameters.Add(new SqlParameter("@TASKTYPEDESCRIPTION", DbType.String)
                {
                    Value = tt.TASKTYPEDESCRIPTION
                });
                cmd.Parameters.Add(new SqlParameter("@CONTAINERNO", DbType.String)
                {
                    Value = tt.CONTAINERNO
                });
                cmd.Parameters.Add(new SqlParameter("@SOURCEPLACE", DbType.String)
                {
                    Value = tt.SOURCEPLACE
                });
                cmd.Parameters.Add(new SqlParameter("@TOPLACE", DbType.String)
                {
                    Value = tt.TOPLACE
                });
                cmd.Parameters.Add(new SqlParameter("@ORDERDETAILSID", DbType.String)
                {
                    Value = tt.ORDERDETAILSID
                });
                cmd.Parameters.Add(new SqlParameter("@ORDERHEADID", DbType.String)
                {
                    Value = tt.ORDERHEADID
                });
                cmd.Parameters.Add(new SqlParameter("@SENDTIMES", DbType.Int32)
                {
                    Value = tt.SENDTIMES
                });
                cmd.Parameters.Add(new SqlParameter("@RELEASESTATUS", DbType.String)
                {
                    Value = tt.RELEASESTATUS
                });
                cmd.Parameters.Add(new SqlParameter("@HADFINISH", DbType.String)
                {
                    Value = tt.HADFINISH
                });
                cmd.Parameters.Add(new SqlParameter("@VOID", DbType.Int32)
                {
                    Value = tt.VOID
                });
                cmd.Parameters.Add(new SqlParameter("@UPDATETIME", DbType.String)
                {
                    Value = tt.UPDATETIME
                });
                cmd.Parameters.Add(new SqlParameter("@UPDATEUSER", DbType.String)
                {
                    Value = tt.UPDATEUSER
                });
                cmd.Parameters.Add(new SqlParameter("@WAREHOUSENO", DbType.String)
                {
                    Value = tt.WAREHOUSENO
                });
                cmd.Parameters.Add(new SqlParameter("@ISCURRENTTASK", DbType.String)
                {
                    Value = tt.ISCURRENTTASK
                });
                cmd.Parameters.Add(new SqlParameter("@INPUTLOCATIONLEVEL", DbType.Int32)
                {
                    Value = tt.INPUTLOCATIONLEVEL
                });
                cmd.Parameters.Add(new SqlParameter("@ISLASTTASK", DbType.String)
                {
                    Value = tt.ISLASTTASK
                });
                cmd.Parameters.Add(new SqlParameter("@ISEMPTYCONTAINER", DbType.String)
                {
                    Value = tt.ISEMPTYCONTAINER
                });

                foreach (SqlParameter p in cmd.Parameters)
                {
                    p.IsNullable = true;
                    if (p.Value == null)
                    {
                        p.Value = DBNull.Value;
                    }
                }
                DBHelper DBHelper_SqlServer = new DBLink();
                int      val = DBHelper_SqlServer.ExecuteNonQuery(cmd);
                if (val > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 12
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);//出库后执行页面刷新
            }
        }
Ejemplo n.º 13
0
 public bool Od_Task_UpdateOne(OD_Task one)
 {
     return(SQL_Da_OD_Task.UpdateOne(one));
 }
Ejemplo n.º 14
0
 public bool Od_Task_InsertOne(OD_Task one)
 {
     return(SQL_Da_OD_Task.InsertNew(one));
 }