u.sql 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. update pasture p join temDict d on d.factory_name =p.name
  2. set
  3. p.company_code=d.company_code,
  4. p.company_name=d.company_name,
  5. p.factory_name=d.factory_name,
  6. p.factory_code=d.factory_code
  7. update warehouse w join pasture p on p.factory_code =w.factory_code
  8. set w.pastureId=p.id
  9. where p.factory_code <>""
  10. select warehosecode,count(*) from warehouse
  11. group by warehosecode
  12. having count(*)>1
  13. update provider set enable =0
  14. alter table PartUse modify contractId integer default 0
  15. delete from partuse where id =41772
  16. select id ,r from (select id ,row_number() over(order by id asc)r from partuse )t where r=17160
  17. select id from partuse where contractId ='' or contractId is null
  18. update partuse set contractId2 =contractId
  19. update partlaid set contractId2 =contractId
  20. delete from Equipment where modifyTime is not null
  21. update parts set enable =1 ,statue =1
  22. update department d join pasture p on p.id = d.pastureId
  23. set d.pasturename =p.name
  24. update department d join temDict_costcenter t on d.pasturename =t.factory_name
  25. and d.name =t.CostCenter_name
  26. set d.CostCenter_code = t.CostCenter_code
  27. update pasture set factory_code ='M005', parchase_organization ='1012' where name ='察北牧场';
  28. select name from pasture where name like '察北%'
  29. update pasture set factory_code ='M005' ,company_code ='1005',parchase_organization='1005'
  30. where name ='察北牧场';
  31. update pasture set factory_code 'M005' where name ='察北牧场';
  32. upadte warehourse w join pasture p on p.name = w.factory_name
  33. set w.pastureId =p.id
  34. where w.pastureId =0 or w.pastureId is null
  35. update warehouse set pastureId =115 ,pasture_name ='察北牧场' ,factory_code='M005',
  36. warehoseCode =replace(warehoseCode,char(9),'')
  37. where factory_name ='察北牧场'
  38. update Equipment set pastureId =115 ,companycode='1005' where companycode ='1006' limit 100
  39. update department d join dept_Data dd on dd.center_name =d.name
  40. set d.CostCenter_code =dd.CostCenter_code
  41. update pasture set factory_code ='M001',company_code ='9099' where name ='马鞍山牧场'
  42. update pasture set factory_code ='M008',company_code ='1008' where name ='宝鸡牧场'
  43. update parts set old_partcode =partcode
  44. update parts set partcode=new_partcode
  45. select * from part_class where partcode ='14.01.01'
  46. select * from part_class where pid = 167
  47. insert into
  48. part_repertory pr
  49. left join warehouse w on w.id =pr.locationId
  50. left join contract c on c.id=pr.contractId
  51. left join bigcontract bc on bc.id =c.bigId
  52. left join pasture p on (p.id=pr.pastureId or p.id=w.pastureId )
  53. set reportery =2
  54. where p.name ='塞一牧场'
  55. and bc.contractCode like 'BJ0220080579%'
  56. and pr.partCode ='14.02.15.06.000046'
  57. update apisql set
  58. sqlstr=
  59. "select (@sort := @sort+1) sort,empname employeeName,DATE_FORMAT(u.createdtime,'%Y-%m-%d') resumeTime,'创建合同' typeName,'提交审核' statusName
  60. from (SELECT @sort:=0)a,`user` u "
  61. where sqlname ='getContractResume'
  62. select * from pasture where name ='临沂牧场'
  63. select * from provider where providerName='无供应商旧件';
  64. select brand from part_repertory pr where pr.location ='A-01-01' and
  65. (pr.pastureId =629 or (pr.pastureId =18 and (select pastureId from warehouse where id = pr.`locationId`)= 629) )
  66. 395
  67. select partcode ,count(*) from part_repertory pr where pr.location ='A-01-01' and
  68. (pr.pastureId =618 or (pr.pastureId =18 and (select pastureId from warehouse where id = pr.`locationId`)= 618) )
  69. group by partcode
  70. having count(*)>1
  71. part_re_temp
  72. update part_repertory pr
  73. join part_re_temp t on pr.partcode =t.code and pr.brand = t.brand
  74. set pr.reportery =t.num
  75. where pr.location ='A-01-01' and
  76. (pr.pastureId =618 or (pr.pastureId =18 and (select pastureId from warehouse where id = pr.`locationId`)= 618) )
  77. and t.code not in
  78. (
  79. '14.01.01.02.000832',
  80. '14.01.04.01.001202',
  81. '14.01.07.01.002407'
  82. )
  83. 330
  84. 338
  85. 344
  86. select pr.* from part_repertory pr where pr.location ='A-01-01' and
  87. (pr.pastureId =629 or (pr.pastureId =18 and (select pastureId from warehouse where id = pr.`locationId`)= 629) )
  88. and partcode in
  89. (
  90. '14.01.01.02.000832',
  91. '14.01.04.01.001202',
  92. '14.01.07.01.002407'
  93. )
  94. select * from part_re_temp where code in
  95. (
  96. '14.01.01.02.000832',
  97. '14.01.04.01.001202',
  98. '14.01.07.01.002407'
  99. )
  100. select pr.partcode,pr.brand,t.num from part_repertory pr
  101. join part_re_temp t on pr.partcode =t.code and pr.brand = t.brand
  102. where pr.location ='A-01-01' and
  103. (pr.pastureId =629 or (pr.pastureId =18 and (select pastureId from warehouse where id = pr.`locationId`)= 629) )
  104. and pr.partcode in
  105. (
  106. '14.01.01.02.000832',
  107. '14.01.04.01.001202',
  108. '14.01.07.01.002407'
  109. )
  110. update
  111. part_repertory pr
  112. join save_temp s on pr.partcode =s.code and pr.price =s.price and pr.brand =s.brand
  113. join provider pv on pv.id =pr.providerId and pv.providerName =s.providername
  114. set pr.reportery = s.num
  115. where pr.pastureid =618 or (select pastureId from warehouse w where w.id =pr.locationid) =618
  116. update
  117. part_repertory pr
  118. join save_temp s on pr.partcode =s.code and pr.price =s.price and pr.brand =s.brand
  119. join provider pv on pv.id =pr.providerId and pv.providerName =s.providername
  120. set pr.reportery = pr.reportery -12
  121. where pr.pastureid =618 or (select pastureId from warehouse w where w.id =pr.locationid) =618
  122. select count(*) from
  123. part_repertory pr
  124. join save_temp s on pr.partcode =s.code and pr.price =s.price and pr.brand =s.brand
  125. join provider pv on pv.id =pr.providerId and pv.providerName =s.providername
  126. where pr.pastureid =621 or (select pastureId from warehouse w where w.id =pr.locationid) =621
  127. select * from part_repertory where partcode ='14.01.04.05.000485'
  128. select * from pasture where name ='云南牧场'
  129. 217