示例#1
0
        public JsonResult Sync(string ErpVoucherNo)
        {
            string            strMsg = "";
            ParamaterFiled_DB PDB    = new ParamaterFiled_DB();

            if (PDB.GetVoucherNo(ErpVoucherNo, ref strMsg, "1"))
            {
                return(Json(new { state = true }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { state = false, obj = strMsg }, JsonRequestBehavior.AllowGet));
            }

            ////if (ErpVoucherNo.Length < 10)
            ////{
            ////    return Json(new { state = false, obj = "ERP单据长度不能少于10位!" }, JsonRequestBehavior.AllowGet);
            ////}
            //string ErrorMsg = ""; int WmsVoucherType = 32; string syncType = "ERP"; int syncExcelVouType = -1; DataSet excelds = null;
            //BILWeb.SyncService.ParamaterField_Func PFunc = new BILWeb.SyncService.ParamaterField_Func();
            ////10:入库单据
            //if (PFunc.Sync(10, string.Empty, ErpVoucherNo, WmsVoucherType, ref ErrorMsg, syncType, syncExcelVouType, excelds))
            //{

            //    return Json(new { state = true }, JsonRequestBehavior.AllowGet);
            //}
            //else
            //{
            //    return Json(new { state = false, obj = ErrorMsg }, JsonRequestBehavior.AllowGet);
            //}
        }
示例#2
0
        public JsonResult Sync(string MaterialNo)
        {
            //string ErrorMsg = ""; int WmsVoucherType = -1; string syncType = "ERP"; int syncExcelVouType = -1; DataSet excelds = null;
            //BILWeb.SyncService.ParamaterField_Func PFunc = new BILWeb.SyncService.ParamaterField_Func();

            //if (PFunc.Sync(99, string.Empty, MaterialNo, WmsVoucherType, ref ErrorMsg, syncType, syncExcelVouType, excelds))
            //{

            //    return Json(new { state = true }, JsonRequestBehavior.AllowGet);
            //}
            //else
            //{
            //    return Json(new { state = false, obj = ErrorMsg }, JsonRequestBehavior.AllowGet);
            //}

            string            strMsg = "";
            ParamaterFiled_DB PDB    = new ParamaterFiled_DB();

            if (PDB.GetVoucherNo(MaterialNo, ref strMsg, "0"))
            {
                return(Json(new { state = true }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { state = false, obj = strMsg }, JsonRequestBehavior.AllowGet));
            }
        }
示例#3
0
        protected override string GetFilterSql(UserModel user, T_ProductDetail model)
        {
            string strSql = " where 1=1 ";
            string strAnd = " and ";

            if (!string.IsNullOrEmpty(model.ErpVoucherNo))
            {
                //同步单据
                string            strMsg = "";
                ParamaterFiled_DB PDB    = new ParamaterFiled_DB();
                PDB.GetVoucherNo(model.ErpVoucherNo, ref strMsg, "1");


                strSql += strAnd;
                strSql += " erpvoucherno like '%" + model.ErpVoucherNo.Trim() + "%' ";
            }
            if (model.HeaderID != 0)
            {
                strSql += strAnd;
                strSql += " HeaderID = " + model.HeaderID;
            }
            if (!string.IsNullOrEmpty(model.MaterialNo))
            {
                strSql += strAnd;
                strSql += " MaterialNo like '%" + model.MaterialNo.Trim() + "%' ";
            }
            return(strSql);
        }
