| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- using Castle.ActiveRecord;
- using NHibernate.Criterion;
- using System;
- using System.Text;
- namespace BizCom
- {
- [ActiveRecord("CE_ErpDesignerBill")]
- public class CeErpDesignerBill : ComBase<CeErpDesignerBill>
- {
- /// <summary>
- ///
- /// </summary>
- [PrimaryKey(PrimaryKeyType.Native)]
- public int ID { get; set; }
- private string _tid = "";
- /// <summary>
- ///订单编号
- /// </summary>
- [Property]
- public string tid
- {
- get { return _tid; }
- set { _tid = value; }
- }
- private string _oid = "";
- /// <summary>
- ///原订单号
- /// </summary>
- [Property]
- public string oid
- {
- get { return _oid; }
- set { _oid = value; }
- }
- private int _uid = 0;
- /// <summary>
- ///设计师用户Id
- /// </summary>
- [Property]
- public int uid
- {
- get { return _uid; }
- set { _uid = value; }
- }
- private string _userName = "";
- /// <summary>
- ///设计师名称
- /// </summary>
- [Property]
- public string userName
- {
- get { return _userName; }
- set { _userName = value; }
- }
- private int _designerType = 0;
- /// <summary>
- ///设计师类型:1内部设计师 2外协设计师
- /// </summary>
- [Property]
- public int designerType
- {
- get { return _designerType; }
- set { _designerType = value; }
- }
- private string _designerTypeText = "";
- /// <summary>
- ///设计师类型
- /// </summary>
- [Property]
- public string designerTypeText
- {
- get { return _designerTypeText; }
- set { _designerTypeText = value; }
- }
- private int _designNum = 0;
- /// <summary>
- ///设计款数
- /// </summary>
- [Property]
- public int designNum
- {
- get { return _designNum; }
- set { _designNum = value; }
- }
- private string _designSize = "";
- /// <summary>
- ///设计尺寸
- /// </summary>
- [Property]
- public string designSize
- {
- get { return _designSize; }
- set { _designSize = value; }
- }
- private int _modifyNum = 0;
- /// <summary>
- ///改稿款数
- /// </summary>
- [Property]
- public int modifyNum
- {
- get { return _modifyNum; }
- set { _modifyNum = value; }
- }
- private string _modifySize = "";
- /// <summary>
- ///改稿尺寸
- /// </summary>
- [Property]
- public string modifySize
- {
- get { return _modifySize; }
- set { _modifySize = value; }
- }
- private double _price = 0;
- /// <summary>
- ///设计师填写价格
- /// </summary>
- [Property]
- public double price
- {
- get { return _price; }
- set { _price = value; }
- }
- private double _realPrice = 0;
- /// <summary>
- ///实际价格
- /// </summary>
- [Property]
- public double realPrice
- {
- get { return _realPrice; }
- set { _realPrice = value; }
- }
- /// <summary>
- ///创建时间
- /// </summary>
- [Property]
- public DateTime? create_time { get; set; }
- private int _create_u_id = 0;
- /// <summary>
- ///创建人uid
- /// </summary>
- [Property]
- public int create_u_id
- {
- get { return _create_u_id; }
- set { _create_u_id = value; }
- }
- private string _create_u_name = "";
- /// <summary>
- ///创建人名称
- /// </summary>
- [Property]
- public string create_u_name
- {
- get { return _create_u_name; }
- set { _create_u_name = value; }
- }
- /// <summary>
- ///修改时间
- /// </summary>
- [Property]
- public DateTime? update_time { get; set; }
- private int _update_u_id = 0;
- /// <summary>
- ///更新人uid
- /// </summary>
- [Property]
- public int update_u_id
- {
- get { return _update_u_id; }
- set { _update_u_id = value; }
- }
- private string _update_u_name = "";
- /// <summary>
- ///更新人名称
- /// </summary>
- [Property]
- public string update_u_name
- {
- get { return _update_u_name; }
- set { _update_u_name = value; }
- }
- private int _isAudit = 0;
- /// <summary>
- ///已审核
- /// </summary>
- [Property]
- public int isAudit
- {
- get { return _isAudit; }
- set { _isAudit = value; }
- }
- private int _isDel = 0;
- /// <summary>
- ///删除标识
- /// </summary>
- [Property]
- public int isDel
- {
- get { return _isDel; }
- set { _isDel = value; }
- }
- public static void Del(string tid)
- {
- StringBuilder sql = new StringBuilder();
- sql.AppendFormat("update CE_ErpDesignerBill set isDel=1 where tid='" + tid + "'");
- ExecuteNonQuery(sql.ToString());
- }
- public static CeErpDesignerBill GetByTid(string eid)
- {
- return FindFirst(Expression.Sql(string.Format("tid='{0}'", eid)));
- }
- public static void updateDesignerBill(string tid, int pid)//系统自动核算卡片设计费
- {
- if (tid.Length <= 0) return;
- double realPrice = 0, designLength = 0, designWidth = 0;
- double designWs = 0, designPrice = 0, modifyPrice = 1;
- CeErpDesignerBill ceErpDesignerBill = GetByTid(tid);
- if (ceErpDesignerBill == null) return;
- if (ceErpDesignerBill.realPrice != 0) return;
- if (ceErpDesignerBill.designSize.IndexOf("x") >= 0)
- {
- designLength = Convert.ToDouble(ceErpDesignerBill.designSize.Split('x')[0]);
- designWidth = Convert.ToDouble(ceErpDesignerBill.designSize.Split('x')[1]);
- double l1 = Math.Ceiling(designLength / 90);
- double w1 = Math.Ceiling(designWidth / 54);
- double l2 = Math.Ceiling(designLength / 54);
- double w2 = Math.Ceiling(designWidth / 90);
- designWs = Math.Min(l1 * w1, l2 * w2);
- }
- CeErpProductPrice entitys = CeErpProductPrice.GetByPType(pid, designWs);
- if (entitys == null) return;
- designPrice = entitys.designPrice;
- realPrice = designPrice * ceErpDesignerBill.designNum + modifyPrice * ceErpDesignerBill.modifyNum;
- StringBuilder sql = new StringBuilder();
- sql.AppendFormat("update CE_ErpDesignerBill set realPrice = " + realPrice + " where tid = '" + tid + "'");
- ExecuteNonQuery(sql.ToString());
- }
- public static void updateBill(string tid, int pid, string bz)//手提袋自动核算
- {
- if (tid.Length <= 0) return;
- string[] cz = bz.Split('-');
- string memo = "";
- for (int i = 0; i < cz.Length; i++)
- {
- if (cz[i].IndexOf("mm") > 0)
- {
- if (cz[i + 2].IndexOf("白卡纸") >= 0)
- {
- memo = "白卡纸";
- }
- else
- {
- memo = "牛皮纸";
- }
- }
- }
- double realPrice = 0;
- double designPrice = 0, modifyPrice = 0;
- CeErpDesignerBill ceErpDesignerBill = GetByTid(tid);
- if (ceErpDesignerBill == null) return;
- CeErpProductPrice entitys = CeErpProductPrice.GetByPType(pid, memo);
- if (entitys == null) return;
- realPrice = designPrice * ceErpDesignerBill.designNum + modifyPrice * ceErpDesignerBill.modifyNum;
- StringBuilder sql = new StringBuilder();
- sql.AppendFormat("update CE_ErpDesginerBill set realPrice = " + realPrice + " where tid = '" + tid + "'");
- ExecuteNonQuery(sql.ToString());
- }
- }
- }
|