Ejemplo n.º 1
0
        public Model.MessageShow EditSaveMethod(Model.CargoConfig data)
        {
            MessageShow msg = new MessageShow();

            if (data.id <= 0)//The current user already exists
            {
                if (this.SqlCount(string.Format("SELECT COUNT(1) FROM rfidinfo WHERE rfidKey='{0}'", data.rfidKey), null) > 0)
                {
                    msg.success = false;
                    msg.message = "此标签已存在";
                }
                else
                {
                    string insertStr = "INSERT INTO rfidinfo(rfidKey,action,plantTo,stockLocTo,stockBinTo,plantFrom,stockLocFrom,stockBinFrom,assLine,linePoint,ecp,actionGroup) VALUES(@rfidKey,@action,(select id from plant where plantCode=@plantTo),(select id from stock where stockCode=@stockLocTo),(select id from bin where binCode=@stockBinTo),(select id from plant where plantCode=@plantFrom),(select id from stock where stockCode=@stockLocFrom),(select id from bin where binCode=@stockBinFrom),@assLine,@linePoint,@ecp,@actionGroup)";
                    msg.success = this.SqlExecute <int>(insertStr, data) > 0;
                    msg.message = msg.success ? "添加成功" : "添加失败";
                }
            }
            else
            {
                msg.success = this.SqlExecute <int>("UPDATE rfidinfo SET action=@action,plantTo=(select id from plant where plantCode=@plantTo),stockLocTo=(select id from stock where stockCode=@stockLocTo),stockBinTo=(select id from bin where binCode=@stockBinTo),plantFrom=(select id from plant where plantCode=@plantFrom),stockLocFrom=(select id from stock where stockCode=@stockLocFrom),stockBinFrom=(select id from bin where binCode=@stockBinFrom),assLine=@assLine,linePoint=@linePoint,ecp=@ecp,actionGroup=@actionGroup WHERE id=@Id", data) > 0;
                msg.message = msg.success ? "编辑成功" : "编辑失败";
            }
            return(msg);
        }
Ejemplo n.º 2
0
 public Model.MessageShow EditSaveMethod(Model.CargoConfig data)
 {
     return(dal.EditSaveMethod(data));
 }