示例#4
0
        //protected override T_InStockInfo GetModelByJson(string ModelJson)
        //{
        //    return JSONHelper.JsonToObject<T_InStockInfo>(ModelJson);
        //}

        protected override T_InStockInfo GetModelByJson(string strJson)
        {
            string errorMsg           = string.Empty;
            T_InStockDetailInfo model = JSONHelper.JsonToObject <T_InStockDetailInfo>(strJson);

            if (!string.IsNullOrEmpty(model.ErpVoucherNo))
            {
                //BILWeb.SyncService.ParamaterField_Func PFunc = new BILWeb.SyncService.ParamaterField_Func();
                //PFunc.Sync(10, string.Empty, model.ErpVoucherNo, -1, ref errorMsg, "ERP", -1, null);
                ParamaterFiled_DB PDB = new ParamaterFiled_DB();
                PDB.GetVoucherNo(model.ErpVoucherNo, ref errorMsg, "1");
            }
            return(JSONHelper.JsonToObject <T_InStockInfo>(strJson));
        }
示例#5
0
        protected override string GetFilterSql(UserModel user, View_Product_Model model)
        {
            //string strSql = base.GetFilterSql(user, model);
            string strSql = "where 1=1 ";
            string strAnd = " and ";

            if (!string.IsNullOrEmpty(model.HeadErpVoucherNo))
            {
                //同步单据
                string            strMsg = "";
                ParamaterFiled_DB PDB    = new ParamaterFiled_DB();
                PDB.GetVoucherNo(model.HeadErpVoucherNo, ref strMsg, "1");


                strSql += strAnd;
                strSql += " headerpvoucherno like '%" + model.HeadErpVoucherNo.Trim() + "%' ";
            }

            strSql += " and (substring(materialno,1,1)='J' or substring(materialno,1,1)='M' or materialno='') ";
            return(strSql);
        }
示例#6
0
        /// <summary>
        /// 根据生产单号获取订单数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetModel(string orderNo)
        {
            SuccessResult successResult = new SuccessResult();

            successResult.Success = false;
            try
            {
                //同步单据
                string            strMsg = "";
                ParamaterFiled_DB PDB    = new ParamaterFiled_DB();
                PDB.GetVoucherNo(orderNo, ref strMsg, "1");
                if (!string.IsNullOrEmpty(strMsg))
                {
                    successResult.Msg = strMsg;
                    return(Json(successResult, JsonRequestBehavior.AllowGet));
                }

                var product = new ProductService().GetList(x => x.ErpVoucherNo == orderNo).FirstOrDefault();
                if (product == null)
                {
                    successResult.Msg = "没有该订单!";
                    return(Json(successResult, JsonRequestBehavior.AllowGet));
                }
                var records = new CheckRecordService().GetList(x => x.ProductOrderId == product.id);
                product.BackQualityQty = (records == null || records.Count() == 0)
                                         ? 0 : records.Sum(x => x.BackQualityQty);
                var orderNoQualityQty = new View_CheckRecordService().GetOrderNoQualityQty(orderNo);
                product.OrderNoQualityQty = orderNoQualityQty;

                successResult.Data    = product;
                successResult.Success = true;
            }
            catch (Exception ex)
            {
                successResult.Msg = ex.Message;
            }
            return(Json(successResult, JsonRequestBehavior.AllowGet));
        }
