Exemple #1
0
        /// <summary>
        /// 托盘入库方式
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPalletIn_Click(object sender, EventArgs e)
        {
            PalletSelect frm = new PalletSelect();



            if (frm.ShowDialog() == DialogResult.OK)
            {
                object obj = ObjectUtil.GetObject(Context.ProcessDispatcher.WriteToService("StockPLC_01", "01_1_122_1"));
                if (obj == null || obj.ToString() != "0")
                {
                    return;
                }
                if (frm.Flag == 1)  //单托盘入库
                {
                    string writeItem = "01_2_122_";
                    int[]  ServiceW  = new int[3];
                    ServiceW[0] = 9999; //任务号
                    ServiceW[1] = 131;  //目的地址
                    ServiceW[2] = 4;


                    Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "1", ServiceW); //PLC写入任务
                    Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "2", 1);        //PLC写入任务
                }
                else if (frm.Flag == 2)
                {
                    PalletBillDal Billdal     = new PalletBillDal();
                    string        TaskID      = Billdal.CreatePalletInBillTask(true); //空托盘组入库单,生成Task.
                    string        FromStation = "122";
                    string        ToStation   = "122";
                    string        writeItem   = "01_2_122_";

                    string   strWhere  = string.Format("TASK_ID='{0}'", TaskID);
                    TaskDal  dal       = new TaskDal();
                    string[] CellValue = dal.AssignCell(strWhere, ToStation); //货位申请

                    string        TaskNo = dal.InsertTaskDetail(CellValue[0]);
                    SysStationDal sysDal = new SysStationDal();
                    DataTable     dt     = sysDal.GetSationInfo(CellValue[1], "11", "3");


                    dal.UpdateTaskState(CellValue[0], "1");                                                                               //更新任务开始执行
                    ProductStateDal StateDal = new ProductStateDal();
                    StateDal.UpdateProductCellCode(CellValue[0], CellValue[1]);                                                           //更新Product_State 货位

                    dal.UpdateTaskDetailStation(FromStation, ToStation, "2", string.Format("TASK_ID='{0}' AND ITEM_NO=1", CellValue[0])); //更新货位申请起始地址及目标地址。
                    int[] ServiceW = new int[3];
                    ServiceW[0] = int.Parse(TaskNo);                                                                                      //任务号
                    ServiceW[1] = int.Parse(dt.Rows[0]["STATION_NO"].ToString());                                                         //目的地址
                    ServiceW[2] = 2;

                    Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "1", ServiceW);                                                           //PLC写入任务
                    Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "2", 1);                                                                  //PLC写入任务
                    dal.UpdateTaskDetailStation(ToStation, dt.Rows[0]["STATION_NO"].ToString(), "1", string.Format("TASK_ID='{0}' AND ITEM_NO=2", CellValue[0])); //更新货位到达入库站台,

                    //更新单据开始
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// ������ⷽʽ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPalletIn_Click(object sender, EventArgs e)
        {
            PalletSelect frm = new PalletSelect();

             if (frm.ShowDialog() == DialogResult.OK)
             {
                 object obj = ObjectUtil.GetObject(Context.ProcessDispatcher.WriteToService("StockPLC_01", "01_1_122_1"));
                 if (obj == null || obj.ToString() != "0")
                     return;
                 if (frm.Flag == 1) //���������
                 {
                     string writeItem = "01_2_122_";
                     int[] ServiceW = new int[3];
                     ServiceW[0] =9999; //�����
                     ServiceW[1] = 131;//Ŀ�ĵ�ַ
                     ServiceW[2] = 4;

                     Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "1", ServiceW); //PLC�����
                     Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "2", 1); //PLC�����
                 }
                 else if (frm.Flag == 2)
                 {
                     PalletBillDal Billdal = new PalletBillDal();
                     string TaskID = Billdal.CreatePalletInBillTask(true); //����������ⵥ������Task.
                     string FromStation = "122";
                     string ToStation = "122";
                     string writeItem = "01_2_122_";

                     string strWhere = string.Format("TASK_ID='{0}'", TaskID);
                     TaskDal dal = new TaskDal();
                     string[] CellValue = dal.AssignCell(strWhere, ToStation);//�����

                     string TaskNo = dal.InsertTaskDetail(CellValue[0]);
                     SysStationDal sysDal = new SysStationDal();
                     DataTable dt = sysDal.GetSationInfo(CellValue[1], "11","3");

                     dal.UpdateTaskState(CellValue[0], "1");//��������ʼִ��
                     ProductStateDal StateDal = new ProductStateDal();
                     StateDal.UpdateProductCellCode(CellValue[0], CellValue[1]); //����Product_State ��λ

                     dal.UpdateTaskDetailStation(FromStation, ToStation, "2", string.Format("TASK_ID='{0}' AND ITEM_NO=1", CellValue[0])); //���»�λ������ʼ��ַ��Ŀ���ַ��
                     int[] ServiceW = new int[3];
                     ServiceW[0] = int.Parse(TaskNo); //�����
                     ServiceW[1] = int.Parse(dt.Rows[0]["STATION_NO"].ToString());//Ŀ�ĵ�ַ
                     ServiceW[2] = 2;

                     Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "1", ServiceW); //PLC�����
                     Context.ProcessDispatcher.WriteToService("StockPLC_01", writeItem + "2", 1); //PLC�����
                     dal.UpdateTaskDetailStation(ToStation, dt.Rows[0]["STATION_NO"].ToString(), "1", string.Format("TASK_ID='{0}' AND ITEM_NO=2", CellValue[0]));//���»�λ�������վ̨��

                     //���µ��ݿ�ʼ

                 }
             }
        }