public Tuple <dynamic, DataTable> GetGoodsDetail(GOODSEntity Data) { string sql = $@"select G.*,K.NAME KINDNAME from GOODS G,GOODS_KIND K where G.KINDID=K.ID(+) "; if (!Data.GOODSID.IsEmpty()) { sql += (" and GOODSID= " + Data.GOODSID); } DataTable dt = DbHelper.ExecuteTable(sql); dt.NewEnumColumns <商品状态>("STATUS", "STATUSMC"); dt.NewEnumColumns <商品类型>("TYPE", "TYPEMC"); dt.NewEnumColumns <核算方式>("STYLE", "STYLEMC"); dt.Rows[0]["JXSL"] = dt.Rows[0]["JXSL"].ToString().ToDouble() * 100; dt.Rows[0]["XXSL"] = dt.Rows[0]["XXSL"].ToString().ToDouble() * 100; string sqlshop = $@"SELECT G.*,S.CODE,Y.CATEGORYCODE,Y.CATEGORYNAME " + " FROM GOODS_SHOP G,SHOP S,CATEGORY Y " + " WHERE G.SHOPID=S.SHOPID AND G.CATEGORYID= Y.CATEGORYID"; if (!Data.GOODSID.IsEmpty()) { sqlshop += (" and G.GOODSID= " + Data.GOODSID); } DataTable dtshop = DbHelper.ExecuteTable(sqlshop); return(new Tuple <dynamic, DataTable>(dt.ToOneLine(), dtshop)); }
public string SaveGoods(GOODSEntity SaveData) { var v = GetVerify(SaveData); var spbmcd = 6; //定义随机数,条码末尾校验位 Random sj = new Random(); if (SaveData.GOODSID.IsEmpty()) { SaveData.GOODSID = CommonService.NewINC("GOODSID"); } if (SaveData.GOODSDM.IsEmpty()) { SaveData.GOODSDM = CommonService.NewINC("GOODSDM").PadLeft(spbmcd, '0'); } if (SaveData.BARCODE.IsEmpty()) { var szFormatBarcode = "21{0:D" + spbmcd + "}{1:D" + (10 - Convert.ToInt32(spbmcd)) + "}"; var barCode = string.Format(szFormatBarcode, SaveData.GOODSDM, 0); SaveData.BARCODE = (barCode + sj.Next(10)).ToString(); } v.Require(a => a.GOODSDM); v.IsUnique(a => a.GOODSDM); v.Require(a => a.TYPE); v.Require(a => a.NAME); v.Require(a => a.BARCODE); v.Require(a => a.CONTRACTID); v.Require(a => a.MERCHANTID); v.Require(a => a.STYLE); v.Require(a => a.BRANDID); //v.Require(a => a.XXSL); v.Require(a => a.JSKL_GROUP); SaveData.JXSL = (SaveData.JXSL.ToDouble() / 100).ToString(); SaveData.XXSL = (SaveData.XXSL.ToDouble() / 100).ToString(); SaveData.REPORTER = employee.Id; SaveData.REPORTER_NAME = employee.Name; SaveData.REPORTER_TIME = DateTime.Now.ToString(); SaveData.STATUS = ((int)商品状态.未审核).ToString(); SaveData.GOODS_SHOP.ForEach(sdb => { GetVerify(sdb).Require(a => a.GOODSID); GetVerify(sdb).Require(a => a.BRANCHID); GetVerify(sdb).Require(a => a.SHOPID); GetVerify(sdb).Require(a => a.CATEGORYID); }); v.Verify(); DbHelper.Save(SaveData); return(SaveData.GOODSID); }
public object ShowOneEdit(GOODSEntity Data) { string sql = $@" select G.*,M.NAME SHMC,D.NAME BRANDMC,C.CODE,C.PKIND_ID from GOODS G,MERCHANT M,GOODS_KIND C,BRAND D"; sql += " where G.MERCHANTID=M.MERCHANTID AND G.KINDID=C.ID and G.BRANDID =D.ID "; if (!Data.GOODSID.IsEmpty()) { sql += (" and G.GOODSID= " + Data.GOODSID); } DataTable dt = DbHelper.ExecuteTable(sql); dt.Rows[0]["JXSL"] = dt.Rows[0]["JXSL"].ToString().ToDouble() * 100; dt.Rows[0]["XXSL"] = dt.Rows[0]["XXSL"].ToString().ToDouble() * 100; dt.NewEnumColumns <核算方式>("STYLE", "STYLEMC"); string sqlshop = $@"SELECT G.*,S.CODE,Y.CATEGORYCODE,Y.CATEGORYNAME " + " FROM GOODS_SHOP G,SHOP S,CATEGORY Y " + " WHERE G.SHOPID=S.SHOPID AND G.CATEGORYID= Y.CATEGORYID"; if (!Data.GOODSID.IsEmpty()) { sqlshop += (" and G.GOODSID= " + Data.GOODSID); } DataTable dtshop = DbHelper.ExecuteTable(sqlshop); string sql_jsklGroup = $@"SELECT L.CONTRACTID,L.GROUPNO,L.INX,to_char(L.STARTDATE,'YYYY.MM.DD') STARTDATE, " + " to_char(L.ENDDATE,'YYYY.MM.DD') ENDDATE,L.SALES_START,L.SALES_END,L.JSKL FROM CONTJSKL L WHERE 1=1 "; if (!dt.Rows[0]["CONTRACTID"].ToString().IsEmpty()) { sql_jsklGroup += (" and CONTRACTID= " + dt.Rows[0]["CONTRACTID"].ToString()); } if (!dt.Rows[0]["JSKL_GROUP"].ToString().IsEmpty()) { sql_jsklGroup += (" and GROUPNO= " + dt.Rows[0]["JSKL_GROUP"].ToString()); } sql_jsklGroup += " order by GROUPNO"; DataTable jsklGroup = DbHelper.ExecuteTable(sql_jsklGroup); var result = new { goods = dt, goods_shop = new dynamic[] { dtshop }, goods_group = new dynamic[] { jsklGroup } }; return(result); }
public string ExecData(GOODSEntity Data) { GOODSEntity mer = DbHelper.Select(Data); if (mer.STATUS == ((int)商品状态.审核).ToString()) { throw new LogicException("商品(" + Data.GOODSDM + ")已经审核不能再次审核!"); } using (var Tran = DbHelper.BeginTransaction()) { mer.VERIFY = employee.Id; mer.VERIFY_NAME = employee.Name; mer.VERIFY_TIME = DateTime.Now.ToString(); mer.STATUS = ((int)商品状态.审核).ToString(); DbHelper.Save(mer); Tran.Commit(); } return(mer.GOODSDM); }
public void ExecData(GOODSEntity Data) { service.SpglService.ExecData(Data); }
public UIResult ShowOneEdit(GOODSEntity Data) { return(new UIResult(service.SpglService.ShowOneEdit(Data))); }
public string Save(GOODSEntity SaveData) { return(service.SpglService.SaveGoods(SaveData)); }