示例#7
0
        protected override string GetFilterSql(UserModel user, T_InStockInfo model)
        {
            string strSql = base.GetFilterSql(user, model);
            string strAnd = " and ";

            if (model.Status > 0)
            {
                //strSql += strAnd;
                //strSql += "isnull(status,1)= '" + model.Status + "'";
                //0:PDA 1:PC
                if (model.PcOrPda == "0")
                {
                    if (model.Status == 1 || model.Status == 2)
                    {
                        strSql += strAnd;
                        strSql += "(isnull(status,1)=1 or isnull(status,1)=2)";
                    }
                    else
                    {
                        strSql += strAnd;
                        strSql += "isnull(status,1)= '" + model.Status + "'";
                    }
                }
                else
                {
                    strSql += strAnd;
                    strSql += "isnull(status,1)= '" + model.Status + "'";
                }
            }
            if (!string.IsNullOrEmpty(model.StrVoucherType) && model.StrVoucherType.Equals("预到货"))
            {
                strSql += strAnd;
                strSql += "(isnull(AdvInStatus,1)=1 or isnull(AdvInStatus,1)=2)";
            }

            if (!string.IsNullOrEmpty(model.SupplierNo))
            {
                strSql += strAnd;
                strSql += " (SupplierNo Like '" + model.SupplierNo + "%'  or SupplierName Like '" + model.SupplierNo + "%' )";
            }

            if (model.DateFrom != null)
            {
                strSql += strAnd;
                strSql += " CreateTime >= " + model.DateFrom.ToDateTime().Date.ToOracleTimeString() + " ";
            }

            if (model.DateTo != null)
            {
                strSql += strAnd;
                strSql += " CreateTime <= " + model.DateTo.ToDateTime().Date.AddDays(1).ToOracleTimeString() + " ";
            }

            if (!string.IsNullOrEmpty(model.ErpVoucherNo))
            {
                //同步单据
                string            strMsg = "";
                ParamaterFiled_DB PDB    = new ParamaterFiled_DB();
                PDB.GetVoucherNo(model.ErpVoucherNo, ref strMsg, "1");

                strSql += strAnd;
                strSql += " erpvoucherno like  '%" + model.ErpVoucherNo.Trim() + "%'  ";
            }

            if (model.VoucherType > 0)
            {
                strSql += strAnd;
                strSql += " vouchertype =" + model.VoucherType + "  ";
            }
            //0:PDA 1:PC
            if (model.PcOrPda == "0")
            {
                strSql += strAnd;
                strSql += " vouchertype!=20 and  vouchertype!=33";

                if (!user.UserNo.Equals("admin"))
                {
                    strSql += strAnd;
                    //strongholdcode = '" + user.StrongHoldCode + "' and
                    strSql += "  (fromerpwarehouse ='" + user.WarehouseCode + "' or isnull(fromerpwarehouse,'')='' ";
                    //G102  G202 G301 成品入库单 除了这三个仓库默认收到 集团成品仓G001
                    //if (user.WarehouseCode == "G001")
                    //{
                    //    strSql += " or fromerpwarehouse not in ('G102','G202','G301') ";
                    //}
                    strSql += " )";
                }
            }
            else
            {
                //if (!user.UserNo.Equals("admin"))
                //{
                //    strSql += strAnd;
                //    strSql += " strongholdcode = '" + user.StrongHoldCode + "' ";
                //}
            }



            //if (!user.UserNo.Equals("admin"))
            //{
            //    if (user.WarehouseCode.Split(',').Length > 1)
            //    {
            //        //只能华南中山仓库才能看到采购订单和生产订单
            //        if (!user.WarehouseCode.Contains("2") && !user.WarehouseCode.Contains("1"))
            //        {
            //            //不属于华南仓库,仓库ID默认为零
            //            strSql += strAnd;
            //            //strSql += "id in (select headerid from t_instockdetail where isnull(warehouseid,0) in (select * from Func_StringSplitTable('" + user.WarehouseCode + "',',')))";//"(select count(1) from t_outstockdetail where warehouseid in (select * from Func_StringSplitTable('"+user.WarehouseCode+"',','))) >1";
            //            strSql += "EXISTS ( select headerid from t_instockdetail where EXISTS( select id from Func_StringSplitTable('" + user.WarehouseCode + "',',') where isnull(warehouseid,0) = id ) AND HEADERID= V_INSTOCK.ID)";

            //        }
            //        else
            //        {
            //            //不属于华南仓库,仓库ID默认为1
            //            strSql += strAnd;
            //            //strSql += "id in (select headerid from t_instockdetail where isnull(warehouseid,1) in (select * from Func_StringSplitTable('" + user.WarehouseCode + "',',')))";//"(select count(1) from t_outstockdetail where warehouseid in (select * from Func_StringSplitTable('"+user.WarehouseCode+"',','))) >1";
            //            strSql += "EXISTS ( select headerid from t_instockdetail where EXISTS( select id from Func_StringSplitTable('" + user.WarehouseCode + "',',') where isnull(warehouseid,1) = id ) AND HEADERID= V_INSTOCK.ID)";
            //        }
            //    }
            //    else
            //    {
            //        if (!user.WarehouseCode.Contains("2") && !user.WarehouseCode.Contains("1"))
            //        {
            //            strSql += strAnd;
            //            //strSql += "id in (select headerid from t_instockdetail where isnull(warehouseid,0) in (select * from Func_GetAllWareHouseTable('" + user.WarehouseCode + "')))";
            //            strSql += "EXISTS ( select headerid from t_instockdetail where EXISTS( select id from Func_GetAllWareHouseTable('" + user.WarehouseCode + "') where isnull(warehouseid,0) = id ) AND HEADERID= V_INSTOCK.ID)";
            //        }
            //        else
            //        {
            //            strSql += strAnd;
            //            //strSql += "id in (select headerid from t_instockdetail where isnull(warehouseid,1) in (select * from Func_GetAllWareHouseTable('" + user.WarehouseCode + "')))";
            //            strSql += " EXISTS ( select headerid from t_instockdetail where EXISTS( select id from Func_GetAllWareHouseTable('" + user.WarehouseCode + "') where isnull(warehouseid,1) = id ) AND HEADERID= V_INSTOCK.ID)";
            //        }
            //    }
            //}



            return(strSql); //+ "order by id desc";
        }
示例#8
0
        protected override string GetFilterSql(UserModel user, T_OutStockTaskInfo model)
        {
            string strUserNo   = string.Empty;
            string strSerialNo = string.Empty;

            string strSql = base.GetFilterSql(user, model);
            string strAnd = " and ";

            if (model.Status > 0)
            {
                if (model.PcOrPda == 1)//PC请求
                {
                    strSql += strAnd;
                    strSql += "isnull(status,1)= '" + model.Status + "'";
                }
                else
                {
                    if (model.Status == 1 || model.Status == 2)
                    {
                        strSql += strAnd;
                        strSql += "( status=1 or status=2 )";
                    }
                    else
                    {
                        strSql += strAnd;
                        strSql += "status= '" + model.Status + "'";
                    }
                }
            }

            if (!string.IsNullOrEmpty(model.SupcusCode))
            {
                strSql += strAnd;
                strSql += " (SupcusCode Like '" + model.SupcusCode + "%'  or SUPCUSNAME Like '" + model.SupcusCode + "%' )";
            }

            if (model.DateFrom != null)
            {
                strSql += strAnd;
                strSql += " CreateTime >= " + model.DateFrom.ToDateTime().Date.ToOracleTimeString() + " ";
            }

            if (model.DateTo != null)
            {
                strSql += strAnd;
                strSql += " CreateTime <= " + model.DateTo.ToDateTime().Date.AddDays(1).ToOracleTimeString() + " ";
            }

            if (!string.IsNullOrEmpty(model.TaskNo))
            {
                strSql += strAnd;
                strSql += " (taskno Like '%" + model.TaskNo + "%'  )";
            }


            if (model.VoucherType > 0)
            {
                strSql += strAnd;
                strSql += " VoucherType ='" + model.VoucherType + "'";
            }

            if (!string.IsNullOrEmpty(model.ErpVoucherNo))
            {
                //同步单据
                string            strMsg = "";
                ParamaterFiled_DB PDB    = new ParamaterFiled_DB();
                PDB.GetVoucherNo(model.ErpVoucherNo, ref strMsg, "2");

                strSql += strAnd;
                strSql += " ErpVoucherNo like '%" + model.ErpVoucherNo.Trim() + "%'";
            }

            //if (!string.IsNullOrEmpty(model.PickLeaderUserNo))
            //{
            //    strSql += strAnd;
            //    strSql += " Pickleaderuserno like '" + GetUserNo(model.PickLeaderUserNo) + "%'";
            //}

            //if (!string.IsNullOrEmpty(model.PickUserNo))
            //{
            //    strSql += strAnd;
            //    strSql += " ID in (select taskid from t_Taskpick where Pickuserno like '" + GetUserNo(model.PickUserNo) + "%')";
            //}

            if (!string.IsNullOrEmpty(model.StrongHoldCode))
            {
                strSql += strAnd;
                strSql += " (StrongHoldCode like '" + model.StrongHoldCode + "%' )";
            }

            if (!string.IsNullOrEmpty(model.StrongHoldName))
            {
                strSql += strAnd;
                strSql += " (StrongHoldName like '" + model.StrongHoldName + "%' )";
            }

            if (!user.UserNo.Equals("admin"))
            {
                strSql += strAnd;

                string                 strwarehouse = "warehouseno in (";
                T_WareHouse_Func       twfun        = new T_WareHouse_Func();
                List <T_WareHouseInfo> lstWarehouse = new List <T_WareHouseInfo>();
                UserInfo               userInfo     = new UserInfo {
                    UserNo = user.UserNo, ID = user.ID
                };
                if (twfun.GetModelListBySql(userInfo, ref lstWarehouse))
                {
                    if (lstWarehouse.Count > 0)
                    {
                        foreach (var item in lstWarehouse)
                        {
                            strwarehouse = (strwarehouse + "'" + item.WareHouseNo + "',");
                        }
                        strwarehouse = strwarehouse.Substring(0, strwarehouse.Length - 1);
                        strwarehouse = (strwarehouse + ")");
                    }
                    else
                    {
                        strwarehouse = "1=2 ";
                    }
                }


                //StrongHoldCode = '" + user.StrongHoldCode + "' and
                strSql += "  (" + strwarehouse + " or isnull(fromerpwarehouse,'')='')";
            }

            if (model.WareHouseID > 0)
            {
                strSql += strAnd;
                strSql += " warehouseid = '" + model.WareHouseID + "' ";
            }

            if (!string.IsNullOrEmpty(model.MaterialNo))
            {
                strSql += strAnd;
                strSql += "  id in ( SELECT HEADERID FROM v_Outtaskdetail WHERE MATERIALNO LIKE '%" + model.MaterialNo + "%' ) ";
            }

            if (!string.IsNullOrEmpty(model.VouUser))
            {
                strSql += strAnd;
                strSql += "  VouUser like '" + model.VouUser + "%' ";
            }

            if (!string.IsNullOrEmpty(model.CarNo))
            {
                strSql += strAnd;
                strSql += " taskno = ( select taskno from t_pickcar where carno = '" + model.CarNo + "' ) ";
            }

            if (!string.IsNullOrEmpty(model.BarCode))
            {
                strSerialNo = OutBarCode.OutBarCode_DeCode.GetEndSerialNo(model.BarCode);
                strSql     += strAnd;
                strSql     += " taskno = ( select a.Taskno from v_Outtaskdetail a where a.id = (select a.Taskdetailesid from t_stock a where a.Serialno = '" + strSerialNo + "') )";
            }

            if (model.PcOrPda != 1)
            {
                strSql += strAnd;
                strSql += " id in (select headerid from t_Taskdetails a where a.Fromerpwarehouse = '" + user.WarehouseCode + "' or a.Fromerpwarehouse is null) ";
            }

            if (model.TaskType > 0)
            {
                if (model.TaskType == 4)
                {
                    strSql += strAnd;
                    strSql += " ( tasktype = 2 or tasktype =3 ) ";
                }
                else
                {
                    strSql += strAnd;
                    strSql += " tasktype = '" + model.TaskType.ToInt32() + "' ";
                }
            }

            //strSql += strAnd;
            //strSql += " tasktype = 2 ";

            return(strSql);//+ " order by id  ";
        }